|
@@ -25,6 +25,9 @@ import { ReactComponent as BookDataSvg } from '@/assets/icons/bookData.svg'
|
|
import { ReactComponent as ImageDataSvg } from '@/assets/icons/imageData.svg'
|
|
import { ReactComponent as ImageDataSvg } from '@/assets/icons/imageData.svg'
|
|
import { ReactComponent as RechargeDataSvg } from '@/assets/icons/rechargeData.svg'
|
|
import { ReactComponent as RechargeDataSvg } from '@/assets/icons/rechargeData.svg'
|
|
import { ReactComponent as NovelDataSystemSvg } from '@/assets/icons/novelDataSystem.svg'
|
|
import { ReactComponent as NovelDataSystemSvg } from '@/assets/icons/novelDataSystem.svg'
|
|
|
|
+import { ReactComponent as CorpChatSvg } from '@/assets/icons/corpChat.svg'
|
|
|
|
+import { ReactComponent as WeChatSvg } from '@/assets/icons/weChat.svg'
|
|
|
|
+import { ReactComponent as AdLaunchsSvg } from '@/assets/icons/adLaunchs.svg'
|
|
import { ConfigProvider, Watermark } from 'antd';
|
|
import { ConfigProvider, Watermark } from 'antd';
|
|
const isDev = process.env.NODE_ENV === 'development';
|
|
const isDev = process.env.NODE_ENV === 'development';
|
|
const loginPath = '/user/login';
|
|
const loginPath = '/user/login';
|
|
@@ -189,6 +192,21 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|
...menuSync.map(({ routes, ...item }) => {
|
|
...menuSync.map(({ routes, ...item }) => {
|
|
return { ...item, routes: [{ path: item.path, redirect: routes[0].path }, ...routes] }
|
|
return { ...item, routes: [{ path: item.path, redirect: routes[0].path }, ...routes] }
|
|
}),
|
|
}),
|
|
|
|
+ {
|
|
|
|
+ path: '/mp',
|
|
|
|
+ name: '运营系统',
|
|
|
|
+ icon: <WeChatSvg />
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ path: '/corpChat',
|
|
|
|
+ name: '企微系统',
|
|
|
|
+ icon: <CorpChatSvg />
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ path: '/adLaunch',
|
|
|
|
+ name: '投放系统',
|
|
|
|
+ icon: <AdLaunchsSvg />
|
|
|
|
+ },
|
|
]
|
|
]
|
|
setInitialState(s => ({ ...s, menu: menuData?.data }))
|
|
setInitialState(s => ({ ...s, menu: menuData?.data }))
|
|
return menu;
|
|
return menu;
|
|
@@ -206,13 +224,25 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|
},
|
|
},
|
|
},
|
|
},
|
|
footerRender: () => <Footer />,
|
|
footerRender: () => <Footer />,
|
|
- onPageChange: () => {
|
|
|
|
- const { location } = history;
|
|
|
|
|
|
+ onPageChange: (location) => {
|
|
|
|
+ if (location?.pathname === '/mp') {
|
|
|
|
+ window.open(`https://mp.zanxiangnet.com/#/user/login?token=${localStorage.getItem('Admin-Token')}`, '_blank')
|
|
|
|
+ history.back() // 返回上一页
|
|
|
|
+ return
|
|
|
|
+ } else if (location?.pathname === '/corpChat') {
|
|
|
|
+ window.open(`https://corp.zanxiangnet.com/#/login?token=${localStorage.getItem('Admin-Token')}`, '_blank')
|
|
|
|
+ history.back() // 返回上一页
|
|
|
|
+ return
|
|
|
|
+ } else if (location?.pathname === '/adLaunch') {
|
|
|
|
+ window.open(`https://adq.zanxiangnet.com/#/user/login?token=${localStorage.getItem('Admin-Token')}`, '_blank')
|
|
|
|
+ history.back() // 返回上一页
|
|
|
|
+ return
|
|
|
|
+ }
|
|
// 如果没有登录,重定向到 login
|
|
// 如果没有登录,重定向到 login
|
|
- if (location.pathname !== loginPath && !localStorage.getItem('Admin-Token')) {
|
|
|
|
|
|
+ if (location?.pathname !== loginPath && !localStorage.getItem('Admin-Token')) {
|
|
history.push(loginPath);
|
|
history.push(loginPath);
|
|
}
|
|
}
|
|
- if (initialState?.currentUser && location.pathname !== loginPath) {
|
|
|
|
|
|
+ if (initialState?.currentUser && location?.pathname !== loginPath) {
|
|
let menu = []
|
|
let menu = []
|
|
if (initialState?.menu) {
|
|
if (initialState?.menu) {
|
|
menu = Object.values(initialState?.menu).map((item: unknown) => {
|
|
menu = Object.values(initialState?.menu).map((item: unknown) => {
|
|
@@ -223,7 +253,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|
}).filter(Boolean) as any[]
|
|
}).filter(Boolean) as any[]
|
|
}
|
|
}
|
|
if (menu?.length) {
|
|
if (menu?.length) {
|
|
- switch (location.pathname) {
|
|
|
|
|
|
+ switch (location?.pathname) {
|
|
case '/':
|
|
case '/':
|
|
history.push(menu?.[0]?.children?.[0]?.path)
|
|
history.push(menu?.[0]?.children?.[0]?.path)
|
|
break;
|
|
break;
|
|
@@ -311,7 +341,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|
export const request = {
|
|
export const request = {
|
|
...errorConfig,
|
|
...errorConfig,
|
|
timeout: 300000,
|
|
timeout: 300000,
|
|
- headers: {
|
|
|
|
|
|
+ headers: {
|
|
['Authorization']: 'Bearer ' + localStorage.getItem('Admin-Token'),
|
|
['Authorization']: 'Bearer ' + localStorage.getItem('Admin-Token'),
|
|
['debug']: sessionStorage.getItem('debug') || ''
|
|
['debug']: sessionStorage.getItem('debug') || ''
|
|
}
|
|
}
|