| | |
| | | radio:false |
| | | }; |
| | | }, |
| | | onShow() { |
| | | async onLoad() { |
| | | }, |
| | | async onShow() { |
| | | await this.$onLaunched; |
| | | this.focus=false |
| | | this.focus1=false |
| | | this.form.openid=this.openid |
| | |
| | | }) |
| | | }, |
| | | async checkShopLogin(){ |
| | | uni.showLoading( ) |
| | | 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('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) { |
| | | 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) { |
| | | await that.$store.commit('setShopInfo', res.data.shop) |
| | | await that.$store.commit('setShopToken', res.data.token) |
| | | that.jumpShopIndex() |
| | | } |
| | | } |
| | | setTimeout(function () { |
| | | uni.hideLoading(); |
| | | }, 1000); |
| | | }, |
| | | changeRadio(){ |
| | | this.radio = !this.radio |
| | |
| | | }) |
| | | }, |
| | | jumpShopIndex() { |
| | | uni.navigateTo({ |
| | | uni.redirectTo({ |
| | | url: '/pages/distributor/distributor' |
| | | }) |
| | | } |