diff --git a/src/router/index.js b/src/router/index.js index 6a2bff6..77285d5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -38,7 +38,7 @@ router.beforeEach(async (to, from, next) => { NProgress.start() //动态标题 document.title = to.meta.title ? `${to.meta.title} - ${config.APP_NAME}` : `${config.APP_NAME}` - let token = tool.cookie.get("TOKEN"); + let token = tool.cookie.get("token"); if (to.path === "/login") { //删除路由(替换当前layout路由) router.addRoute(routes[0]) diff --git a/src/utils/request.js b/src/utils/request.js index d5e98f0..9095891 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -11,7 +11,7 @@ axios.defaults.timeout = sysConfig.TIMEOUT // HTTP request 拦截器 axios.interceptors.request.use( (config) => { - let token = tool.cookie.get("TOKEN"); + let token = tool.cookie.get("token"); if(token){ config.headers[sysConfig.TOKEN_NAME] = sysConfig.TOKEN_PREFIX + token } diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue index 6784b26..ec7d452 100644 --- a/src/views/login/components/passwordForm.vue +++ b/src/views/login/components/passwordForm.vue @@ -73,7 +73,7 @@ //获取token var user = await this.$api.auth.token.post(data) if(user.code == 200){ - this.$tool.cookie.set("TOKEN", user.data.token, { + this.$tool.cookie.set("token", user.data.token, { expires: 86400*360 }) }else{ @@ -95,7 +95,7 @@ }) return false } - this.$tool.data.set("MENU", menu.data.menu) + this.$tool.data.set("menu", menu.data.menu) this.$tool.data.set("userinfo", menu.data.user) this.$tool.data.set("permissions", menu.data.permissions) this.$tool.data.set("dashboardgrid", menu.data.dashboardGrid) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5244147..e677672 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -106,7 +106,7 @@ } }, created: function() { - this.$tool.cookie.remove("TOKEN") + this.$tool.cookie.remove("token") this.$tool.data.remove("userinfo") this.$tool.data.remove("menu") this.$tool.data.remove("permissions")