import React, { useState, useEffect } from "react"; import "./index.css"; import { ShopOutlined, UsergroupAddOutlined, SoundOutlined, NotificationOutlined, TrophyOutlined, PhoneOutlined, SafetyCertificateOutlined, PoweroffOutlined, MoneyCollectOutlined, FileSearchOutlined, FormOutlined, } from "@ant-design/icons"; import { Menu, Layout } from "antd"; import { Outlet, useNavigate, useLocation } from "react-router-dom"; import { checkAuth, signOut } from "../../utils/auth"; import Data from "./data"; import baseRequest from "../../utils/baseRequest"; export default function Op() { const { Content, Sider } = Layout; const navigate = useNavigate(); const location = useLocation(); const [mid, setMid] = useState(); useEffect(() => { const checkToken = async () => { const isLogin = await checkAuth(); if (!isLogin) { navigate("/login"); } }; checkToken(); const b_mid = baseRequest().b_mid; setMid(b_mid); }, [location, navigate]); function getItem(label, key, icon, children, type) { return { key, icon, children, label, type, }; } const items = [ getItem("审核专区", "review", , [ getItem("公会入驻审核", "guildMachineReview"), getItem("网红入驻审核", "streamerJoin"), getItem("(新)网红入驻审核", "streamerJoinNew"), getItem("(新)网红资料审核", "streamerInformationCompleteNew"), getItem("网红实名认证审核", "streamerVerification"), getItem("主播图片机审回查", "streamerImageMachineReview"), getItem("主播视频机审回查", "streamerVideoMachineReview"), getItem("主播文本机审回查", "streamerTextMachineReview"), getItem("头像机审回查", "imageMachineReview"), getItem("昵称机审回查", "textMachineReview"), getItem("主播昵称机审回查", "streamerNickTextMachineReview"), getItem("广场动态审核", "postMachineReview"), getItem("空间动态审核", "zonePostMachineReview"), ]), getItem("网红管理", "streamerManagement", , [ getItem("网红资料", "streamerInformation"), getItem("空间管理", "streamerSpace"), ]), getItem("动态管理", "postManagement", , [ getItem("广场动态管理", "createAndEditPost"), getItem("广场置顶动态", "topPosts"), getItem("空间动态管理", "EditSpacePost"), ]), getItem("信息查询", "search", , [ getItem("手机号查询", "getPhoneNumber"), getItem("mid/user_id互查", "querryMidAndUserId"), ]), getItem("订单管理", "orderManagement", , [ getItem("查询", "ordersQuerry"), getItem("退款", "refund"), getItem("空间成员退款查询", "spaceMemberRefundQuerry"), getItem("用户误退空间恢复", "rollbackUserLeaveSpace"), getItem("用户重购空间", "rollbackUserRefundSpaceStatus"), ]), getItem("社区治理", "communityManagement", , [ getItem("用户封禁", "blockUser"), getItem("提现封禁", "withdrawFreeze"), ]), getItem( "人工充值/提现", "manualRechargeAndWithdrawal", ), getItem("消息中心管理", "noticesManagement", , [ getItem("消息通知推送", "notices"), getItem("自动回复消息预设", "autoAnswer"), ]), getItem("排行榜管理", "hotManage", ), getItem("意见反馈", "feedback", ), getItem("客服回复", "contact", ), getItem("退出登录", "signOut", ), ]; const fakeItems = [ getItem("审核专区", "review", , [ getItem("公会入驻审核", "guildMachineReview"), getItem("网红入驻审核", "streamerJoin"), getItem("(新)网红入驻审核", "streamerJoinNew"), getItem("(新)网红资料审核", "streamerInformationCompleteNew"), getItem("网红实名认证审核", "streamerVerification"), getItem("主播图片机审回查", "streamerImageMachineReview"), getItem("主播视频机审回查", "streamerVideoMachineReview"), // getItem("主播文本机审回查", "streamerTextMachineReview"), getItem("头像机审回查", "imageMachineReview"), getItem("昵称机审回查", "textMachineReview"), getItem("主播昵称机审回查", "streamerNickTextMachineReview"), getItem("动态机审回查", "postMachineReview"), // getItem("空间动态审核", "zonePostMachineReview"), ]), getItem("网红管理", "streamerManagement", , [ getItem("网红资料", "streamerInformation"), // getItem("空间管理", "streamerSpace"), ]), getItem("动态管理", "postManagement", , [ getItem("广场动态管理", "createAndEditPost"), getItem("广场置顶动态", "topPosts"), // getItem("空间动态管理", "EditSpacePost"), ]), getItem("信息查询", "search", , [ getItem("手机号查询", "getPhoneNumber"), getItem("mid/user_id互查", "querryMidAndUserId"), ]), getItem("订单管理", "orderManagement", , [ getItem("查询", "ordersQuerry"), getItem("退款", "refund"), // getItem("空间成员退款查询", "spaceMemberRefundQuerry"), // getItem("用户误退空间恢复", "rollbackUserLeaveSpace"), // getItem("用户重购空间", "rollbackUserRefundSpaceStatus"), ]), getItem("社区治理", "communityManagement", , [ getItem("用户封禁", "blockUser"), getItem("提现封禁", "withdrawFreeze"), ]), getItem( "人工充值/提现", "manualRechargeAndWithdrawal", ), getItem("消息中心管理", "noticesManagement", , [ getItem("消息通知推送", "notices"), ]), getItem("排行榜管理", "hotManage", ), getItem("意见反馈", "feedback", ), getItem("客服回复", "contact", ), getItem("退出登录", "signOut", ), ]; const onClick = (e) => { if (e.key === "signOut") { signOut(); return; } navigate(e.key); }; //获取当前路由 const parts = location.pathname.split("/"); const pathName = parts[1]; return ( navigate("/")} className="op-logo"> 铁粉空间运营 {location.pathname === "/" && mid !== 75452 && } ); }