This commit is contained in:
@zuopngfei 2025-11-27 09:38:39 +08:00
parent 99d0d21d7f
commit d13d026852
3 changed files with 27 additions and 10 deletions

View File

@ -20,11 +20,11 @@ function request(url, method = 'GET', data = {}) {
header, header,
success(res) { success(res) {
if (res.data.code) { if (res.data.code) {
if (res.data.code == 10103) { if (res.data.code == 10103 || res.data.code == 10101) {
wx.removeStorageSync('access_token'); wx.removeStorageSync('access_token');
// wx.navigateTo({ wx.navigateTo({
// url: '/pages/login/login', url: '/pages/login/index',
// }); });
reject(res.data); reject(res.data);
return; return;
} }

View File

@ -210,7 +210,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="logout-btn">退出登录</view> <view class="logout-btn" @click="logout">退出登录</view>
</view> </view>
<view class="quick-card"> <view class="quick-card">
<view class="quick-title">快捷功能</view> <view class="quick-title">快捷功能</view>
@ -710,6 +710,12 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: '/pages/my/editInfo/index' url: '/pages/my/editInfo/index'
}); });
},
logout() {
wx.removeStorageSync('access_token');
uni.reLaunch({
url: '/pages/login/index'
});
} }
} }
}; };

View File

@ -43,7 +43,7 @@
<view class="product-price"> <view class="product-price">
<text class="current-price">¥{{ formatPrice(currentPrice) }}</text> <text class="current-price">¥{{ formatPrice(currentPrice) }}</text>
<text class="original-price" v-if="originalPrice > currentPrice">¥{{ formatPrice(originalPrice) <text class="original-price" v-if="originalPrice > currentPrice">¥{{ formatPrice(originalPrice)
}}</text> }}</text>
</view> </view>
<view class="sku-hint" v-if="skuList.length > 1 && !selectedSku"> <view class="sku-hint" v-if="skuList.length > 1 && !selectedSku">
请选择规格 请选择规格
@ -147,17 +147,17 @@
<view class="note-item"> <view class="note-item">
<text class="note-label">前调</text> <text class="note-label">前调</text>
<text class="note-content">{{ productInfo.scent_level.top_note || '柠檬、佛手柑、粉红胡椒' <text class="note-content">{{ productInfo.scent_level.top_note || '柠檬、佛手柑、粉红胡椒'
}}</text> }}</text>
</view> </view>
<view class="note-item"> <view class="note-item">
<text class="note-label">中调</text> <text class="note-label">中调</text>
<text class="note-content">{{ productInfo.scent_level.middle_note || '玫瑰、茉莉、牡丹' <text class="note-content">{{ productInfo.scent_level.middle_note || '玫瑰、茉莉、牡丹'
}}</text> }}</text>
</view> </view>
<view class="note-item"> <view class="note-item">
<text class="note-label">后调</text> <text class="note-label">后调</text>
<text class="note-content">{{ productInfo.scent_level.base_note || '白麝香、雪松、香草' <text class="note-content">{{ productInfo.scent_level.base_note || '白麝香、雪松、香草'
}}</text> }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -542,7 +542,7 @@ export default {
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}); });
}, },
// //
@ -605,11 +605,22 @@ export default {
// //
goToCart() { goToCart() {
const token = await uni.getStorageSync('access_token')
if (!token) {
uni.navigateTo({
url: '/pages/login/index'
})
return
}
uni.navigateTo({ uni.navigateTo({
url: '/pages/shoppingCart/index' url: '/pages/shoppingCart/index'
}); });
}, },
async fetchCartSelectedCount() { async fetchCartSelectedCount() {
const token = await uni.getStorageSync('access_token')
if (!token) {
return
}
try { try {
const res = await request('xcx/carts', 'GET', { page: 1, page_size: 99 }); const res = await request('xcx/carts', 'GET', { page: 1, page_size: 99 });
const list = res.list || res.data || res || []; const list = res.list || res.data || res || [];