diff --git a/README.md b/README.md index 9fe874e..11ee4f6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ @@ -167,6 +167,12 @@ FIX ## v1.2.0F -`2021年9日` +`2021年1月9日` FIX -- 修改 登录过期错误提示 \ No newline at end of file +- 修改 登录过期错误提示 + + +## v1.2.1F +`2021年1月11日` +FIX +- 修复 登录过期错误提示显示两次的问题 \ No newline at end of file diff --git a/src/utils/model.js b/src/utils/model.js index 298f3b4..6f9ff9f 100644 --- a/src/utils/model.js +++ b/src/utils/model.js @@ -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'; \ No newline at end of file +export const VersionModel = '1.2.1'; \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 0f62004..18b58fe 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -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) */ }