Commit feecce34 authored by 杨思琦's avatar 杨思琦

fix: 修复client

parent df7457e1
Pipeline #64571 passed with stages
......@@ -98,25 +98,30 @@ class Login {
site: this.getLocalSiteBytoken(token),
'request.preventCache': Date.now(),
ignoreSite: true,
}).then(response => {
if (response && response.code === 0) {
self.globalConfig.userInfo = window?.globalConfig?.transformUserInfo?.(response.data) ?? {};
self.updateConfig && self.updateConfig(self.globalConfig);
self.getUserInfoAndConfig();
} else {
self.logout && self.logout();
if (params.getParams('token')) {
// token免登录失败,回到登录页,防止reload造成死循环
window.location.href = `${window.location.origin}`;
return false;
}
if (self.globalConfig.style === 'ios' && self.globalConfig.loginTemplate === 'IOSCloud.html') {
window.location.href = `${window.location.origin}`;
return false;
})
.then(response => {
if (response && response.code === 0) {
self.globalConfig.userInfo = window?.globalConfig?.transformUserInfo?.(response.data) ?? {};
self.updateConfig && self.updateConfig(self.globalConfig);
self.getUserInfoAndConfig();
} else {
self.logout && self.logout();
if (params.getParams('token')) {
// token免登录失败,回到登录页,防止reload造成死循环
window.location.href = `${window.location.origin}`;
return false;
}
if (self.globalConfig.style === 'ios' && self.globalConfig.loginTemplate === 'IOSCloud.html') {
window.location.href = `${window.location.origin}`;
return false;
}
window.location.reload();
}
window.location.reload();
}
});
})
.catch(error => {
this.handleLoginError();
Logger.log('获取用户配置失败');
});
}
writeLogs() {
......@@ -182,7 +187,6 @@ class Login {
getWebConfig(token, getIndustry) {
const self = this;
// eslint-disable-next-line no-undef
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
Promise.all([
noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }),
......@@ -701,11 +705,16 @@ class Login {
self.updateConfig && self.updateConfig(self.globalConfig);
} catch (error) {
console.log(error);
message.error('登录失败');
if (self.goLogin()) {
return false;
}
// self.handleLoginError(failCallback);
}
})
.catch(error => {
this.handleLoginError();
Logger.log('获取用户配置失败');
});
} else {
self.handleLoginError();
......
......@@ -60,7 +60,9 @@ export const AppInitState = () => {
};
const client = getClient();
if (sessionStorage.getItem('client') && sessionStorage.getItem('client') !== client) {
sessionStorage.setItem('client', client);
}
let config = window.globalConfig || {};
// eslint-disable-next-line no-undef, no-restricted-globals
createStoreage.remove(`__PANDA_STORE__${location.hostname}`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment