This commit is contained in:
iizmg
2020-04-30 15:08:37 +08:00
parent 748a26f06d
commit 31e5a3013d
2 changed files with 5 additions and 12 deletions
+4 -2
View File
@@ -123,6 +123,10 @@
//初始化
this.init();
},
mounted() {
//检查登陆
glob.checkLogin();
},
methods: {
//初始化
init() {
@@ -137,8 +141,6 @@
window.addEventListener('resize', this.resizeListener);
//主动调用一次resize监听
this.resizeListener();
//检查登陆
glob.checkLogin();
},
//重设主题属性
resetTheme() {
+1 -10
View File
@@ -9,21 +9,12 @@ const glob = {
//初始化Axios
this.intiAxios();
},
//读取cookies
getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr === document.cookie.match(reg)) {
return unescape(arr[2]);
} else {
return null;
}
},
//返回token
getToken() {
//token名称
const TOKEN_NAME = 'token';
//返回TOKEN
return this.getCookie(this.TOKEN_NAME);
return $cookies.get(this.TOKEN_NAME);
},
//检查是否登陆
checkLogin() {