Commit 228c57399a4ca2ac7c95f3a2f277cf224172b3cd

Authored by 648540858
1 parent b64f3208

修复打开分享页需要登陆的BUG

web_src/config/index.js
@@ -12,14 +12,14 @@ module.exports = { @@ -12,14 +12,14 @@ module.exports = {
12 assetsPublicPath: '/', 12 assetsPublicPath: '/',
13 proxyTable: { 13 proxyTable: {
14 '/debug': { 14 '/debug': {
15 - target: 'http://localhost:18978', 15 + target: 'http://localhost:18080',
16 changeOrigin: true, 16 changeOrigin: true,
17 pathRewrite: { 17 pathRewrite: {
18 '^/debug': '/' 18 '^/debug': '/'
19 } 19 }
20 }, 20 },
21 '/static/snap': { 21 '/static/snap': {
22 - target: 'http://localhost:18978', 22 + target: 'http://localhost:18080',
23 changeOrigin: true, 23 changeOrigin: true,
24 // pathRewrite: { 24 // pathRewrite: {
25 // '^/static/snap': '/static/snap' 25 // '^/static/snap': '/static/snap'
web_src/src/App.vue
@@ -11,6 +11,7 @@ export default { @@ -11,6 +11,7 @@ export default {
11 data(){ 11 data(){
12 return { 12 return {
13 isLogin: false, 13 isLogin: false,
  14 + excludeLoginCheck: ["/play/wasm", "/play/rtc"],
14 userInfo: { //保存用户信息 15 userInfo: { //保存用户信息
15 nick: null, 16 nick: null,
16 ulevel: null, 17 ulevel: null,
@@ -21,27 +22,29 @@ export default { @@ -21,27 +22,29 @@ export default {
21 }, 22 },
22 created() { 23 created() {
23 if (userService.getToken() == null){ 24 if (userService.getToken() == null){
  25 + console.log(22222)
  26 + console.log(this.$route.path)
  27 + try {
  28 + if (this.excludeLoginCheck && this.excludeLoginCheck.length > 0) {
  29 + for (let i = 0; i < this.excludeLoginCheck.length; i++) {
  30 + if (this.$route.path.startsWith(this.excludeLoginCheck[i])){
  31 + return;
  32 + }
  33 + }
  34 + }
  35 + }catch (e) {
  36 + console.error(e)
  37 + }
24 //如果没有登录状态则跳转到登录页 38 //如果没有登录状态则跳转到登录页
25 this.$router.push('/login'); 39 this.$router.push('/login');
26 } 40 }
27 }, 41 },
28 - //监听路由检查登录  
29 - watch:{  
30 - "$route" : 'checkLogin'  
31 - }, 42 +
32 mounted(){ 43 mounted(){
33 //组件开始挂载时获取用户信息 44 //组件开始挂载时获取用户信息
34 // this.getUserInfo(); 45 // this.getUserInfo();
35 }, 46 },
36 methods: { 47 methods: {
37 - checkLogin(){  
38 - //检查是否存在session  
39 - if (userService.getToken() == null){  
40 - //如果没有登录状态则跳转到登录页  
41 - // this.$router.push('/login');  
42 - }  
43 -  
44 - },  
45 }, 48 },
46 components: {} 49 components: {}
47 }; 50 };