MrShi
14 小时以前 ac33a3140ef8ef20dfd2537fce2dfdd0f374f30e
mini-program/pages/login/login.vue
@@ -66,12 +66,27 @@
          async checkShopLogin(){
            uni.showLoading( )
            var that =this
            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('setShopInfo', res.data)
                  that.jumpShopIndex()
            try{
               if( this.shopInfo !=null && this.shopInfo.id!=null && (this.shopToken!=null &&this.shopToken!='')){
                  //验证token是否有效
                  try{
                     let res = await that.$u.api.getShopInfo({tokenType:1  })
                     if (res.code === 200) {
                        await that.$store.commit('setShopInfo', res.data)
                        that.jumpShopIndex()
                        return
                     }
                  }catch(e){
                     if( this.openid !=null && this.openid !=''){
                        let res = await that.$u.api.shopOpenidLogin(this.form)
                           if (res.code === 200 && res.data.shop!=null && res.data.token!=null) {
                           await that.$store.commit('setShopInfo', res.data.shop)
                           await that.$store.commit('setShopToken', res.data.token)
                           that.jumpShopIndex()
                        }
                     }
                  }
               }else if( this.openid !=null && this.openid !=''){
                  let res = await that.$u.api.shopOpenidLogin(this.form)
                     if (res.code === 200 && res.data.shop!=null && res.data.token!=null) {
@@ -79,18 +94,16 @@
                     await that.$store.commit('setShopToken', res.data.token)
                     that.jumpShopIndex()
                  }
               }
            }else if( this.openid !=null && this.openid !=''){
               let res = await that.$u.api.shopOpenidLogin(this.form)
                  if (res.code === 200 && res.data.shop!=null && res.data.token!=null) {
                  await that.$store.commit('setShopInfo', res.data.shop)
                  await that.$store.commit('setShopToken', res.data.token)
                  that.jumpShopIndex()
               }
            }
            setTimeout(function () {
               uni.hideLoading();
            }, 1000);
               }
               setTimeout(function () {
                  uni.hideLoading();
               }, 1000);
            }catch(e){
               setTimeout(function () {
                  uni.hideLoading();
               }, 1000);
            }
         },  
         changeRadio(){
            this.radio = !this.radio