Browse Source

修改微信绑定

shenjj 7 years ago
parent
commit
5d3be09a46

+ 6 - 4
components/mobile/Home.vue

@@ -212,12 +212,14 @@
         let info = localStorage.getItem('USOFTMALLWECHATINFO')
         // 如果本地有缓存 则证明存在openid
         if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && !this.$route.query.code && !info) {
-            window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
-            // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd29bbca61728b189&redirect_uri=http://gwzcfb.natappfree.cc&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+            // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+            window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd29bbca61728b189&redirect_uri=http://cuy53h.natappfree.cc&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
           } else if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger') {
             info = info && JSON.parse(info)
-            if (info.openid) {
-              this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', JSON.parse(info))
+            if (info) {
+              // if (info.status === 1) {
+              //   this.$store.dispatch('GerWechatInfo', {code: '', openId: info.openid})
+              // }
             } else {
               this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
             }

+ 3 - 3
pages/mobile/center/vendor/product.vue

@@ -57,7 +57,7 @@
             <img class="store-type" src="/images/mobile/product/self.png" alt="" v-else >
           </div>
           <div class="middle">
-            <div class="list">
+            <div class="list" style="height: 0.46rem;">
               <div class="fl">
                 <div class="name">品牌:</div>
                 <div class="text">{{item.brandNameEn}}</div>
@@ -1070,8 +1070,8 @@
         border:1px solid #1a58dd;
         display: inline-block;
         margin-right: 0.2rem;
-        line-height: 0.4rem;
-        height: 0.4rem;
+        line-height: 0.37rem;
+        height: 0.37rem;
       }
       margin-bottom: 0.18rem;
       &::after{

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

@@ -73,8 +73,12 @@
       }
       if (!info && !this.$route.query.code) {
         window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+        // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
       } else if (info) {
-        this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', JSON.parse(info))
+        info = JSON.parse(info)
+        if (info.status === 1) {
+          this.$store.dispatch('GerWechatInfo', {code: '', openId: info.openid})
+        }
       } else {
         this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
       }
@@ -127,10 +131,12 @@
             this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', res.data)
             localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(res.data))
           } else {
+            localStorage.removeItem('USOFTMALLWECHATINFO')
             this.collectResult = res.data.message
             this.timeoutCount++
           }
         }, err => {
+          localStorage.removeItem('USOFTMALLWECHATINFO')
           this.collectResult = err.response.data || '绑定失败'
           this.timeoutCount++
         })

+ 1 - 0
store/index.js

@@ -478,6 +478,7 @@ export const actions = {
         commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', response.data)
         localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(response.data))
       }, err => {
+        localStorage.removeItem('USOFTMALLWECHATINFO')
         commit('option/REQUEST_WECHATINFO_STATUS_FAILURE', err)
       })
   },