修复token过期未清除bug

ywj_dev
曹晨晨 2 years ago
parent a4594ad8ff
commit 211a67fb29

@ -87,6 +87,7 @@ Vue.use(Element, {
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,

@ -1,6 +1,5 @@
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
Vue.use(Router) Vue.use(Router)
/* Layout */ /* Layout */
@ -175,9 +174,13 @@ Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(err => err) return routerPush.call(this, location).catch(err => err)
} }
export default new Router({ export default new Router({
base: process.env.VUE_APP_CONTEXT_PATH, base: process.env.VUE_APP_CONTEXT_PATH,
mode: 'hash', // 去掉url中的# mode: 'hash', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes routes: constantRoutes,
}) })

@ -6,6 +6,7 @@ import errorCode from '@/utils/errorCode'
import {tansParams, blobValidate} from "@/utils/ruoyi"; import {tansParams, blobValidate} from "@/utils/ruoyi";
import cache from '@/plugins/cache' import cache from '@/plugins/cache'
import {saveAs} from 'file-saver' import {saveAs} from 'file-saver'
import Cookies from 'js-cookie'
let downloadLoadingInstance; let downloadLoadingInstance;
// 是否显示重新登录 // 是否显示重新登录
@ -96,7 +97,8 @@ service.interceptors.response.use(res => {
).then(() => { ).then(() => {
isRelogin.show = false; isRelogin.show = false;
store.dispatch('LogOut').then(() => { 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(() => { }).catch(() => {
isRelogin.show = false; isRelogin.show = false;

@ -238,8 +238,6 @@ export default {
}); });
this.getCookie(); this.getCookie();
} }
}; };
</script> </script>

Loading…
Cancel
Save