From e0f0ed00920b03e00cbf7b27425be3de67da1acd Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 17 May 2024 16:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=BC=80=E5=A7=8B=E5=BC=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/http.js | 6 +++- src/components/TestPanel.vue | 24 +++++++++++-- src/components/breadcrumb/index.vue | 53 ++++++++++++----------------- src/components/codemirror.vue | 7 ++-- src/config/index.js | 2 +- 5 files changed, 54 insertions(+), 38 deletions(-) diff --git a/src/api/http.js b/src/api/http.js index 4f35222..8d3234d 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -30,6 +30,7 @@ service.interceptors.request.use(config => { return Promise.reject(err); }) +let logouted = 0; // 响应拦截器 service.interceptors.response.use( response => { @@ -49,11 +50,14 @@ service.interceptors.response.use( switch (error.response.status) { // 401: 未登录 case 401: + if (!logouted) { Message.error('登录过期,请重新登录') setTimeout(() => { history.back() }, 1500) - break; + logouted = 1 + } + break; default: // Message.error(error.response.data.message) Promise.reject(error.response); diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index 1017ddd..c45fb05 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -51,7 +51,7 @@ 查看实验报告 重新开始 点击重新开始,之前操作会清空。

确定重新开始吗?

', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + closeOnClickModal: false, + dangerouslyUseHTMLString: true, + }) + this.reload() + } catch (e) { } + } + }, // 页面加载完后重置编辑框大小 ready (i) { if (this.$refs['codemirror' + i]) { @@ -1583,4 +1600,7 @@ export default { } } } +.text-danger { + color: #f56c6c; +} \ No newline at end of file diff --git a/src/components/breadcrumb/index.vue b/src/components/breadcrumb/index.vue index dd3d251..7b6a0b4 100644 --- a/src/components/breadcrumb/index.vue +++ b/src/components/breadcrumb/index.vue @@ -3,15 +3,12 @@