feat: Merge branch 'ui-optimization' into weiyuan
This commit is contained in:
@@ -36,6 +36,8 @@ import {
|
||||
Receipt,
|
||||
} from 'lucide-react';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { UserContext } from '../../context/User';
|
||||
import { isSidebarModuleVisible } from '../../helpers/navigationVisibility';
|
||||
import { useMarquee } from '../../hooks/common/useMarquee';
|
||||
import PageBackground from '../../components/common/PageBackground';
|
||||
import UserCenterSidebar from './UserCenterSidebar';
|
||||
@@ -59,6 +61,8 @@ const MobileBottomNav = ({ sidebarConfig }) => {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const [userState] = useContext(UserContext);
|
||||
const userGroup = userState?.user?.group;
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
@@ -108,8 +112,7 @@ const MobileBottomNav = ({ sidebarConfig }) => {
|
||||
const inMiniProgram = isMiniProgramWebView();
|
||||
const visibleNavItems = navItems.filter(
|
||||
(item) =>
|
||||
sidebarConfig?.enabled !== false &&
|
||||
sidebarConfig?.[item.key] !== false &&
|
||||
isSidebarModuleVisible(sidebarConfig, item.key, userGroup) &&
|
||||
!(inMiniProgram && isMiniProgramPaymentPath(item.path)),
|
||||
);
|
||||
|
||||
@@ -147,6 +150,8 @@ const MobileBottomNav = ({ sidebarConfig }) => {
|
||||
|
||||
const UserCenter = ({ keyManagementMode = false }) => {
|
||||
const [statusState] = useContext(StatusContext);
|
||||
const [userState] = useContext(UserContext);
|
||||
const userGroup = userState?.user?.group;
|
||||
// 仅用于页面外壳的样式标识(看板与子页面底色不同),不参与路由判断
|
||||
const ucRoute = useLocation().pathname.split('/')[2] || 'dashboard';
|
||||
|
||||
@@ -182,7 +187,7 @@ const UserCenter = ({ keyManagementMode = false }) => {
|
||||
: routePathMap[
|
||||
userCenterRoutes.find(
|
||||
(key) =>
|
||||
userCenterConfig[key] !== false &&
|
||||
isSidebarModuleVisible(userCenterConfig, key, userGroup) &&
|
||||
!(
|
||||
inMiniProgram &&
|
||||
isMiniProgramPaymentPath(`/user-center/${routePathMap[key]}`)
|
||||
@@ -193,7 +198,7 @@ const UserCenter = ({ keyManagementMode = false }) => {
|
||||
? `/user-center/${firstVisiblePath}`
|
||||
: '/';
|
||||
const guardUserCenterRoute = (key, element) => {
|
||||
if (userCenterConfig.enabled === false || userCenterConfig[key] === false) {
|
||||
if (!isSidebarModuleVisible(userCenterConfig, key, userGroup)) {
|
||||
return <Navigate to={firstVisibleRoute} replace />;
|
||||
}
|
||||
return element;
|
||||
|
||||
Reference in New Issue
Block a user