Commit 3f12471a authored by 李腾's avatar 李腾

feat: 首页添加权限控制

parent eeb906ed
......@@ -6,10 +6,18 @@ import { Link } from 'umi';
import { FileTextOutlined } from '@ant-design/icons';
import style from './styles.less';
import { getPendingNum } from './service';
import { connect } from 'dva';
import {
AFTER_SALE_ORDER,
CANCEL_BILL_MANAGE,
PENDING_DELIVERY_ORDER,
} from '@/../config/permission.config';
const Admin = () => {
const Admin = props => {
const [pendingNum, setpendingNum] = useState({});
const showAfterSaleList = props.permissions[AFTER_SALE_ORDER.LIST];
const showCancelBillList = props.permissions[CANCEL_BILL_MANAGE.LIST];
const showPendingDeliveryOrderList = props.permissions[PENDING_DELIVERY_ORDER.LIST];
useEffect(() => {
const qurey = async () => {
const { data } = await getPendingNum();
......@@ -28,12 +36,19 @@ const Admin = () => {
</div>
<div style={{ marginTop: '20px' }}>
<Row className={style.orderContent}>
{showPendingDeliveryOrderList || showCancelBillList ? (
<Col span={2} className="titleOne">
<div>
<FileTextOutlined />
<p>订单</p>
</div>
</Col>
) : (
''
)}
{showPendingDeliveryOrderList ? (
<>
<Col span={2}>
<Link
to={{
......@@ -55,6 +70,11 @@ const Admin = () => {
<p>超时发货{'>'}48小时</p>
</Link>
</Col>
</>
) : (
''
)}
{showCancelBillList ? (
<Col span={4}>
<Link
to={{
......@@ -65,12 +85,18 @@ const Admin = () => {
<p>取消订单审核{'<'}24小时</p>
</Link>
</Col>
) : (
''
)}
{showAfterSaleList ? (
<>
<Col span={2} className="titleTwo" offset={4}>
<div>
<FileTextOutlined />
<p> 售后</p>
</div>
</Col>
<Col span={3}>
<Link
to={{
......@@ -81,10 +107,16 @@ const Admin = () => {
<p>退款待审核{'<'}24小时</p>
</Link>
</Col>
</>
) : (
''
)}
</Row>
</div>
</div>
</div>
);
};
export default Admin;
export default connect(({ menu }) => ({
permissions: menu.permissions,
}))(Admin);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment