文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 08d12859 by 李严凡

未登录拦截

parent e03f0529
......@@ -34,9 +34,16 @@ axios.interceptors.response.use(function (response) {
})
//添加请求拦截器,每次请求设置都请求cookie信息
axios.interceptors.request.use(function(config){
let token = localStorage.getItem("userId")
if(!token){
window.location.href = '/#/login'
let token = localStorage.getItem("vuex")//获取vuex的全局变量
// console.log(localStorage)
// console.log(token)
//如果vuex的全局变量userInfo为空值
if(token == NULL){
ElementUI.Message({
type:"warning",
message:"您未登录,请前往登录界面进行操作"
})
window.location.href = '/#/'
}
return config
},function(error){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment