Commit 9c703d65 authored by 杨思琦's avatar 杨思琦

fix: 网关配置修改

parent dda89aaa
Pipeline #82301 waiting for manual action with stages
......@@ -115,9 +115,9 @@
"@wisdom-map/arcgismap": "1.4.0-220",
"@wisdom-map/basemap": "1.1.0-32",
"@wisdom-map/util": "^1.0.28-0",
"@wisdom-utils/components": "0.1.340",
"@wisdom-utils/components": "0.1.341",
"@wisdom-utils/runtime": "0.0.48",
"@wisdom-utils/utils": "0.1.380",
"@wisdom-utils/utils": "0.1.381",
"animate.css": "^4.1.1",
"antd": "4.21.2",
"long": "^5.2.3",
......
......@@ -246,6 +246,7 @@ export function logout(data) {
window[products[item]].unmount({ store });
});
}
if (window.refreshCurrentToken) clearInterval(window.refreshCurrentToken);
store.set('event:dropCache');
return {
type: LOGINOUT,
......
......@@ -266,6 +266,24 @@ class Login {
this.initGateWay(token, getIndustry);
}
refreshToken(self, token, time) {
if (window.refreshCurrentToken) clearInterval(window.refreshCurrentToken);
window.refreshCurrentToken = setInterval(() => {
appService
.authorizationToken({
loginName: token,
type: 'token',
})
.then(tokenRes => {
if (tokenRes.code === 0) {
self.globalConfig.access_token = tokenRes.data?.access_token ?? '';
localStorage.setItem('access_token', self.globalConfig.access_token);
}
self.updateConfig(self.globalConfig);
});
}, time);
}
initGateWay(token, getIndustry) {
const self = this;
const gateWayParam = {
......@@ -288,6 +306,13 @@ class Login {
if (tokenRes.code === 0) {
self.globalConfig.access_token = tokenRes.data?.access_token ?? '';
localStorage.setItem('access_token', self.globalConfig.access_token);
if (self.globalConfig.security === '1') {
const time =
typeof tokenRes.data?.expires_in === 'number' && tokenRes.data?.expires_in / 2 > 0
? tokenRes.data?.expires_in / 2
: 43200000;
self.refreshToken(self, token, time);
}
}
self.updateConfig(self.globalConfig);
})
......
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