| | |
| | | |
| | | export default { |
| | | computed: { |
| | | ...mapState(['openid', 'userInfo']) |
| | | ...mapState(['openid', 'userInfo','userType']) |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | }, |
| | | onLoad() { |
| | | // 静默登录 |
| | | |
| | | if (this.userInfo.bindShopId) { |
| | | this.$u.api.shopSilentLogin({}) |
| | | .then(async res => { |
| | | if (res.code === 200) { |
| | | this.$store.commit('setUserType', 1) |
| | | this.$store.commit('setShopToken', res.data.token) |
| | | // 获取门店信息 |
| | | const shopInfoRes = await this.$u.api.getShopInfo({}) |
| | | if (shopInfoRes.code === 200) { |
| | | this.$store.commit('setShopInfo', shopInfoRes.data) |
| | | uni.showLoading({ |
| | | title:'登录中...' |
| | | }) |
| | | try{ |
| | | console.log(this.userType,"============================================") |
| | | this.$u.api.shopSilentLogin({}) |
| | | .then( res => { |
| | | if (res.code === 200) { |
| | | this.$store.commit('setUserType', 1) |
| | | this.$store.commit('setShopToken', res.data.token) |
| | | // 获取门店信息 |
| | | this.$u.api.getShopInfo({}).then( shopInfoRes => { |
| | | if (shopInfoRes.code === 200) { |
| | | this.$store.commit('setShopInfo', shopInfoRes.data) |
| | | } |
| | | uni.hideLoading(); |
| | | // setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '/shop/pages/store-home/store-home' |
| | | }); |
| | | // }, 1000) |
| | | }) |
| | | } |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '/shop/pages/store-home/store-home' |
| | | }); |
| | | }, 1000) |
| | | } |
| | | }) |
| | | }) |
| | | }catch(e){ |
| | | uni.hideLoading() |
| | | } |
| | | setTimeout(() => { |
| | | uni.hideLoading() |
| | | }, 10000) |
| | | } |
| | | }, |
| | | methods: { |