Browse Source

去除测试log;修改购物车无法选中的问题

zyh
Gaoxs 4 years ago
parent
commit
b61c95035e
  1. 7
      libs/wechat.js
  2. 7
      pages/Loading/index.vue
  3. 8
      pages/shop/GoodsCon/index.vue
  4. 4
      pages/shop/ShoppingCart/index.vue
  5. 30
      pages/user/UserAccount/index.vue
  6. 28
      store/index.js

7
libs/wechat.js

@ -157,7 +157,7 @@ export async function auth(code) {
return new Promise((resolve, reject) => {
let loginType = cookie.get(LOGINTYPE);
let spread = cookie.get('spread');
alert(spread)
console.log('微信授权登录前获取spread', spread)
wechatAuth(code, spread, loginType)
.then(({ data }) => {
console.log(data)
@ -167,7 +167,10 @@ export async function auth(code) {
cookie.set(WX_AUTH, code, expires_time);
cookie.remove(STATE_KEY);
loginType && cookie.remove(LOGINTYPE);
resolve();
console.log('微信公众号授权登录,获取用户信息')
store.dispatch('getUser').finally(() => {
resolve();
})
})
.catch(reject);
}).catch(error => {

7
pages/Loading/index.vue

@ -18,6 +18,7 @@
wxappAuth,
} from "@/api/user";
import dayjs from "dayjs";
import store from "@/store";
import cookie from "@/utils/store/cookie";
import {
parseQuery,
@ -34,7 +35,7 @@
return {};
},
onShow() {
console.log('getUser')
var url = handleQrCode();
if (!url) {
url = handleUrlParam(getCurrentPageUrlWithArgs())
@ -55,9 +56,7 @@
if (this.$store.getters.token) {
// token
console.log('登录状态存在,直接进页面')
this.getUser().finally(() => {
this.toLaunch();
})
this.toLaunch();
return;
}
console.log('进行登录操作')

8
pages/shop/GoodsCon/index.vue

@ -135,7 +135,10 @@
</button>
</view>
<!-- #endif -->
<view class="item" @click="goHome" >
<view class="iconfont icon-shouye-xianxing"></view>
<text>首页</text>
</view>
<view class="item" @click="setCollect" v-if="storeInfo.userCollect">
<view class="iconfont icon-shoucang1"></view>
<text>收藏</text>
@ -351,6 +354,9 @@
}
}
},
goHome() {
this.$yrouter.switchTab("/pages/home/index");
},
goShoppingCart() {
this.$yrouter.switchTab("/pages/shop/ShoppingCart/index");
},

4
pages/shop/ShoppingCart/index.vue

@ -28,7 +28,7 @@
<view class="checkbox-wrapper">
<checkbox-group @change="switchSelect(cartListValidIndex)">
<label class="well-check">
<checkbox value :checked="item.checked+''"></checkbox>
<checkbox color="#eb3729" value :checked="item.checked"></checkbox>
</label>
</checkbox-group>
</view>
@ -113,7 +113,7 @@
<checkbox-group @change="allChecked">
<label class="well-check">
<checkbox value="allSelect" :checked="isAllSelect && cartCount > 0"></checkbox>
<checkbox color="#eb3729" value="allSelect" :checked="isAllSelect && cartCount > 0"></checkbox>
<text class="checkAll">全选 ({{ cartCount }})</text>
</label>
</checkbox-group>

30
pages/user/UserAccount/index.vue

@ -97,21 +97,21 @@ export default {
},
getActivity: function() {
let that = this;
getActivityStatus().then(
res => {
that.activity.is_bargin = res.data.is_bargin;
that.activity.is_pink = res.data.is_pink;
that.activity.is_seckill = res.data.is_seckill;
},
err => {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
);
// getActivityStatus().then(
// res => {
// that.activity.is_bargin = res.data.is_bargin;
// that.activity.is_pink = res.data.is_pink;
// that.activity.is_seckill = res.data.is_seckill;
// },
// err => {
// uni.showToast({
// title:
// err.msg || err.response.data.msg || err.response.data.message,
// icon: "none",
// duration: 2000
// });
// }
// );
}
}
};

28
store/index.js

@ -90,22 +90,24 @@ const vuexStore = new Vuex.Store({
userInfo({ state, commit }, force) {
if (state.userInfo !== null && !force) {
return Promise.resolve(state.userInfo);
} else {
return new Promise(reslove => {
getUserInfo().then(res => {
commit("updateUserInfo", res.data);
reslove(res.data);
});
}).catch(() => {
uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
});
}
return new Promise(reslove => {
getUserInfo().then(res => {
commit("updateUserInfo", res.data);
reslove(res.data);
});
}).catch(() => {
uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
});
},
getUser({ state, commit }) {
if (!state.token) {
return Promise.reject('未获取到token');
}
return new Promise(reslove => {
getUserInfo().then(res => {
console.log(res)

Loading…
Cancel
Save