|
@@ -4,7 +4,7 @@ import { Button, notification, Result } from 'antd';
|
|
|
import { history, RequestConfig } from 'umi';
|
|
|
import RightContent from '@/components/RightContent';
|
|
|
import { ResponseError } from 'umi-request';
|
|
|
-import { queryCurrent, getMenu } from './services/user';
|
|
|
+import { queryCurrent, getMenu, getAdAccountAllOfMember } from './services/user';
|
|
|
import defaultSettings from '../config/defaultSettings';
|
|
|
import { DesktopOutlined, MessageOutlined, SendOutlined, TeamOutlined, QrcodeOutlined, DatabaseOutlined, ReadOutlined, MobileOutlined, FundViewOutlined, RadarChartOutlined, BarChartOutlined, WechatOutlined, BookOutlined, FileImageOutlined, EyeOutlined, UserOutlined } from '@ant-design/icons';
|
|
|
import { getMyMenu, headrRouter } from '../config/routerConfig';
|
|
@@ -26,7 +26,7 @@ interface CurrentUser {
|
|
|
label: string;
|
|
|
}[];
|
|
|
userId?: string;
|
|
|
- powerLevel?:number;
|
|
|
+ powerLevel?: number;
|
|
|
access?: 'user' | 'guest' | 'admin' | any;
|
|
|
unreadCount?: number;
|
|
|
companyList?: any[],
|
|
@@ -50,18 +50,18 @@ export async function getInitialState(): Promise<{
|
|
|
let currentUser = {}
|
|
|
let userInfo: any = await queryCurrent();//用户信息
|
|
|
let companyInfo = userInfo?.data?.companyRelationInfo?.filter((item: { companyId: number }) => item.companyId !== 4 && item.companyId !== 3)
|
|
|
- currentUser = { access: 'admin',powerLevel:userInfo?.data?.userInfo?.powerLevel, name: userInfo?.data?.userInfo?.nickname || '', userId: userInfo?.data?.userInfo?.userId, phone: userInfo?.data?.userInfo?.phone || '', companyList: companyInfo, onlineCompanyId: userInfo?.data?.onlineCompanyId }//处理个人信息
|
|
|
- let menu: any = await getMenu().then((res: any) => {//获取菜单并处理
|
|
|
+ currentUser = { access: 'admin', powerLevel: userInfo?.data?.userInfo?.powerLevel, name: userInfo?.data?.userInfo?.nickname || '', userId: userInfo?.data?.userInfo?.userId, phone: userInfo?.data?.userInfo?.phone || '', companyList: companyInfo, onlineCompanyId: userInfo?.data?.onlineCompanyId }//处理个人信息
|
|
|
+ let menu: any = await getMenu().then(async (res: any) => {//获取菜单并处理
|
|
|
let { code, data } = res
|
|
|
let path = getMyMenu(code, data)
|
|
|
if (userInfo?.data?.userInfo?.account === 'admin' && path.length > 0) {//假如是ADMIN加入api测试
|
|
|
- path[0].routes.push({key:0, path: '/operatePage/apitest', name: 'api测试', icon: '', component: './operatePage/apitest', roles: 'admin' })
|
|
|
+ path[0].routes.push({ key: 0, path: '/operatePage/apitest', name: 'api测试', icon: '', component: './operatePage/apitest', roles: 'admin' })
|
|
|
}
|
|
|
return { data: path }
|
|
|
});
|
|
|
- localStorage.setItem('sex',userInfo?.data?.userInfo?.sex)
|
|
|
- localStorage.setItem('userId',userInfo?.data?.userInfo?.userId)
|
|
|
- localStorage.setItem('name',userInfo?.data?.userInfo?.nickname)
|
|
|
+ localStorage.setItem('sex', userInfo?.data?.userInfo?.sex)
|
|
|
+ localStorage.setItem('userId', userInfo?.data?.userInfo?.userId)
|
|
|
+ localStorage.setItem('name', userInfo?.data?.userInfo?.nickname)
|
|
|
return {
|
|
|
currentUser,
|
|
|
settings: { ...defaultSettings },
|
|
@@ -98,12 +98,12 @@ const IconMap = {
|
|
|
barChart: <BarChartOutlined />,
|
|
|
wechat: <WechatOutlined />,
|
|
|
book: <BookOutlined />,
|
|
|
- peoples:<UserOutlined />,
|
|
|
+ peoples: <UserOutlined />,
|
|
|
'file-image': <FileImageOutlined />,
|
|
|
launch: <span role="img" aria-label="fund-view" className="anticon anticon-fund-view"><LaunchSvg /></span>,
|
|
|
adLaunch: <span role="img" aria-label="fund-view" className="anticon anticon-fund-view"><AdLaunchSvg /></span>,
|
|
|
material: <span role="img" aria-label="fund-view" className="anticon anticon-fund-view"><MaterialSvg /></span>,
|
|
|
- eye:<EyeOutlined />
|
|
|
+ eye: <EyeOutlined />
|
|
|
};
|
|
|
//处理菜单
|
|
|
const loopMenuItem = (menus: MenuDataItem[],): MenuDataItem[] => {
|
|
@@ -136,12 +136,12 @@ export const layout = ({
|
|
|
// footerRender: () => <Footer />,
|
|
|
onPageChange: () => {
|
|
|
headrRouter(initialState, history)
|
|
|
- let {pathname,query} = history.location
|
|
|
- if(query?.t){//带token直接进入对应页面
|
|
|
- sessionStorage.setItem('Admin-Token',decodeURIComponent(query.t as any))
|
|
|
- location.href =window.location.origin+'/#'+pathname
|
|
|
+ let { pathname, query } = history.location
|
|
|
+ if (query?.t) {//带token直接进入对应页面
|
|
|
+ sessionStorage.setItem('Admin-Token', decodeURIComponent(query.t as any))
|
|
|
+ location.href = window.location.origin + '/#' + pathname
|
|
|
location.reload()
|
|
|
- }else if (!initialState?.currentUser?.name && history.location.pathname !== '/user/login') {
|
|
|
+ } else if (!initialState?.currentUser?.name && history.location.pathname !== '/user/login') {
|
|
|
history.push('/user/login');
|
|
|
}
|
|
|
},
|
|
@@ -263,7 +263,7 @@ export const request: RequestConfig = {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if(resData.code === 310){//权限错误
|
|
|
+ if (resData.code === 310) {//权限错误
|
|
|
let msg = sessionStorage.getItem('msg')
|
|
|
sessionStorage.removeItem('Admin-Token')
|
|
|
history.push('/user/login')
|