import { tenderStore } from '@/store/mobx' import history from '@/utils/history' import { storage } from '@/utils/util' import { observer } from 'mobx-react' import React, { useEffect } from 'react' interface Authorization { type: 'contract' | 'safe' | 'quality' auth: 'access' | 'add' | 'delete' children: React.ReactNode } /** auth的格式化为:delete | add | access */ const Authorization: React.FC = ({ type, auth, children }) => { useEffect(() => { if (tenderStore.bid) { tenderStore.saveTenderPermission(tenderStore.bid) } if (!tenderStore.tender.bidsectionId) { tenderStore.cloneTenderFromStorage() } }, [ ]) const authPass = 1 // 获取mobx存储的权限 const permission = tenderStore.permission[type] if (permission[auth] === authPass) { return <>{children} } return null } export default observer(Authorization)