Procházet zdrojové kódy

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

master
JinxChen před 2 roky
rodič
revize
b3cca318b5
3 změnil soubory, kde provedl 19 přidání a 23 odebrání
  1. +9
    -3
      README.md
  2. +2
    -2
      src/utils/model.js
  3. +8
    -18
      src/utils/request.js

+ 9
- 3
README.md Zobrazit soubor

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




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


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

+ 2
- 2
src/utils/model.js Zobrazit soubor

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

+ 8
- 18
src/utils/request.js Zobrazit soubor

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

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


Načítá se…
Zrušit
Uložit