import React, { useState, useEffect } from 'react';
import Manager from "./manager.js";                   // 代理机构业务经理
import ManagerAdmin from "./managerAdmin.js";         // 代理机构管理员
import ManagerSubAdmin from "./managerSubAdmin.js";   // 代理机构子管理员
import Jury from "./Jury.js";                         // 专家
import Supplier from "./supplier.js";                 // 供应商
import PurchasingManager from "./purchaseManager.js"; // 采购经理
import DisposalManager from "./disposalManager.js";   // 内拍处置经理
import Participants from "./participants.js";         // 参拍人
import "./index.less";
import { getSessionRoleData } from '@/utils/session';

const MainPage: React.FC<any> = (props) => {
  const [roleCode, setRoleCode] = useState<string>("");
  useEffect(() => {
    let roleCode = getSessionRoleData().roleCode//daili 代理 gys 供应商
    if (roleCode && roleCode != "") {
      setRoleCode(roleCode)
    }
  })
  return (
    <>
      {
        roleCode == "ebtp-agency-project-manager" ? <Manager /> :
          roleCode == "ebtp-agency-admin" ? <ManagerAdmin /> :
            roleCode == "ebtp-agency-sub-admin" ? <ManagerSubAdmin /> :
              roleCode == "ebtp-supplier" ? <Supplier /> :
                roleCode == "ebtp-expert" ? <Jury /> :
                  roleCode == "ebtp-purchase" ? <PurchasingManager /> :
                    roleCode == "ebtp-auction-manager" ? <DisposalManager /> :
                      roleCode == "ebtp-auction-participant" ? <Participants /> :
                      <></>
      }
    </>
  )
}
export default MainPage