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

fix: 修复client

parent df7457e1
Pipeline #64571 passed with stages
...@@ -98,7 +98,8 @@ class Login { ...@@ -98,7 +98,8 @@ class Login {
site: this.getLocalSiteBytoken(token), site: this.getLocalSiteBytoken(token),
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
ignoreSite: true, ignoreSite: true,
}).then(response => { })
.then(response => {
if (response && response.code === 0) { if (response && response.code === 0) {
self.globalConfig.userInfo = window?.globalConfig?.transformUserInfo?.(response.data) ?? {}; self.globalConfig.userInfo = window?.globalConfig?.transformUserInfo?.(response.data) ?? {};
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
...@@ -116,6 +117,10 @@ class Login { ...@@ -116,6 +117,10 @@ class Login {
} }
window.location.reload(); window.location.reload();
} }
})
.catch(error => {
this.handleLoginError();
Logger.log('获取用户配置失败');
}); });
} }
...@@ -182,7 +187,6 @@ class Login { ...@@ -182,7 +187,6 @@ class Login {
getWebConfig(token, getIndustry) { getWebConfig(token, getIndustry) {
const self = this; const self = this;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用 // 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
Promise.all([ Promise.all([
noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }), noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }),
...@@ -701,11 +705,16 @@ class Login { ...@@ -701,11 +705,16 @@ class Login {
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
message.error('登录失败');
if (self.goLogin()) { if (self.goLogin()) {
return false; return false;
} }
// self.handleLoginError(failCallback); // self.handleLoginError(failCallback);
} }
})
.catch(error => {
this.handleLoginError();
Logger.log('获取用户配置失败');
}); });
} else { } else {
self.handleLoginError(); self.handleLoginError();
......
...@@ -60,7 +60,9 @@ export const AppInitState = () => { ...@@ -60,7 +60,9 @@ export const AppInitState = () => {
}; };
const client = getClient(); const client = getClient();
if (sessionStorage.getItem('client') && sessionStorage.getItem('client') !== client) {
sessionStorage.setItem('client', client);
}
let config = window.globalConfig || {}; let config = window.globalConfig || {};
// eslint-disable-next-line no-undef, no-restricted-globals // eslint-disable-next-line no-undef, no-restricted-globals
createStoreage.remove(`__PANDA_STORE__${location.hostname}`); 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