|
|
@@ -3,9 +3,14 @@ import { platform, PLATFORM_TYPE, AccessCode } from '@/utils/access'; |
|
|
|
import { firstCharToLowerCase } from '@/utils/tool'; |
|
|
|
import system from '@/services/system'; |
|
|
|
|
|
|
|
const initialState = () => ({ |
|
|
|
isLogin: false, |
|
|
|
const systemInitState = () => ({ |
|
|
|
gatewayState: false, |
|
|
|
isMaxWindowSize: false, |
|
|
|
client: system.isClient ? '桌面端' : 'WEB端', |
|
|
|
}); |
|
|
|
|
|
|
|
const loginInitState = () => ({ |
|
|
|
isLogin: false, |
|
|
|
accountId: undefined, |
|
|
|
accountName: undefined, |
|
|
|
userName: undefined, |
|
|
@@ -14,12 +19,10 @@ const initialState = () => ({ |
|
|
|
currentCompanyId: undefined, |
|
|
|
avator: undefined, |
|
|
|
userInfo: {}, |
|
|
|
isMaxWindowSize: false, |
|
|
|
client: system.isClient ? '桌面端' : 'WEB端', |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
const getBootstrapState = () => { |
|
|
|
let state = initialState(); |
|
|
|
let state = Object.assign(systemInitState(), loginInitState()); |
|
|
|
try { |
|
|
|
const sessionState = JSON.parse(sessionStorage.getItem('user')); |
|
|
|
const currentCompanyId = sessionStorage.getItem('companyId'); |
|
|
@@ -33,7 +36,7 @@ const getBootstrapState = () => { |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.log('加载session数据失败'); |
|
|
|
state = initialState(); |
|
|
|
state = Object.assign(systemInitState(), loginInitState()); |
|
|
|
} |
|
|
|
return state; |
|
|
|
}; |
|
|
@@ -153,7 +156,7 @@ export default { |
|
|
|
Source: sessionStorage.client, |
|
|
|
}; |
|
|
|
fetchApi('operation/record', params); |
|
|
|
this.state = initialState(); |
|
|
|
this.state = Object.assign(this.state, loginInitState()); |
|
|
|
fetchApi('authentication/loginOut'); |
|
|
|
sessionStorage.clear(); |
|
|
|
}, |
|
|
|