import React, { useEffect, useMemo } from 'react'; import { Badge, Layout, Menu } from 'antd'; import { connect } from 'dva'; import RightContent from './RightContent'; import Link from 'umi/link'; import styles from './Index.less'; const { Header, Content, Footer } = Layout; const { SubMenu } = Menu; let timer; const isMobile = isMobileDevice(); // 布局 function LayoutDetail(props) { const { currentUser, permission, dispatch, authList } = props; const isAdmin = currentUser.UserName == 'admin'; var logoStyle = { color: 'white', fontWeight: 600, fontSize: 20, verticalAlign: 'middle', marginRight: 60, width: 120, }; const authCount = useMemo(() => { let count = 0; Object.values(authList).forEach(list => (count += list.length)); return count; }, [authList]); useEffect(() => { if (isMobile) return; // 查询用户信息 dispatch({ type: 'user/fetchCurrent', }); }, []); useEffect(() => { if (isMobile) return; if (!currentUser.ID) return; dispatch({ type: 'authList/queryAuthList', payload: { user_id: currentUser.ID }, }); clearInterval(timer); timer = setInterval(() => { if (location.href.indexOf('/bom/home/audit') != -1) return; dispatch({ type: 'authList/queryAuthList', payload: { user_id: currentUser.ID }, }); }, 60000); return () => clearInterval(timer); }, [currentUser.ID]); // 不支持移动端使用,做判断 if (isMobile) { return (
金科环境
请使用PC端进行审批
); } return (
金科环境
采购清单 流程管理 审核列表 已提交审批
{props.children}
{/* */}
); } function isMobileDevice() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); } export default connect(({ user, authList }) => ({ currentUser: user.currentUser, permission: user.currentUser.Permission, authList: authList.authList, }))(LayoutDetail);