Commit 63159031 authored by 邓晓峰's avatar 邓晓峰

fix: 修复登陆信息错乱

parent dea88155
Pipeline #40697 passed with stages
in 4 minutes 17 seconds
...@@ -2,7 +2,7 @@ import { fromJS } from 'immutable'; ...@@ -2,7 +2,7 @@ import { fromJS } from 'immutable';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import AppConfig from 'kit_global_config'; import AppConfig from 'kit_global_config';
import { Storeage as Store } from 'kit_utils'; import { Storeage as Store } from 'kit_utils';
import { store } from 'microser-data'; import { store, event } from 'microser-data';
import { Storage } from '@wisdom-utils/utils'; import { Storage } from '@wisdom-utils/utils';
import pkg from '../../../../package.json'; import pkg from '../../../../package.json';
import defaultSetting from '../../../../config/defaultSetting'; import defaultSetting from '../../../../config/defaultSetting';
...@@ -139,6 +139,7 @@ const appReducer = (state = initialState, action) => { ...@@ -139,6 +139,7 @@ const appReducer = (state = initialState, action) => {
Cookies.set('city', Cookies.get('city') || window.globalConfig.client); Cookies.set('city', Cookies.get('city') || window.globalConfig.client);
window.globalConfig = config;
return state.merge({ return state.merge({
globalConfig: config, globalConfig: config,
menu: generMenu || [], menu: generMenu || [],
...@@ -229,6 +230,7 @@ const appReducer = (state = initialState, action) => { ...@@ -229,6 +230,7 @@ const appReducer = (state = initialState, action) => {
microMounted: action.data, microMounted: action.data,
}); });
case LOGINOUT: case LOGINOUT:
event.emit('event: application-logout', action.data);
return state.merge({ return state.merge({
complexConfig: action.data.complexConfig, complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex, currentMenuIndex: action.data.currentMenuIndex,
......
...@@ -11,7 +11,7 @@ export const initGlobalConfig = (loader, store, render) => { ...@@ -11,7 +11,7 @@ export const initGlobalConfig = (loader, store, render) => {
// eslint-disable-next-line no-debugger // eslint-disable-next-line no-debugger
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
createStoreage.remove(`__PANDA_STORE__${location.hostname}`); createStoreage.remove(`__PANDA_STORE__${location.hostname}`);
window.globalConfig = {};
let config = createStoreage.get('globalConfig') || {}; let config = createStoreage.get('globalConfig') || {};
store.dispatch(actionCreators.updateComplexConfig({})); store.dispatch(actionCreators.updateComplexConfig({}));
if (!getToken() || config.token == null) { if (!getToken() || config.token == null) {
...@@ -74,6 +74,7 @@ export const initGlobalConfig = (loader, store, render) => { ...@@ -74,6 +74,7 @@ export const initGlobalConfig = (loader, store, render) => {
Object.assign({}, data, { Object.assign({}, data, {
token: '', token: '',
access_token: '', access_token: '',
userInfo: null
}), }),
), ),
); );
......
...@@ -426,7 +426,7 @@ const BasicLayout = props => { ...@@ -426,7 +426,7 @@ const BasicLayout = props => {
} }
const handleUpdateCurrentIndex = index => { const handleUpdateCurrentIndex = index => {
debugger
setSelectIndex(-1) setSelectIndex(-1)
props.updateCurrentIndex(index); props.updateCurrentIndex(index);
window.share && window.share.event.emit('trigger:updateMenuIndex', index); window.share && window.share.event.emit('trigger:updateMenuIndex', index);
......
...@@ -34,7 +34,6 @@ const MICRO_STATUS = { ...@@ -34,7 +34,6 @@ const MICRO_STATUS = {
export const initMicroApps = (loader, store) => { export const initMicroApps = (loader, store) => {
/* eslint-disable */ /* eslint-disable */
const config = createStoreage.get('globalConfig'); const config = createStoreage.get('globalConfig');
const application = config && config.products || []; const application = config && config.products || [];
let products = []; let products = [];
...@@ -54,7 +53,7 @@ export const initMicroApps = (loader, store) => { ...@@ -54,7 +53,7 @@ export const initMicroApps = (loader, store) => {
process.env.NODE_ENV !== 'production' ? process.env.NODE_ENV !== 'production' ?
micorConfig.dev : micorConfig.dev :
products; products;
console.log("reateStoreage.get('globalConfig')", createStoreage.get('globalConfig'))
registerMicroApps( registerMicroApps(
entrys.map(item => { entrys.map(item => {
item.loader = loader; item.loader = loader;
......
...@@ -227,7 +227,7 @@ class Login { ...@@ -227,7 +227,7 @@ class Login {
if(self.globalConfig.hasOwnProperty('webConfig')) { if(self.globalConfig.hasOwnProperty('webConfig')) {
self.globalConfig = { self.globalConfig = {
...self.globalConfig, // ...self.globalConfig,
...self.globalConfig.webConfig.basicConfig, ...self.globalConfig.webConfig.basicConfig,
...self.globalConfig.webConfig.optionalConfig ...self.globalConfig.webConfig.optionalConfig
} }
...@@ -690,6 +690,7 @@ class Login { ...@@ -690,6 +690,7 @@ class Login {
/* eslint-disable */ /* eslint-disable */
let _industrySite = null; let _industrySite = null;
if (industry) { if (industry) {
const userInfo = const userInfo =
self.globalConfig.userInfo && self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups && self.globalConfig.userInfo.Groups &&
...@@ -741,7 +742,7 @@ class Login { ...@@ -741,7 +742,7 @@ class Login {
self.globalConfig.userInfo = Object.assign( self.globalConfig.userInfo = Object.assign(
{}, {},
response, response,
self.globalConfig.userInfo, // self.globalConfig.userInfo,
); );
if(response.hasOwnProperty('data')) { if(response.hasOwnProperty('data')) {
self.globalConfig.userInfo = { self.globalConfig.userInfo = {
......
...@@ -6,4 +6,9 @@ store.on('event:route', (url) => { ...@@ -6,4 +6,9 @@ store.on('event:route', (url) => {
window.share && window.share.event && window.share.event.on('event:logs', params => { window.share && window.share.event && window.share.event.on('event:logs', params => {
delete params.site; delete params.site;
appService.pvLogs(params); appService.pvLogs(params);
}) });
// store.on('event:logout', () => {
// window.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