Browse Source

修复微信 绑定

shenjj 7 years ago
parent
commit
6635b459b4
2 changed files with 7 additions and 3 deletions
  1. 0 1
      pages/mobile/wechat/index.vue
  2. 7 2
      store/index.js

+ 0 - 1
pages/mobile/wechat/index.vue

@@ -76,7 +76,6 @@
         window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://pre.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
       } else if (info) {
         info = JSON.parse(info)
-        localStorage.removeItem('USOFTMALLWECHATINFO')
         if (info.openid) {
           this.$store.dispatch('GerWechatInfo', {code: '', openId: info.openid})
         } else {

+ 7 - 2
store/index.js

@@ -528,12 +528,17 @@ export const actions = {
     return axios.get('/wx/getWxUserInfo', { params: params })
       .then(response => {
         commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', response.data)
+        let Userinfo = localStorage.getItem('USOFTMALLWECHATINFO')
+        Userinfo = Userinfo && JSON.parse(Userinfo) || {}
+        localStorage.removeItem('USOFTMALLWECHATINFO')
         if (response.data.status >= 0) {
           // 有状态
           if (id !== '' && id && id !== undefined) {
-            response.data.openid = id
+            Userinfo.openid = id
           }
-          localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(response.data))
+          Userinfo.status = response.data.status
+          Userinfo.enterprises = response.data.enterprises
+          localStorage.setItem('USOFTMALLWECHATINFO', Userinfo)
         } else {
           // localStorage.removeItem('USOFTMALLWECHATINFO')
         }