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

This commit is contained in:
648540858 2023-07-01 22:14:53 +08:00
parent e9c019a28c
commit 780fd24c9c
2 changed files with 17 additions and 14 deletions

View File

@ -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'

View File

@ -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: {}
};