doum
2026-04-25 9287e9a02f9a9a85b0c4dc49f04d1426af4a0ede
small-program/shop/pages/login/login.vue
@@ -39,7 +39,7 @@
   export default {
      computed: {
         ...mapState(['openid', 'userInfo'])
         ...mapState(['openid', 'userInfo','userType'])
      },
      data() {
         return {
@@ -52,24 +52,38 @@
      },
      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: {