Commit 228c57399a4ca2ac7c95f3a2f277cf224172b3cd

Authored by 648540858
1 parent b64f3208

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

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