From 228c57399a4ca2ac7c95f3a2f277cf224172b3cd Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sat, 1 Jul 2023 22:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=BC=80=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E9=A1=B5=E9=9C=80=E8=A6=81=E7=99=BB=E9=99=86=E7=9A=84?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_src/config/index.js | 4 ++-- web_src/src/App.vue | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/web_src/config/index.js b/web_src/config/index.js index a7b68469..b1e1cbe1 100644 --- a/web_src/config/index.js +++ b/web_src/config/index.js @@ -12,14 +12,14 @@ module.exports = { assetsPublicPath: '/', proxyTable: { '/debug': { - target: 'http://localhost:18978', + target: 'http://localhost:18080', changeOrigin: true, pathRewrite: { '^/debug': '/' } }, '/static/snap': { - target: 'http://localhost:18978', + target: 'http://localhost:18080', changeOrigin: true, // pathRewrite: { // '^/static/snap': '/static/snap' diff --git a/web_src/src/App.vue b/web_src/src/App.vue index e7d45b75..103cbe1a 100644 --- a/web_src/src/App.vue +++ b/web_src/src/App.vue @@ -11,6 +11,7 @@ export default { data(){ return { isLogin: false, + excludeLoginCheck: ["/play/wasm", "/play/rtc"], userInfo: { //保存用户信息 nick: null, ulevel: null, @@ -21,27 +22,29 @@ export default { }, created() { if (userService.getToken() == null){ + console.log(22222) + console.log(this.$route.path) + try { + if (this.excludeLoginCheck && this.excludeLoginCheck.length > 0) { + for (let i = 0; i < this.excludeLoginCheck.length; i++) { + if (this.$route.path.startsWith(this.excludeLoginCheck[i])){ + return; + } + } + } + }catch (e) { + console.error(e) + } //如果没有登录状态则跳转到登录页 this.$router.push('/login'); } }, - //监听路由检查登录 - watch:{ - "$route" : 'checkLogin' - }, + mounted(){ //组件开始挂载时获取用户信息 // this.getUserInfo(); }, methods: { - checkLogin(){ - //检查是否存在session - if (userService.getToken() == null){ - //如果没有登录状态则跳转到登录页 - // this.$router.push('/login'); - } - - }, }, components: {} };