Browse Source

免登退出后返回到星图的页面

chengyang
mk 7 months ago
parent
commit
c90d5b3b84
  1. 2
      .env.development
  2. 5
      src/js/dai/request.js
  3. 4
      src/js/dai/request2.js
  4. 1
      src/router/index.js
  5. 5
      src/utils/request.js
  6. 9
      src/views/main-navbar.vue

2
.env.development

@ -3,7 +3,7 @@ NODE_ENV=development
# VUE_APP_API_SERVER = http://192.168.1.60:8080/api
# # VUE_APP_API_SERVER = http://192.168.1.140/api
# VUE_APP_API_SERVER = http://219.146.91.110:30801/api
VUE_APP_API_SERVER = http://192.168.1.140/api
VUE_APP_API_SERVER = http://119.167.67.163:10081/api
VUE_APP_API_LIVE = http://192.168.1.140/live/
# VUE_APP_API_SERVER = http://219.146.91.110:30801/api219.146.91.110:30801
# VUE_APP_API_SERVER = https://epmet-yantai.elinkservice.cn/api

5
src/js/dai/request.js

@ -55,6 +55,11 @@ const request = curry(
})
// Message.error(res.data.msg);
clearLoginInfo();
if(localStorage.getItem('ticket')){
localStorage.removeItem('ticket')
location.href = 'http://119.167.67.163:18182'
}
return next({
name: "login",
});

4
src/js/dai/request2.js

@ -55,6 +55,10 @@ const request = curry(
type: 'error',
duration: 2 * 1000
})
if(localStorage.getItem('ticket')){
localStorage.removeItem('ticket')
location.href = 'http://119.167.67.163:18182'
}
clearLoginInfo();
return next({
name: "login",

1
src/router/index.js

@ -998,6 +998,7 @@ router.beforeEach((to, from, next) => {
return null;
}
const match = location.href.match(/[?&]ticket=([^&#]+)/);
localStorage.setItem('ticket',match[1])
if (match && to.name =='login') {
http.get(`/auth/xiaZhuangLogin/dealUserInfo?ticket=${match[1]}`)
.then(({data: res}) => {

5
src/utils/request.js

@ -80,7 +80,12 @@ http.interceptors.response.use(response => {
// }else {
// router.replace({ name: 'login' })
// }
if(localStorage.getItem('ticket')){
localStorage.removeItem('ticket')
location.href = 'http://119.167.67.163:18182'
}else{
router.replace({ name: 'login' })
}
return Promise.reject(response.data.msg)
}

9
src/views/main-navbar.vue

@ -198,17 +198,20 @@ export default {
this.$http
.post('/auth/login/logout')
.then(({ data: res }) => {
clearLoginInfo();
if(localStorage.getItem('ticket')){
localStorage.removeItem('ticket')
location.href = 'http://119.167.67.163:18182'
}else{
if (res.code !== 0) {
// 退
if (res.code !== 10007) {
this.$message.error(res.msg);
}
}
clearLoginInfo();
// this.$router.push({ name: 'login' });
console.log(`${location.origin}/epmet-work-pc/#/login`);
location.href = `${location.origin}/epmet-work-pc/#/login`
}
// if (localStorage.getItem('userType') === 'work') {
// this.$router.push({ name: 'loginWork' })
// } else {

Loading…
Cancel
Save