import React, { useEffect } from 'react'; import { message, Spin } from 'antd'; import { getURLInformation, isEmpty } from '@/utils/CommonUtils'; import { followUpAProjectManager, followUpAProjectSupplier, getSessionRoleData } from '@/utils/session'; import { history } from 'umi'; import { getProjectById } from '../service'; const Loading: React.FC<{}> = () => { /** * 项目跟进中转页 */ //获取角色 const role = getSessionRoleData()?.roleCode; useEffect(() => { //获取必要参数 const projectId = getURLInformation('id') === null ? '' : getURLInformation('id'); if (isEmpty(projectId)) { message.error('缺少必要参数,请重试'); } else { //获取项目数据 getProjectById(projectId).then((res) => { if (res?.code == 200 && res?.success == true) { const data = res?.data; if (role == "ebtp-purchase" || role == "ebtp-agency-project-manager") {//采购经理或代理 //调用存储session方法 followUpAProjectManager(data); setTimeout(() => { history.push('./ProjectLayout/Manager/HomePageSectionList'); }, 1000); } else if (role == "ebtp-supplier") {//供应商 followUpAProjectSupplier(data); setTimeout(() => { history.push('./ProjectLayout/Supplier/HomePageSectionList'); }, 1000); } else { message.error("用户角色信息获取错误,请联系管理员") } } }); } }, []); return (
); }; export default Loading;