xcx před 4 roky
rodič
revize
3229c1ab80
2 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. 1
    1
      project.config.json
  2. 2
    1
      src/util/PublicMethod/index.js

+ 1
- 1
project.config.json Zobrazit soubor

@@ -27,7 +27,7 @@
27 27
 			"outputPath": ""
28 28
 		},
29 29
 		"useIsolateContext": true,
30
-		"useCompilerModule": true,
30
+		"useCompilerModule": false,
31 31
 		"userConfirmedUseCompilerModuleSwitch": false
32 32
 	},
33 33
 	"compileType": "miniprogram",

+ 2
- 1
src/util/PublicMethod/index.js Zobrazit soubor

@@ -32,7 +32,7 @@ const ToolClass = {
32 32
       config.url += '?' + queryData
33 33
     }
34 34
     let Header = {}
35
-    if (wx.getStorageSync('token') !== '') { // 本地获取token
35
+    if (wx.getStorageSync('token') !== '' && wx.getStorageSync('tokentime') !== '' && wx.getStorageSync('tokentime') - 0 + 24 * 60 * 60 * 1000 >= Date.now()) { // 本地获取token
36 36
       Header['X-Authorization-Jwt'] = wx.getStorageSync('token')
37 37
     }
38 38
     wx.request({
@@ -44,6 +44,7 @@ const ToolClass = {
44 44
         const token = res.header['X-Authorization-Jwt'] || res.header['X-Authorization-JWT']
45 45
         if (token) { // 更新本地存储token
46 46
           wx.setStorageSync('token', token)
47
+          wx.setStorageSync('tokentime', Date.now())
47 48
         }
48 49
         if (res.data.code - 0 === 1001) { // token失效
49 50
           // wx.login({ // 微信获取code