|
@@ -62,21 +62,21 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|
|
appType: initialState?.selectApp?.appType,
|
|
|
},
|
|
|
request: async (params, defaultMenuData) => {
|
|
|
- let newMenu = defaultMenuData?.map(menu=>{
|
|
|
+ let newMenu = defaultMenuData?.map(menu => {
|
|
|
// 替换图标给微信
|
|
|
- if(initialState?.selectApp?.appType === 1 && menu.icon && menu.icon.includes("-dy")){
|
|
|
+ if (initialState?.selectApp?.appType === 1 && menu.icon && menu.icon.includes("-dy")) {
|
|
|
console.log(menu.icon)
|
|
|
- let icon = menu.icon.replace("-dy",'-wx')
|
|
|
- return {...menu,icon}
|
|
|
+ let icon = menu.icon.replace("-dy", '-wx')
|
|
|
+ return { ...menu, icon }
|
|
|
}
|
|
|
// 替换图标为抖音
|
|
|
- if(initialState?.selectApp?.appType === 2 && menu.icon && menu.icon.includes("-wx")){
|
|
|
- let icon = menu.icon.replace("-wx",'-dy')
|
|
|
- return {...menu,icon}
|
|
|
+ if (initialState?.selectApp?.appType === 2 && menu.icon && menu.icon.includes("-wx")) {
|
|
|
+ let icon = menu.icon.replace("-wx", '-dy')
|
|
|
+ return { ...menu, icon }
|
|
|
}
|
|
|
return menu
|
|
|
})
|
|
|
- console.log("newMenu",newMenu)
|
|
|
+ console.log("newMenu", newMenu)
|
|
|
return newMenu;
|
|
|
},
|
|
|
},
|
|
@@ -93,11 +93,20 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|
|
content: initialState?.currentUser?.name,
|
|
|
},
|
|
|
// footerRender: () => <Footer />,
|
|
|
- onPageChange: () => {
|
|
|
+ onPageChange: (location) => {
|
|
|
hasHandledCode300 = false
|
|
|
- const { location } = history;
|
|
|
+ // const { location } = history;
|
|
|
+ // // 假如在小程序页面,用户回退到分销商页面重置地址禁止回退到分销平台
|
|
|
+ if(sessionStorage.getItem("menuType") == 'miniApp' && location?.pathname?.match(/^\/distributor/)){
|
|
|
+ console.log("miniApp",location)
|
|
|
+ history.replace('/miniApp');
|
|
|
+ }
|
|
|
+ if(sessionStorage.getItem("menuType")=='distributor' && location?.pathname?.match(/^\/miniApp/)){
|
|
|
+ console.log("distributor",location)
|
|
|
+ history.replace('/distributor');
|
|
|
+ }
|
|
|
// 如果没有登录,重定向到 login
|
|
|
- if (!localStorage.getItem("Token") && location.pathname !== loginPath) {
|
|
|
+ if (!localStorage.getItem("Token") && location?.pathname !== loginPath) {
|
|
|
history.push(loginPath);
|
|
|
}
|
|
|
},
|