|
@@ -18,11 +18,12 @@ function checkHasUserInfo() {
|
|
|
if (minute < 20) {
|
|
|
refreshTokenPage().then(() => {
|
|
|
clearTimeout(timer);
|
|
|
- checkHasUserInfo(1000);
|
|
|
+ checkHasUserInfo(600000);
|
|
|
});
|
|
|
- console.log("minute==", minute)
|
|
|
+ } else {
|
|
|
+ clearTimeout(timer);
|
|
|
+ checkHasUserInfo(600000);
|
|
|
}
|
|
|
- // console.log("minute==", minute)
|
|
|
} else {
|
|
|
clearTimeout(timer);
|
|
|
checkHasUserInfo(600000);
|
|
@@ -34,6 +35,7 @@ function checkHasUserInfo() {
|
|
|
|
|
|
// 登录
|
|
|
function wxLogin(type) {
|
|
|
+ console.log("执行了登录")
|
|
|
// type=1 如果type未激活和作废不需要跳转到登录页面
|
|
|
return new Promise((resolve, reject) => {
|
|
|
wx.login({
|
|
@@ -63,7 +65,7 @@ function wxLogin(type) {
|
|
|
// store.commit('setProjectId', data.tokenUser.projectId);
|
|
|
} else {
|
|
|
if (!type) {
|
|
|
- wx.redirectTo({ url: '/pages/index' });
|
|
|
+ refreshLogin()
|
|
|
}
|
|
|
store.commit('setUserInfo', {});
|
|
|
}
|
|
@@ -136,6 +138,7 @@ function refreshTokenPage() {
|
|
|
refreshTokenExpireTime: data.refreshTokenExpireTime,
|
|
|
refreshToken: data.refreshToken
|
|
|
};
|
|
|
+ console.log(data);
|
|
|
store.commit('setToken', data.token);
|
|
|
store.commit('setActivated', data.isActivated);
|
|
|
store.commit('setTokenInfo', tokenInfo);
|
|
@@ -144,7 +147,8 @@ function refreshTokenPage() {
|
|
|
resolve(data)
|
|
|
} else {
|
|
|
store.commit('clearToken', '');
|
|
|
- refreshHome()
|
|
|
+ // 去登录页面
|
|
|
+ refreshLogin()
|
|
|
resolve(data)
|
|
|
}
|
|
|
} else {
|
|
@@ -165,6 +169,10 @@ function refreshHome() {
|
|
|
// wx.redirectTo({ url: '/pages/index' });
|
|
|
wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
|
|
|
}
|
|
|
+function refreshLogin() {
|
|
|
+ wx.redirectTo({ url: '/pages/index' });
|
|
|
+ // wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
|
|
|
+}
|
|
|
// 检查用户是否有空间控制权限
|
|
|
function checkUserControl() {
|
|
|
return new Promise((resolve, reject) => {
|
|
@@ -214,6 +222,7 @@ function checkLoginNew() {
|
|
|
let token = store.state.user.token;
|
|
|
let storeTokenInfo = store.state.user.tokenInfo
|
|
|
let refreshToken = storeTokenInfo && storeTokenInfo.refreshToken ? storeTokenInfo.refreshToken : '';
|
|
|
+ console.log("执行checkLoginNew--", token, refreshToken);
|
|
|
console.log("执行checkLoginNew--");
|
|
|
if (!token || !refreshToken) {
|
|
|
wxLogin().then((res) => {
|
|
@@ -235,7 +244,7 @@ function checkLoginNew() {
|
|
|
resolve(res)
|
|
|
}).catch((error) => {
|
|
|
reject("登录失败!");
|
|
|
- });;
|
|
|
+ });
|
|
|
} else if (flag == 3) { // 未过期
|
|
|
resolve({
|
|
|
isActivated: store.state.user.isActivated
|