|
@@ -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
|