Jelajahi Sumber

fix: bugFixed tokenExpireTime

wangyuan 2 tahun lalu
induk
melakukan
9dbf032e98
1 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 9 2
      pages/login/login.js

+ 9 - 2
pages/login/login.js

@@ -18,7 +18,7 @@ Page({
   },
   setTokenExpireTime () {
     const tokenExpireTime = wx.getStorageSync('tokenExpireTime')
-    if (util.getDate() !== tokenExpireTime) {
+    if (tokenExpireTime !== '' && util.getDate() !== tokenExpireTime) {
       wx.clearStorageSync()
     }
     this.handleLogin()
@@ -26,7 +26,13 @@ Page({
   handleLogin () {
     const accessToken = wx.getStorageSync('accessToken')
     if (accessToken) {
-      this.handleTokenLogin()
+      const workerLoginCode = wx.getStorageSync('workerLoginCode')
+      if (workerLoginCode == '403') {
+        wx.clearStorageSync()
+        this.handleWXLogin()
+      } else {
+        this.handleTokenLogin()
+      }
     } else {
       this.handleWXLogin()
     }
@@ -37,6 +43,7 @@ Page({
   },
   handleWXLogin () {
     const workerLoginCode = wx.getStorageSync('workerLoginCode')
+    console.log(workerLoginCode, 'workerLoginCode', wx.getStorageSync('workerLoginCode'));
     if (workerLoginCode == '403') {
       this.handleCode403()
     } else {