wewe
This commit is contained in:
parent
99d0d21d7f
commit
d13d026852
@ -20,11 +20,11 @@ function request(url, method = 'GET', data = {}) {
|
||||
header,
|
||||
success(res) {
|
||||
if (res.data.code) {
|
||||
if (res.data.code == 10103) {
|
||||
if (res.data.code == 10103 || res.data.code == 10101) {
|
||||
wx.removeStorageSync('access_token');
|
||||
// wx.navigateTo({
|
||||
// url: '/pages/login/login',
|
||||
// });
|
||||
wx.navigateTo({
|
||||
url: '/pages/login/index',
|
||||
});
|
||||
reject(res.data);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout-btn">退出登录</view>
|
||||
<view class="logout-btn" @click="logout">退出登录</view>
|
||||
</view>
|
||||
<view class="quick-card">
|
||||
<view class="quick-title">快捷功能</view>
|
||||
@ -710,6 +710,12 @@ export default {
|
||||
uni.navigateTo({
|
||||
url: '/pages/my/editInfo/index'
|
||||
});
|
||||
},
|
||||
logout() {
|
||||
wx.removeStorageSync('access_token');
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -605,11 +605,22 @@ export default {
|
||||
|
||||
// 跳转到购物车
|
||||
goToCart() {
|
||||
const token = await uni.getStorageSync('access_token')
|
||||
if (!token) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/index'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/shoppingCart/index'
|
||||
});
|
||||
},
|
||||
async fetchCartSelectedCount() {
|
||||
const token = await uni.getStorageSync('access_token')
|
||||
if (!token) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await request('xcx/carts', 'GET', { page: 1, page_size: 99 });
|
||||
const list = res.list || res.data || res || [];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user