feat: 首页未登录时优化

dev_1.0.1
hu-qi 5 months ago
parent 7601e45078
commit d2d931ed67
No known key found for this signature in database
GPG Key ID: C8A53E9FE5178D78

@ -35,7 +35,7 @@
<!-- 标签列表 -->
<u-sticky bgColor="#f5f5f5">
<u-tabs bgColor="#f5f5f5" class="tag-list" :list="categoryList" :current="tagCurrent" @change="changeTag"
<u-tabs bgColor="#f5f5f5" class="tag-list" :height="56" :list="categoryList" :current="tagCurrent" @change="changeTag"
:activeStyle="{
color: '#ffffff',
fontWeight: 'bold',
@ -180,9 +180,11 @@
name: "全部"
}].concat(response.data.categoryList)
});
console.log('this.hasLogin', this.hasLogin)
if (!this.hasLogin) {
return;
}
fetchCartList().then(response => {
this.cartNum = response.data.reduce((sum, item) => sum + item.quantity, 0);
})

@ -5,13 +5,15 @@
<u-swiper :list="imgList" :autoplay="false" indicatorStyle="right: 20px" duration="400" mode="number"
height="750" indicator-pos="bottomRight" class="swiper">
</u-swiper>
<view class="btn-box">
<view class="goback" @click="goBack">
<image src="@/static/icons/icon_back.png" mode=""></image>
</view>
<view class="share" @click="share">
<image src="@/static/icons/icon_share.png" mode=""></image>
</view>
</view>
<view class="btn-box" :style="{top:statusBarHeight+'px'}">
<view class="goback" @click="goBack">
<image src="@/static/icons/icon_back.png" mode=""></image>
</view>
<view class="share" @click="share">
<image src="@/static/icons/icon_share.png" mode=""></image>
</view>
</view>
@ -25,7 +27,7 @@
<text class="title">{{product.name}}</text><br>
<text class="title2">{{product.subTitle}}</text>
<!-- <view class="bot-row">
<!-- <view class="bot-row">
<text>销量: {{product.sale}}</text>
<text>库存: {{product.stock}}</text>
<text>浏览量: 768</text>
@ -33,7 +35,7 @@
</view>
<!-- 分享 -->
<!-- <view class="share-section" @click="share">
<!-- <view class="share-section" @click="share">
<view class="share-icon">
<text class="yticon icon-xingxing"></text>
@ -84,7 +86,7 @@
</view>
<!-- 评价 -->
<!-- <view class="eva-section">
<!-- <view class="eva-section">
<view class="e-header">
<text class="tit">评价</text>
<text>(86)</text>
@ -297,6 +299,8 @@
},
data() {
return {
// +
statusBarHeight: 0,
specClass: 'none',
attrClass: 'none',
specSelected: [],
@ -321,6 +325,16 @@
let id = options.id;
this.shareList = defaultShareList;
this.loadData(id);
let systemInfo = uni.getSystemInfoSync()
this.statusBarHeight = systemInfo.statusBarHeight
console.log("N", systemInfo.statusBarHeight)
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.statusBarHeight = (menuButtonInfo.top - this.statusBarHeight) + menuButtonInfo.height + systemInfo.statusBarHeight
console.log("S", menuButtonInfo.top, menuButtonInfo.height)
console.log('M', this.statusBarHeight)
},
computed: {
...mapState(['hasLogin'])
@ -605,7 +619,9 @@
//
initProductDesc() {
let rawhtml = this.product.detailMobileHtml;
if(!rawhtml){ return}
if (!rawhtml) {
return
}
let tempNode = document.createElement('div');
tempNode.innerHTML = rawhtml;
let imgs = tempNode.getElementsByTagName('img');
@ -764,25 +780,12 @@
.carousel {
height: 722upx;
position: relative;
.btn-box {
width: 100vw;
position: absolute;
top: calc(var(--status-bar-height) + 38upx);
left: 0upx;
padding: 38upx;
@include flex(x, center, center);
justify-content: space-between;
/* align-self: ; */
view image {
width: 60upx;
height: 60upx;
}
}
.swiper {
height: 100%;
.u-swiper-indicator {
bottom: 36upx!important;
bottom: 36upx !important;
}
}
@ -806,6 +809,22 @@
}
.btn-box {
width: 100vw;
position: absolute;
top: calc(var(--status-bar-height) + 38upx);
left: 0upx;
padding: 38upx;
@include flex(x, center, center);
justify-content: space-between;
/* align-self: ; */
view image {
width: 60upx;
height: 60upx;
}
}
/* 标题简介 */
.introduce-section {
background: #fff;
@ -1300,6 +1319,7 @@
width: 96upx;
height: 80upx;
position: relative;
.cart-badge>view {
top: 0upx !important;
right: 0upx !important;

@ -72,7 +72,7 @@
//
isRead: false,
//
isShowCode: true,
isShowCode: false,
//
isLogining: false,
//

@ -3,6 +3,7 @@ import {
API_BASE_URL,
API_USER_URL,
} from '@/utils/appConfig.js';
import store from '@/store/index.js';
const http = new Request()
@ -58,7 +59,7 @@ http.interceptor.response((response) => {
uni.showToast({
title: res.message,
duration: 1500,
icon: 'error'
icon: 'none'
})
//401未登录处理
if (res.code === 401) {
@ -77,7 +78,7 @@ http.interceptor.response((response) => {
}
}
});
uni.setStorageSync('token', '')
store.commit('logout')
}
return Promise.reject(response);
} else {

Loading…
Cancel
Save