diff --git a/pages/users/login/login_copy.vue b/pages/users/login/login_copy.vue index ad0678b..0094efb 100644 --- a/pages/users/login/login_copy.vue +++ b/pages/users/login/login_copy.vue @@ -251,7 +251,8 @@ import { getLogo, getconfig, - getVersion + getVersion, + bindMp } from "@/api/public"; // import cookie from "@/utils/store/cookie"; import { @@ -650,6 +651,7 @@ .then(({ data }) => { + this.checkOpenId(data.user) const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index"; that.$Cache.clear(BACK_URL); that.$store.commit("LOGIN", { @@ -810,6 +812,7 @@ .then(({ data }) => { + this.checkOpenId(data.user) const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index"; that.$Cache.clear(BACK_URL); that.$store.commit("LOGIN", { @@ -865,6 +868,32 @@ title: '请勾选用户协议与隐私政策' }); that.$refs.verify.show(); + }, + checkOpenId(user) { + if (user.wechat_user_id === 0) { + let that = this + wx.getUserInfo({ + success: function(res) { + const encryptedData = res.encryptedData + const iv = res.iv + wx.login({ + success(res) { + if (res.code) { + bindMp({ code: res.code, iv: iv, encryptedData: encryptedData, phone: that + .account }).then(res => { + // console.log(res); + }) + } else { + console.log('登录失败!' + res.errMsg) + } + } + }) + }, + fail(e) { + console.log('登录失败!' + res.errMsg) + } + }) + } } } };