refactor: 拆分品牌业务类型与页面方案
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled

This commit is contained in:
que01 committed 2026-10-20 17:04:30 +08:00
1 parent f02e2cafbb
commit 0d9f4a7d6f
86 files changed
+4111 -1543

No files matched your search

+20 -6
View File
@@ -4,9 +4,11 @@ import {
BarsOutlined,
CloudUploadOutlined,
FormOutlined,
LayoutOutlined,
MessageOutlined,
MobileOutlined,
SafetyCertificateOutlined,
ShopOutlined,
TeamOutlined,
ThunderboltOutlined,
} from "@ant-design/icons";
@@ -16,10 +18,13 @@ import { BrandMark } from "../components/BrandMark.js";
import { StatusTag } from "../components/StatusTag.js";
import {
FeatureBrandPage,
FeatureBrandsPage,
FeatureCapabilitiesPage,
FeatureCreateBrandPage,
FeatureInquiriesPage,
FeatureMembersPage,
FeatureOverviewPage,
FeaturePageSchemePage,
FeaturePublicationPage,
FeatureTemplateManagementPage,
FeatureServicesPage,
@@ -34,6 +39,7 @@ import { AdminSelect } from "../components/AdminSelect.js";
import { AdminLayout } from "../components/AdminLayout.js";
import { Route, Routes } from "react-router-dom";
import { AdminOverviewRedirect } from "./AdminRouter.js";
import { createBrandRouteElement } from "./route-access.js";
import { Suspense } from "react";
export function Dashboard({
@@ -70,7 +76,7 @@ export function Dashboard({
label: "日常经营",
children: [
{ key: "overview", label: "当前品牌概览", icon: <AppstoreOutlined /> },
{ key: "publication", label: "配置与发布", icon: <CloudUploadOutlined /> },
{ key: "publication", label: "内容与发布", icon: <CloudUploadOutlined /> },
{ key: "brand", label: "小程序页面", icon: <MobileOutlined /> },
{ key: "trust", label: "信任内容", icon: <SafetyCertificateOutlined /> },
{ key: "services", label: "业务提供项", icon: <BarsOutlined /> },
@@ -83,8 +89,10 @@ export function Dashboard({
: [
{
type: "group" as const,
label: "系统管理",
label: "品牌设置",
children: [
{ key: "brands", label: "品牌管理", icon: <ShopOutlined /> },
{ key: "page-scheme", label: "页面方案", icon: <LayoutOutlined /> },
{ key: "capabilities", label: "能力插件", icon: <ThunderboltOutlined /> },
{ key: "members", label: "团队成员", icon: <TeamOutlined /> },
...(platformTemplateRole === "template_admin"
@@ -141,10 +149,7 @@ export function Dashboard({
<Routes>
<Route index element={<AdminOverviewRedirect />} />
<Route path="overview" element={<FeatureOverviewPage />} />
<Route
path="publication"
element={<FeaturePublicationPage canManageTemplate={role !== "editor"} />}
/>
<Route path="publication" element={<FeaturePublicationPage />} />
<Route path="brand" element={<FeatureBrandPage />} />
<Route path="trust" element={<FeatureTrustContentPage />} />
<Route path="services" element={<FeatureServicesPage />} />
@@ -152,6 +157,15 @@ export function Dashboard({
<Route path="workspace" element={<FeatureWorkspacePage />} />
{role === "editor" ? null : (
<>
<Route
path="brands"
element={<FeatureBrandsPage canCreate={role === "owner"} />}
/>
<Route
path="brands/new"
element={createBrandRouteElement(role, <FeatureCreateBrandPage />)}
/>
<Route path="page-scheme" element={<FeaturePageSchemePage />} />
<Route path="capabilities" element={<FeatureCapabilitiesPage />} />
<Route path="members" element={<FeatureMembersPage />} />
{platformTemplateRole === "template_admin" ? (
+14
View File
@@ -0,0 +1,14 @@
import { createElement, type ReactNode } from "react";
import { Navigate } from "react-router-dom";
export const createBrandFallbackPath = "/admin/brands";
export function canCreateBrand(role: string) {
return role === "owner";
}
export function createBrandRouteElement(role: string, content: ReactNode) {
return canCreateBrand(role)
? content
: createElement(Navigate, { to: createBrandFallbackPath, replace: true });
}
+15
View File
@@ -48,3 +48,18 @@ export const FeatureTemplateManagementPage = React.lazy(() =>
default: module.TemplateManagementPage,
})),
);
export const FeatureBrandsPage = React.lazy(() =>
import("../features/brands/BrandsPage.js").then((module) => ({
default: module.BrandsPage,
})),
);
export const FeatureCreateBrandPage = React.lazy(() =>
import("../features/brands/CreateBrandPage.js").then((module) => ({
default: module.CreateBrandPage,
})),
);
export const FeaturePageSchemePage = React.lazy(() =>
import("../features/page-scheme/PageSchemePage.js").then((module) => ({
default: module.PageSchemePage,
})),
);