张延森 4 vuotta sitten
vanhempi
commit
3ebeed36e5
1 muutettua tiedostoa jossa 13 lisäystä ja 2 poistoa
  1. 13
    2
      src/components/MainPage/index.vue

+ 13
- 2
src/components/MainPage/index.vue Näytä tiedosto

@@ -105,7 +105,7 @@ export default {
105 105
             _that.WxLogin({ queryData: { code: res.code } }).then((res) => {
106 106
               wx.setStorageSync('token', res.data.data.token)
107 107
               wx.setStorageSync('tokentime', Date.now())
108
-              if (CurrentPageRoute !== 'pages/Index/index') { // 非首页
108
+              if (_that.isAuthPage()) { // 非首页
109 109
                 // if (CurrentPageRoute !== '') { // 非首页
110 110
                 if (!_that.UserInfo.avatar) { // 未授权头像
111 111
                   _that.ShowUserIconAuthPopup = true
@@ -121,7 +121,7 @@ export default {
121 121
           }
122 122
         })
123 123
       } else {
124
-        if (CurrentPageRoute !== 'pages/Index/index') { // 非首页
124
+        if (this.isAuthPage()) { // 非首页
125 125
           // if (CurrentPageRoute !== '') { // 非首页
126 126
           if (!_that.UserInfo.avatar) { // 未授权头像
127 127
             _that.ShowUserIconAuthPopup = true
@@ -193,6 +193,17 @@ export default {
193 193
           this.$emit('UserInfoChange')
194 194
         }
195 195
       })
196
+    },
197
+    isAuthPage() {
198
+      const whiteList = [
199
+        'pages/Index/index',
200
+        'pages/Study/index',
201
+      ]
202
+
203
+      const current = Taro.getCurrentPages()[Taro.getCurrentPages().length - 1].route
204
+      const exists = whiteList.filter((it) => current.indexOf(it) > -1)
205
+
206
+      return exists.length < 1
196 207
     }
197 208
   }
198 209
 }