From b3cca318b5aec4f6367b515d9e7491bd12ebf0a0 Mon Sep 17 00:00:00 2001 From: JinxChen <2183691628@qq.com> Date: Tue, 11 Jan 2022 14:25:56 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=A4=E6=AC=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 +++++++++--- src/utils/model.js | 4 ++-- src/utils/request.js | 26 ++++++++------------------ 3 files changed, 19 insertions(+), 23 deletions(-) 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) */ }