doum
12 小时以前 44cbb39057b9240baccb12ff187d8c2d0ec5424a
mini-program/pages/login/login.vue
@@ -22,7 +22,7 @@
         <image src="/static/icon/ic_agree@2x.png" v-if="!radio" @click="changeRadio()" mode="widthFix"></image>
         <image src="/static/icon/ic_agree_sel@2x.png" v-if="radio" @click="changeRadio()"  mode="widthFix"></image>
         <view class="login-info-text">
            我已阅读并同意<text>《鼎元科技用户服务协议》</text>及<text>《鼎元科技用户隐私政策》</text>
            我已阅读并同意<text @click="jumpService(4)">《鼎元科技用户服务协议》</text>及<text  @click="jumpService(5)">《鼎元科技用户隐私政策》</text>
         </view>
      </view>
   </view>
@@ -52,19 +52,37 @@
         this.focus=false
         this.focus1=false
         this.form.openid=this.openid
         this.checkLogin()
          this.checkShopLogin()
      },
      methods:{
         checkLogin(){
            if( !this.shopInfo && !this.shopToken){
               let res = await that.$u.api.getUserInfo()
         jumpService(flag) {
            uni.navigateTo({
               url: '/pagesA/pages/rich-text-page/rich-text-page?flag='+flag
            })
         },
          async checkShopLogin(){
            var that =this
            console.log("shopInfo",this.shopInfo)
            console.log("shopToken",this.shopToken)
            console.log("openid",this.openid)
            if( this.shopInfo !=null && this.shopInfo.id!=null && (this.shopToken!=null &&this.shopToken!='')){
               //验证token是否有效
               let res = await that.$u.api.getShopInfo({tokenType:1  })
               if (res.code === 200) {
                  await that.$store.commit('setUserInfo', res.data)
                  await that.$store.commit('setOpenId', res.data.openId)
                  this.jumpShopIndex()
                  await that.$store.commit('setShopInfo', res.data)
                  that.jumpShopIndex()
               }
            }else if( this.openid !=null && this.openid !=''){
               //优先静默登陆
               let res = await that.$u.api.shopOpenidLogin(this.form)
               if (res.code === 200 && res.shop!=null && res.token!=null) {
                  await that.$store.commit('setShopInfo', res.data.shop)
                  await that.$store.commit('setShopToken', res.data.token)
                  that.jumpShopIndex()
               }
            }
         },
         },
         changeRadio(){
            this.radio = !this.radio
         },
@@ -92,12 +110,13 @@
               this.loading=false
               return
            }
            var that =this
            this.$u.api.shopPasswordLogin(this.form)
               .then(res => {
                  if (res.code === 200) { 
                     await that.$store.commit('setShopInfo', res.data.member)
                     await that.$store.commit('setShopToken', res.data.token)
                     this.jumpShopIndex()
                     that.$store.commit('setShopInfo', res.data.shop)
                     that.$store.commit('setShopToken', res.data.token)
                     that.jumpShopIndex()
                  }
               })
         },