Ver código fonte

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

master
JinxChen 2 anos atrás
pai
commit
b3cca318b5
3 arquivos alterados com 19 adições e 23 exclusões
  1. +9
    -3
      README.md
  2. +2
    -2
      src/utils/model.js
  3. +8
    -18
      src/utils/request.js

+ 9
- 3
README.md Ver arquivo

@@ -1,7 +1,7 @@
<!--
* @Date: 2021-11-29 11:14:13
* @LastEditors: JinxuChen
* @LastEditTime: 2022-01-10 09:43:23
* @LastEditTime: 2022-01-11 14:14:32
* @FilePath: \GpsCardAdmin\README.md
* @description:
-->
@@ -167,6 +167,12 @@ FIX


## v1.2.0F
`2021年9日`
`2021年1月9日`
FIX
- 修改 登录过期错误提示
- 修改 登录过期错误提示


## v1.2.1F
`2021年1月11日`
FIX
- 修复 登录过期错误提示显示两次的问题

+ 2
- 2
src/utils/model.js Ver arquivo

@@ -1,8 +1,8 @@
/*
* @Date: 2021-11-30 15:09:25
* @LastEditors: JinxuChen
* @LastEditTime: 2022-01-10 09:43:52
* @LastEditTime: 2022-01-11 14:14:38
* @FilePath: \GpsCardAdmin\src\utils\model.js
* @description: 版本号
*/
export const VersionModel = '1.2.0';
export const VersionModel = '1.2.1';

+ 8
- 18
src/utils/request.js Ver arquivo

@@ -1,7 +1,7 @@
/*
* @Date: 2021-12-08 15:59:46
* @LastEditors: JinxuChen
* @LastEditTime: 2022-01-10 09:41:58
* @LastEditTime: 2022-01-11 14:25:43
* @FilePath: \GpsCardAdmin\src\utils\request.js
* @description:
*/
@@ -55,23 +55,14 @@ service.interceptors.response.use(
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 0) {
Message({
message: res.message || 'Error',
message: res.message || '出错了,请联系管理员!',
type: 'error',
duration: 5 * 1000
duration: 3 * 1000
})

// 106 token验证过期;
if (res.code === 106) {
return Promise.reject(new Error(res.message))
} else if (res.code === 106) {
// to re-login
/* MessageBox.confirm('登录过期,是否重新登录?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
store.dispatch('user/resetToken').then(() => {
location.reload()
})
}) */
setTimeout(() => {
store.dispatch('user/resetToken').then(() => {
Message({
@@ -83,9 +74,8 @@ service.interceptors.response.use(
})
}, 1500)
return Promise.reject(new Error('token过期,请重新登录'))
}
/* return Promise.reject(new Error(res.message)) */
} else {
}
else {
return res
}
},
@@ -94,7 +84,7 @@ service.interceptors.response.use(
Message({
message: error.message,
type: 'error',
duration: 5 * 1000
duration: 3 * 1000
})
/* return Promise.reject(error) */
}


Carregando…
Cancelar
Salvar