Commit 619bc84b by 肖康

x

parent cf6168af
...@@ -15,7 +15,7 @@ let NODE_ENVS = "/"; ...@@ -15,7 +15,7 @@ let NODE_ENVS = "/";
switch (envs) { switch (envs) {
case 'development': case 'development':
//开发环境 //开发环境
NODE_ENVS = 'http://192.168.2.142:8080'; NODE_ENVS = 'http://192.168.2.164:8080';
break; break;
case 'test': case 'test':
//测试环境 //测试环境
......
...@@ -166,6 +166,7 @@ ...@@ -166,6 +166,7 @@
} else { } else {
app_.setAttribute('style', 'padding-left:226px'); app_.setAttribute('style', 'padding-left:226px');
} }
} }
}, },
mounted() { mounted() {
......
...@@ -57,12 +57,15 @@ router.afterEach((to, from, next) => { ...@@ -57,12 +57,15 @@ router.afterEach((to, from, next) => {
if (tabOldJson) { if (tabOldJson) {
sessionStorage.setItem('tabs', JSON.stringify(tabOldJson)); sessionStorage.setItem('tabs', JSON.stringify(tabOldJson));
} }
if (tabOldJson) {
sessionStorage.setItem('tabs', JSON.stringify(tabOldJson));
}
}); });
axios.interceptors.response.use(res => { axios.interceptors.response.use(res => {
return res; return res;
}, error => { }, error => {
Message('网络出现问题,请检查网络'); // Message('网络出现问题,请检查网络');
return Promise.reject(new Error(error)) return Promise.reject(new Error(error))
}) })
...@@ -71,17 +74,28 @@ Vue.prototype.$http = http; ...@@ -71,17 +74,28 @@ Vue.prototype.$http = http;
//路由页面回跳处理 mate里面参数 back:true 开启登录态回跳 //路由页面回跳处理 mate里面参数 back:true 开启登录态回跳
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log(to.query)
if(to.path!="/login"){
http('get', "/api/user/getuserinfo", {
}).then(data => {
let res = data.data;
if (res.err_code === 101) {
window.location.href = '/#/login?referer='+encodeURI(to.path);
}else{
next()
}
}).catch(err => {
console.log(err.message);
next()
})
}else{
next()
}
http('get', "/api/user/getuserinfo", {
}).then(data => {
let res = data.data;
if (res.err_code === 101) {
window.location.href = '/#/login';
}
}).catch(err => {
console.log(err.message);
})
next();
}); });
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
}, },
created() { created() {
this.updateCp(); this.updateCp();
console.log(this.$route.query.referer)
}, },
computed: {}, computed: {},
methods: { methods: {
...@@ -139,7 +140,12 @@ ...@@ -139,7 +140,12 @@
let res = data.data; let res = data.data;
if (res.err_code === 0) { if (res.err_code === 0) {
Util.setCookie("token", res.data.api_token, 1); Util.setCookie("token", res.data.api_token, 1);
window.location.href = '/';
if(this.$route.query.referer){
window.location.href="/#"+this.$route.query.referer
}else{
window.location.href = '/';
}
} else { } else {
Message(res.err_msg); Message(res.err_msg);
this.updateCp(); this.updateCp();
......
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 sign in to comment