From 211a67fb2953791bc666c52a601610336beb3330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E6=99=A8=E6=99=A8?= Date: Fri, 14 Apr 2023 17:40:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtoken=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=9C=AA=E6=B8=85=E9=99=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 1 + src/router/index.js | 7 +++++-- src/utils/request.js | 4 +++- src/views/myLogin.vue | 2 -- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.js b/src/main.js index 1c9cf17..8e90b9f 100644 --- a/src/main.js +++ b/src/main.js @@ -87,6 +87,7 @@ Vue.use(Element, { Vue.config.productionTip = false + new Vue({ el: '#app', router, diff --git a/src/router/index.js b/src/router/index.js index afe5086..126dd34 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,6 +1,5 @@ import Vue from 'vue' import Router from 'vue-router' - Vue.use(Router) /* Layout */ @@ -175,9 +174,13 @@ Router.prototype.push = function push(location) { return routerPush.call(this, location).catch(err => err) } + + export default new Router({ base: process.env.VUE_APP_CONTEXT_PATH, mode: 'hash', // 去掉url中的# scrollBehavior: () => ({ y: 0 }), - routes: constantRoutes + routes: constantRoutes, }) + + diff --git a/src/utils/request.js b/src/utils/request.js index a36d2ec..b02dfd7 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -6,6 +6,7 @@ import errorCode from '@/utils/errorCode' import {tansParams, blobValidate} from "@/utils/ruoyi"; import cache from '@/plugins/cache' import {saveAs} from 'file-saver' +import Cookies from 'js-cookie' let downloadLoadingInstance; // 是否显示重新登录 @@ -96,7 +97,8 @@ service.interceptors.response.use(res => { ).then(() => { isRelogin.show = false; store.dispatch('LogOut').then(() => { - location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; + Cookies.remove() + location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; }) }).catch(() => { isRelogin.show = false; diff --git a/src/views/myLogin.vue b/src/views/myLogin.vue index 320dc7f..61a94b7 100644 --- a/src/views/myLogin.vue +++ b/src/views/myLogin.vue @@ -238,8 +238,6 @@ export default { }); this.getCookie(); - - } };