From cfe26b325030de7fe15a361b08c10c44b06ccd05 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Thu, 14 Apr 2022 11:42:42 +0800
Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=95=B0=E6=8D=AE=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E9=9D=A2=E5=8C=85=E5=B1=91=EF=BC=8C=E8=BF=94=E5=9B=9E?=
=?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=97=B6=E8=A6=81=E6=81=A2=E5=A4=8D=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package-lock.json | 5 +
package.json | 1 +
src/api/http.js | 9 +-
src/components/TestPanel.vue | 144 +++++++++++++++-------------
src/components/breadcrumb/index.vue | 71 ++++++++++++++
src/components/codemirror.vue | 7 +-
src/config/index.js | 2 +-
src/views/Data.vue | 10 +-
src/views/Home.vue | 52 ++++++----
9 files changed, 203 insertions(+), 98 deletions(-)
create mode 100644 src/components/breadcrumb/index.vue
diff --git a/package-lock.json b/package-lock.json
index f38ecf8..9a505de 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6917,6 +6917,11 @@
"resolved": "https://registry.npm.taobao.org/js-base64/download/js-base64-2.5.2.tgz",
"integrity": "sha1-MTtidN2nGPcU0AszMLuubjjpAgk="
},
+ "js-cookie": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz",
+ "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw=="
+ },
"js-message": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/js-message/-/js-message-1.0.7.tgz",
diff --git a/package.json b/package.json
index 5897dd4..6db4a8e 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"core-js": "^3.19.3",
"element-ui": "^2.15.6",
"jquery": "^3.6.0",
+ "js-cookie": "^3.0.1",
"lib-flexible": "^0.3.2",
"postcss-px2rem": "^0.3.0",
"postcss-pxtorem": "^5.1.1",
diff --git a/src/api/http.js b/src/api/http.js
index 685bd79..4f35222 100644
--- a/src/api/http.js
+++ b/src/api/http.js
@@ -3,7 +3,7 @@ import {
Message
} from 'element-ui'
import router from '../router/index'
-import util from '@/util'
+import Cookie from 'js-cookie'
import config from '@/config'
const service = axios.create({
@@ -15,7 +15,7 @@ const service = axios.create({
service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
// 请求拦截器
service.interceptors.request.use(config => {
- const token = util.getCookie('token')
+ const token = Cookie.get('admin-token')
if (token) {
config.headers.token = token
}
@@ -49,7 +49,10 @@ service.interceptors.response.use(
switch (error.response.status) {
// 401: 未登录
case 401:
- history.back()
+ Message.error('登录过期,请重新登录')
+ setTimeout(() => {
+ history.back()
+ }, 1500)
break;
default:
// Message.error(error.response.data.message)
diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue
index dd83286..bbff075 100644
--- a/src/components/TestPanel.vue
+++ b/src/components/TestPanel.vue
@@ -127,21 +127,22 @@
+
\ No newline at end of file
diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue
index f90d49e..139a2dc 100644
--- a/src/components/codemirror.vue
+++ b/src/components/codemirror.vue
@@ -82,6 +82,7 @@