Browse Source

- 修复 登录过期错误提示两次的问题

master
JinxChen 2 years ago
parent
commit
c0f1ae75d8
2 changed files with 8 additions and 7 deletions
  1. +3
    -2
      README.md
  2. +5
    -5
      src/utils/request.js

+ 3
- 2
README.md View File

@@ -1,7 +1,7 @@
<!-- <!--
* @Date: 2021-11-29 11:14:13 * @Date: 2021-11-29 11:14:13
* @LastEditors: JinxChen * @LastEditors: JinxChen
* @LastEditTime: 2022-01-12 09:17:09
* @LastEditTime: 2022-01-12 09:24:58
* @FilePath: \GpsCardAdmin\README.md * @FilePath: \GpsCardAdmin\README.md
* @description: * @description:
--> -->
@@ -180,4 +180,5 @@ FIX
## v1.2.2F ## v1.2.2F
`2021年1月12日` `2021年1月12日`
FIX FIX
- 修复 登录过期没有跳转到登录界面的问题
- 修复 登录过期没有跳转到登录界面的问题
- 修复 登录过期错误提示两次的问题

+ 5
- 5
src/utils/request.js View File

@@ -1,7 +1,7 @@
/* /*
* @Date: 2021-12-08 15:59:46 * @Date: 2021-12-08 15:59:46
* @LastEditors: JinxChen * @LastEditors: JinxChen
* @LastEditTime: 2022-01-12 09:18:37
* @LastEditTime: 2022-01-12 09:31:21
* @FilePath: \GpsCardAdmin\src\utils\request.js * @FilePath: \GpsCardAdmin\src\utils\request.js
* @description: * @description:
*/ */
@@ -68,14 +68,14 @@ service.interceptors.response.use(
setTimeout(() => { setTimeout(() => {
store.dispatch('user/resetToken').then(() => { store.dispatch('user/resetToken').then(() => {
Message({ Message({
message: 'token过期,请重新登录',
message: '登录过期,请您重新登录!',
type: 'error', type: 'error',
duration: 1500 duration: 1500
}) })
location.reload() location.reload()
}) })
}, 1500)
return Promise.reject(new Error('token过期,请重新登录'))
}, 1000)
/* return Promise.reject(new Error('token过期,请重新登录')) */
} else if (res.code === 0) { } else if (res.code === 0) {
return res return res
} else { } else {
@@ -88,7 +88,7 @@ service.interceptors.response.use(
} }
}, },
error => { error => {
console.log('err' + error) // for debug
console.log('err:', error) // for debug
Message({ Message({
message: error.message, message: error.message,
type: 'error', type: 'error',


Loading…
Cancel
Save