From e6298ca68c5846033adef24c54fba070a350af7e Mon Sep 17 00:00:00 2001 From: 2183691628 <2183691628@qq.com> Date: Tue, 14 Dec 2021 09:45:30 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=8F=96=E6=B6=88=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E5=BC=B9=E7=AA=97=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=A1=AE=E8=AE=A4=E5=BC=B9=E7=AA=97=20-=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20=E7=99=BB=E5=BD=95=E6=88=90=E5=8A=9F=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++-- src/utils/request.js | 18 ++++++++++++++---- src/views/login/index.vue | 4 ++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7085afb..cc97413 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ @@ -82,4 +82,6 @@ FIX `2021年12月14日` FIX - 修复 token过期移动端无法跳转的问题 -- 删除 页面中不使用的 TopMenu组件 \ No newline at end of file +- 删除 页面中不使用的 TopMenu组件 +- 取消 登录过期弹窗退出登录确认弹窗 +- 增加 登录成功提示 \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index cf7e12a..d3a17c4 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,12 +1,12 @@ /* * @Date: 2021-12-08 15:59:46 * @LastEditors: JinxuChen - * @LastEditTime: 2021-12-14 09:25:12 + * @LastEditTime: 2021-12-14 09:40:30 * @FilePath: \GpsCardAdmin\src\utils\request.js * @description: */ import axios from 'axios' -import { MessageBox, Message } from 'element-ui' +import { Message } from 'element-ui' import store from '@/store' /* import { getToken } from '@/utils/auth' */ @@ -63,7 +63,7 @@ service.interceptors.response.use( // 106 token验证过期; if (res.code === 106) { // to re-login - MessageBox.confirm('登录过期,是否重新登录?', { + /* MessageBox.confirm('登录过期,是否重新登录?', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' @@ -71,7 +71,17 @@ service.interceptors.response.use( store.dispatch('user/resetToken').then(() => { location.reload() }) - }) + }) */ + setTimeout(() => { + store.dispatch('user/resetToken').then(() => { + Message({ + message:/* res.message || */ 'token过期,请重新登录', + type: 'error', + duration: 1500 + }) + location.reload() + }) + }, 1500) } return Promise.reject(new Error(res.message || 'Error')) } else { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 3f71ed6..ac38ca9 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -114,6 +114,10 @@ export default { console.log("res", res.userName); this.$localStore.commit('userName', res.userName); _this.$store.dispatch('user/getInfo'); + _this.$message({ + message: '登录成功!', + type: 'success' + }) this.$router.push({ path: this.redirect || '/' }) this.loading = false }).catch(() => {