diff --git a/.env.development b/.env.development index 1e6ede547..dfe40e96d 100644 --- a/.env.development +++ b/.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://119.167.67.163:10081/api +VUE_APP_API_SERVER = http://192.168.1.140/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 diff --git a/.gitignore b/.gitignore index db2dec0ea..4a81ca5c7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ node_modules* dist epmet-oper epmet-work-pc +epmet-work-cy package-lock.json .idea/ report.20240923.092213.21116.0.001.json diff --git a/src/router/index.js b/src/router/index.js index 2ba7a2746..a3c53ae43 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -979,28 +979,28 @@ const router = new Router({ }); router.beforeEach((to, from, next) => { - if (to.name == 'login') { - // 新增 token 存在性检查 - const match = location.href.match(/[?&]ticket=([^&#]+)/); - const existingToken = localStorage.getItem('token'); - if (!existingToken && match) { - http.get(`/auth/xiaZhuangLogin/dealUserInfo?ticket=${match[1]}`) - .then(({ data: res }) => { - localStorage.setItem('token', res.data.token) - next({ name: 'home' }) - }).catch(err=>{ - localStorage.removeItem('token') - alert('登录失败,请重新登录') - // window.location.href = 'http://172.16.100.23:40281/login?client_id=0587341d116149adaa36ca1d45dd16af&redirect=http://119.167.67.163:10081/epmet-work-pc/#/login' - }) - return; - }else if(existingToken){ - next({ name: 'home' }) - }else{ - window.location.href = 'http://172.16.100.23:40281/login?client_id=0587341d116149adaa36ca1d45dd16af&redirect=http://119.167.67.163:10081/epmet-work-pc/#/login' - } - return; - } + // if (to.name == 'login') { + // // 新增 token 存在性检查 + // const match = location.href.match(/[?&]ticket=([^&#]+)/); + // const existingToken = localStorage.getItem('token'); + // if (!existingToken && match) { + // http.get(`/auth/xiaZhuangLogin/dealUserInfo?ticket=${match[1]}`) + // .then(({ data: res }) => { + // localStorage.setItem('token', res.data.token) + // next({ name: 'home' }) + // }).catch(err=>{ + // localStorage.removeItem('token') + // alert('登录失败,请重新登录') + // // window.location.href = 'http://172.16.100.23:40281/login?client_id=0587341d116149adaa36ca1d45dd16af&redirect=http://119.167.67.163:10081/epmet-work-pc/#/login' + // }) + // return; + // }else if(existingToken){ + // next({ name: 'home' }) + // }else{ + // window.location.href = 'http://172.16.100.23:40281/login?client_id=0587341d116149adaa36ca1d45dd16af&redirect=http://119.167.67.163:10081/epmet-work-pc/#/login' + // } + // return; + // } if (to.name === "caiji") { return next(); diff --git a/src/views/main-navbar.vue b/src/views/main-navbar.vue index fe1d2d9bb..d5024fb77 100644 --- a/src/views/main-navbar.vue +++ b/src/views/main-navbar.vue @@ -198,14 +198,15 @@ export default { this.$http .post('/auth/login/logout') .then(({ data: res }) => { - clearLoginInfo(); - if (res.code === 0) { + if (res.code !== 0) { //别处登陆时 退出不提示 直接跳登陆页即可 if (res.code !== 10007) { this.$message.error(res.msg); } - location.href = `http://172.16.100.23:40281/sso-logout?client_id=0587341d116149adaa36ca1d45dd16af` } + + clearLoginInfo(); + this.$router.replace({ name: 'login' }); // if (localStorage.getItem('userType') === 'work') { // this.$router.push({ name: 'loginWork' }) // } else { diff --git a/vue.config.js b/vue.config.js index 0332f2e3c..a3e336076 100644 --- a/vue.config.js +++ b/vue.config.js @@ -5,7 +5,7 @@ const IS_PROD = ["production", "test"].includes(process.env.NODE_ENV); const TerserPlugin = require("terser-webpack-plugin"); module.exports = { - baseUrl: process.env.NODE_ENV === "production" ? "" : "/epmet-work-pc", + baseUrl: process.env.NODE_ENV === "production" ? "" : "/epmet-work-cy", css: { // 是否使用css分离插件 ExtractTextPlugin extract: IS_PROD, @@ -25,7 +25,7 @@ module.exports = { .loader("svg-sprite-loader"); }, productionSourceMap: false, - outputDir: "epmet-work-pc", + outputDir: "epmet-work-cy", assetsDir: "static", devServer: { proxy: { @@ -36,7 +36,6 @@ module.exports = { }, "/api": { // target: " https://epmet-test.elinkservice.cn/", - target: "http://219.146.91.110:30801", // 测试地址 // target: "http://192.168.1.60:8080", // 本地地址 // target: "https://epmet-preview.elinkservice.cn", // 演示地址