Commit d06e4b62 authored by 徐乐's avatar 徐乐

feat: 修改

parent 00db07f4
......@@ -42,9 +42,7 @@ const proxy = require('../../../../config/proxy');
const keywordStorage = new Storage(`__global_search_keywords__micro_${window.location.hostname}`);
const recentVisitedStorage = new Storage(`__global_recent_visited__micro_${window.location.hostname}`);
const recentProductStorage = new Storage(`__global__recent_product__micro_${window.location.hostname}`);
const currentProduct = `__global__recent_productIndex__micro_${window.location.hostname}_${params.getParams('client') ||
sessionStorage.getItem('client') ||
'city'}`;
const currentProduct = `__global__recent_productIndex__micro_${window.location.hostname}_${sessionStorage.getItem('client') || params.getParams('client') || 'city'}`;
sessionStorage.setItem(currentProduct, 0);
Cookies.set('loginMode', Cookies.get('loginMode') || 'pdw');
export const initialState = fromJS({
......@@ -102,27 +100,27 @@ const appReducer = (state = initialState, action) => {
const { homepage } = window.globalConfig;
const modulePkg = {};
window.globalConfig && window.globalConfig.products && Array.isArray(window.globalConfig.products) && window.globalConfig.products.map(item => {
modulePkg[item.PackageName] = item;
modulePkg[item.PackageName] = item;
});
config.widgets =transformWidgets(config.widgets);
config.widgets = transformWidgets(config.widgets);
// const pickMenus = memoized(() => )
const generMenu = generMainRoutes(config.widgets || [], null, 0, modulePkg);
let flatMenu = [];
if (generMenu) {
const flat = state.toJS();
const data =_.uniqBy(generFlatRoutes(generMenu || [], null, null, modulePkg), 'path');
if(_.isEqualWith(flat.flatMenu, data, (value, other) => {
if(value.path === other.path) {
const data = _.uniqBy(generFlatRoutes(generMenu || [], null, null, modulePkg), 'path');
if (_.isEqualWith(flat.flatMenu, data, (value, other) => {
if (value.path === other.path) {
return true
}
})) {
flatMenu = data
flatMenu = data
} else {
flatMenu = flat.flatMenu
}
const index = flatMenu.findIndex(item => item.name === '首页');
if(index === -1) {
if (index === -1) {
flatMenu.push({
path: `/${homepage}`,
href: `/${homepage}`,
......@@ -141,7 +139,7 @@ const appReducer = (state = initialState, action) => {
return currentPath === decodeURI(homepage);
});
let currentMenuIndex = 0;
if (home) {
......@@ -204,9 +202,10 @@ const appReducer = (state = initialState, action) => {
recentVisited: [],
});
case GET_CURRENT_INDEX:
sessionStorage.setItem(currentProduct, action.data)
const currentProductNew = `__global__recent_productIndex__micro_${window.location.hostname}_${sessionStorage.getItem('client') || window.globalConfig?.client || 'city'}`;
sessionStorage.setItem(currentProductNew, action.data)
return state.merge({
currentMenuIndex: Number(sessionStorage.getItem(currentProduct)),
currentMenuIndex: Number(sessionStorage.getItem(currentProductNew)),
});
case SLIDER_MENU_MODE:
return state.merge({
......
......@@ -514,6 +514,16 @@ const Layout = props => {
}
} else {
let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
Cookies.set('client', cli, {
expires: 86400000 / (24 * 60 * 60 * 1000),
path: '/',
});
sessionStorage.setItem('client', cli);
const currentProduct = `__global__recent_productIndex__micro_${window.location.hostname}_${window.globalConfig?.client ?? 'city'}`;
sessionStorage.removeItem(currentProduct);
const currentProductNew = `__global__recent_productIndex__micro_${window.location.hostname}_${cli || 'city'}`;
sessionStorage.setItem(currentProductNew, 0);
setIntegrationLoading(true);
const config = props.global;
config.uiwidgets = [];
......@@ -523,7 +533,7 @@ const Layout = props => {
config.client = cli;
}
props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, val.type, cli);
loginAction && loginAction.getUserInfoAndConfig('', true, val.type);
// props.history.push(`/?client=${cli}`);
// props.updateCurrentIndex(0);
// defaultApp();
......
......@@ -8,6 +8,7 @@ import { useDocumentTitle } from '@ant-design/pro-utils';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
import { actionCreators } from '@/containers/App/store';
import LoginAction from '@/pages/user/login/login';
import Cookies from 'js-cookie';
import { defaultApp } from '@/micro';
import { appService } from '@/api';
import { SERVICE_INTERFACE_SUCCESS_CODE } from '@/constants';
......@@ -24,6 +25,7 @@ const Integration = props => {
const [client, setClient] = useState('');
//子站跳转
const handlePage = (item, loginAction) => {
let count = 1;
setPercentBottom(-40 + Math.ceil(Math.random() * 8 * count));
......@@ -61,6 +63,17 @@ const Integration = props => {
}
} else {
let cli = item.url?.indexOf('client=') >= 0 ? item.url.split('client=')[1] : '';
Cookies.set('client', cli, {
expires: 86400000 / (24 * 60 * 60 * 1000),
path: '/',
});
sessionStorage.setItem('client', cli);
const currentProduct = `__global__recent_productIndex__micro_${window.location.hostname}_${window.globalConfig?.client ?? 'city'}`;
sessionStorage.removeItem(currentProduct);
const currentProductNew = `__global__recent_productIndex__micro_${window.location.hostname}_${cli || 'city'}`;
sessionStorage.setItem(currentProductNew, 0);
setClient(cli);
setCurrentType(item.name);
......@@ -72,7 +85,7 @@ const Integration = props => {
config.client = cli
}
// props.instance && props.instance.updateConfig(config);
props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type, cli);
}
};
......
......@@ -930,19 +930,11 @@ class Login {
});
}
getUserInfoAndConfig(failCallback, flag, industry, client) {
getUserInfoAndConfig(failCallback, flag, industry) {
const { token: tk } = this.globalConfig;
const token = tk || Cookies.get('token');
const site = Cookies.get('site');
const self = this;
if (client) {
self.globalConfig.client = client;
Cookies.set('client', client, {
expires: 86400000 / (24 * 60 * 60 * 1000),
path: '/',
});
sessionStorage.setItem('client', client);
}
/* eslint-disable */
let _industrySite = null;
......
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