提交 4aef010c 编写于 作者: guangjun.yang's avatar guangjun.yang

授权等

登陆等
上级 0d8f8ebb
...@@ -77,6 +77,7 @@ import { Swipe, SwipeItem } from 'vant'; ...@@ -77,6 +77,7 @@ import { Swipe, SwipeItem } from 'vant';
import Loading from "@/components/common/common-loading"; import Loading from "@/components/common/common-loading";
import { wxConfig, chooseWXPay } from '@/utils/wxShare'; import { wxConfig, chooseWXPay } from '@/utils/wxShare';
import { getAPPID, getWebPageUrl, isWeiXin, wxOauth, debounce } from '@/utils'; import { getAPPID, getWebPageUrl, isWeiXin, wxOauth, debounce } from '@/utils';
import { mapGetters } from "vuex";
const isWechat = isWeiXin(); const isWechat = isWeiXin();
wxConfig(location.href); wxConfig(location.href);
...@@ -102,9 +103,10 @@ export default { ...@@ -102,9 +103,10 @@ export default {
} }
}, },
computed: { computed: {
logged() { ...mapGetters(["logged"]),
return this.$store.getters.logged; // logged() {
}, // return this.$store.getters.logged;
// },
wxInfo() { wxInfo() {
return this.$store.state.user.wxInfo; return this.$store.state.user.wxInfo;
}, },
...@@ -126,15 +128,17 @@ export default { ...@@ -126,15 +128,17 @@ export default {
if (token && !info.id) { if (token && !info.id) {
this.$store.dispatch('getUserInfo'); this.$store.dispatch('getUserInfo');
} }
// 微信内先去授权
if (isWechat && !this.wxInfo.openid) { // // 微信内先去授权
if (location.search.indexOf('code') >= 0 || this.wxCode) { // if (isWechat && !this.wxInfo.openid) {
// 避免code中转页再次授权 // if (location.search.indexOf('code') >= 0 || this.wxCode) {
return; // // 避免code中转页再次授权
} // return;
wxOauth(); // }
return; // wxOauth();
} // return;
// }
// 数量加减 // 数量加减
this.curtGoodsNum = this.goodsNum; this.curtGoodsNum = this.goodsNum;
this.countTotalPrice = debounce(this.getTotalPrice, 500); this.countTotalPrice = debounce(this.getTotalPrice, 500);
...@@ -275,6 +279,14 @@ export default { ...@@ -275,6 +279,14 @@ export default {
this.goLogin(); this.goLogin();
return; return;
} }
// 微信内先去授权
if (isWechat && !this.wxInfo.openid) {
this.$toast('微信授权中');
wxOauth();
return;
}
// 避免多次支付 // 避免多次支付
if (this.showLoading) { if (this.showLoading) {
return; return;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册