k94314517
2025-07-17 bbd9c436f23f5fdbe712c4a22d90b457066bdf38
small-program/App.vue
@@ -6,14 +6,13 @@
      },
      onLaunch: function() {
         var that = this;
         console.log(this.userInfo)
         if (!this.userInfo || JSON.stringify(this.userInfo) == '{}') {
         if (!this.openid || this.openid =='') {
            uni.login({
               provider: 'weixin',
               success: async function (loginRes) {
                  let { code } = loginRes;
                  let res = await that.$u.api.wxLogin({ code })
                  if (res.code === 200) {
                  if (res&& res.code === 200) {
                     that.$store.commit('setToken', res.data.token)
                     that.$store.commit('setOpenid', res.data.openid)
                     that.$store.commit('setUserInfo', res.data.member)
@@ -21,10 +20,22 @@
                  }
               }
            });
         }
         }
      },
      onShow: function() {
         console.log('App Show')
         var that =this
         let res =  this.$u.api.getMemberInfo({}).then(res =>{
            if (res && res.code ===200) {
               that.$store.commit('setUserInfo', res.data)
               that.$isResolve()
            }else{
               that.$store.commit('setToken','')
               that.$store.commit('setUserInfo',{})
               that.$isResolve()
            }
         })
      },
      onHide: function() {
         console.log('App Hide')