tanyanfei 3 years ago
parent
commit
adc69143d6
3 changed files with 51 additions and 1 deletions
  1. 18 0
      pages/index/index.js
  2. 17 1
      pages/rank/rank.js
  3. 16 0
      pages/upload/upload.js

+ 18 - 0
pages/index/index.js

@@ -27,6 +27,7 @@ Page({
             userInfo: res.data
           })
           this.getData();
+          this.getuser()
         }else{
           wx.switchTab({
             url: '../user/user',
@@ -43,13 +44,30 @@ Page({
     })
   },
   onShow(){
+    
     if (!this.data.userInfo.token) {
       this.onLoad()
     }else{
       wx.showNavigationBarLoading()
       this.getData()
+      this.getuser()
     }
   },
+  getuser(){
+    wx.request({
+      url: host + '/api/wx/authinfo',
+      header: {
+        'Authorization': this.data.userInfo.token
+      },
+      success: res => {
+        if (res.data.data.need_fill) {
+          wx.switchTab({
+            url: '../user/user',
+          })
+        }
+      }
+    })
+  },
   getData(){
     
     wx.request({

+ 17 - 1
pages/rank/rank.js

@@ -25,6 +25,7 @@ Page({
             userInfo: res.data
           })
           this.getData();
+          this.getuser()
         } else {
           wx.switchTab({
             url: '../user/user',
@@ -44,11 +45,26 @@ Page({
     if (!this.data.userInfo.token) {
       this.onLoad()
     } else {
-      console.log(233)
       wx.showNavigationBarLoading()
       this.getData()
+      thid.getuser()
     }
   },
+  getuser() {
+    wx.request({
+      url: host + '/api/wx/authinfo',
+      header: {
+        'Authorization': this.data.userInfo.token
+      },
+      success: res => {
+        if (res.data.data.need_fill) {
+          wx.switchTab({
+            url: '../user/user',
+          })
+        }
+      }
+    })
+  },
   getData() {
     wx.request({
       url: host + '/api/wx/group/rank/list',

+ 16 - 0
pages/upload/upload.js

@@ -47,6 +47,7 @@ Page({
           }
         }
       })
+      this.getuser()
     },500)
   },
   onLoad: function (options) {
@@ -79,6 +80,21 @@ Page({
       }
     })
   },
+  getuser() {
+    wx.request({
+      url: host + '/api/wx/authinfo',
+      header: {
+        'Authorization': this.data.userInfo.token
+      },
+      success: res => {
+        if (res.data.data.need_fill) {
+          wx.switchTab({
+            url: '../user/user',
+          })
+        }
+      }
+    })
+  },
   getData() {
     wx.request({
       url: host + '/api/wx/stock/search',