token
This commit is contained in:
parent
ac45999554
commit
b08226ed26
@ -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])
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user