feat: 统一 Admin 后台设计语言
用中性灰底 + 单一强调色重做后台视觉,并集中到一套令牌: - 新增 apps/admin/src/lib/theme.ts,通过 ConfigProvider 注入主题令牌 - 新增 apps/admin/src/styles/admin.css 与 AdminSection、MetricCard、StatusTag 组件 - 侧栏改白底浅色并补图标,顶栏改 56px 白底,内容区最大宽 1200px - 全部页面接入状态标签,antd 原生彩色 Tag 与内联色值清零 - 登录与改密页、加载态骨架屏、错误提示条统一 - brand 页两个 Tab 统一为白卡片容器,消除双标题与宽度不一致 设计规范见 apps/admin/design.md。
This commit is contained in:
1 parent
bb94d80e13
commit
2f26828f09
34 files changed
+2159
-922
No files matched your search
@@ -1,19 +1,29 @@
|
||||
.brand-page__content {
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
.brand-page__content[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.brand-page__toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px 0;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
margin-bottom: 20px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 10px;
|
||||
background: var(--admin-fill-quiet);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.brand-page__toolbar .ant-segmented {
|
||||
background: var(--admin-surface);
|
||||
}
|
||||
|
||||
.brand-page__toolbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
.brand-page__toolbar {
|
||||
flex-wrap: wrap;
|
||||
@@ -25,54 +35,22 @@
|
||||
}
|
||||
|
||||
.brand-settings-section {
|
||||
padding: 24px 0;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
padding: 20px;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 10px;
|
||||
background: var(--admin-surface);
|
||||
}
|
||||
|
||||
.brand-settings-section:first-child {
|
||||
padding-top: 8px;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.brand-settings-section__header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.brand-settings-section__header .ant-typography {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.brand-settings-section__header .ant-typography + .ant-typography {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
.brand-settings-section + .brand-settings-section {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.brand-page__template-note {
|
||||
margin-top: 24px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 1199px) {
|
||||
.brand-page__content {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.brand-page__template-note {
|
||||
position: static;
|
||||
margin-top: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
.brand-settings-section__header {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.brand-settings-section__header .ant-tag {
|
||||
display: inline-block;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,4 @@
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Col,
|
||||
Form,
|
||||
Input,
|
||||
Row,
|
||||
Select,
|
||||
Segmented,
|
||||
Space,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import { Alert, Button, Col, Form, Input, Row, Select, Segmented, message } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useState } from "react";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
@@ -20,6 +7,7 @@ import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { ImageUrlField } from "../../components/ImageUrlField.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import { PresentationEditor } from "./PresentationEditor.js";
|
||||
import type { PreviewSelection } from "./preview-selection.js";
|
||||
import "./BrandPage.css";
|
||||
@@ -72,7 +60,7 @@ export function BrandPage() {
|
||||
? `先让访客理解你是谁、服务谁,以及为什么值得信任。${template.data.description}`
|
||||
: "先让访客理解你是谁、服务谁,以及为什么值得信任。"
|
||||
}
|
||||
extra={<Tag color="blue">{template.data?.name ?? "当前模板"}</Tag>}
|
||||
extra={<StatusTag tone="info" label={template.data?.name ?? "当前模板"} />}
|
||||
/>
|
||||
<div className="brand-page__toolbar">
|
||||
<Segmented
|
||||
@@ -84,12 +72,13 @@ export function BrandPage() {
|
||||
{ value: "brand", label: "品牌资料" },
|
||||
]}
|
||||
/>
|
||||
<Space>
|
||||
<Tag color={dirty ? "orange" : "default"}>
|
||||
{dirty ? "品牌资料有未保存修改" : "草稿工作区"}
|
||||
</Tag>
|
||||
<div className="brand-page__toolbar-actions">
|
||||
<StatusTag
|
||||
tone={dirty ? "warning" : "neutral"}
|
||||
label={dirty ? "品牌资料有未保存修改" : "草稿工作区"}
|
||||
/>
|
||||
<Link to="/admin/publication">检查与发布 →</Link>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
<div className="brand-page__content" hidden={panel !== "brand"}>
|
||||
<div className="brand-page__settings">
|
||||
@@ -101,14 +90,14 @@ export function BrandPage() {
|
||||
onFinish={(values) => save.mutate(values)}
|
||||
>
|
||||
<section className="brand-settings-section" aria-labelledby="brand-identity-title">
|
||||
<div className="brand-settings-section__header">
|
||||
<div className="admin-section-head">
|
||||
<div>
|
||||
<Typography.Title id="brand-identity-title" level={4}>
|
||||
<h2 id="brand-identity-title" className="admin-section-title">
|
||||
我是谁
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">公开展示的品牌身份和定位。</Typography.Text>
|
||||
</h2>
|
||||
<p className="admin-section-description">公开展示的品牌身份和定位。</p>
|
||||
</div>
|
||||
<Tag>品牌基础信息</Tag>
|
||||
<StatusTag tone="neutral" label="品牌基础信息" />
|
||||
</div>
|
||||
<Form.Item
|
||||
name="name"
|
||||
@@ -136,14 +125,14 @@ export function BrandPage() {
|
||||
</Form.Item>
|
||||
</section>
|
||||
<section className="brand-settings-section" aria-labelledby="brand-contact-title">
|
||||
<div className="brand-settings-section__header">
|
||||
<div className="admin-section-head">
|
||||
<div>
|
||||
<Typography.Title id="brand-contact-title" level={4}>
|
||||
<h2 id="brand-contact-title" className="admin-section-title">
|
||||
如何联系与合作
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">
|
||||
</h2>
|
||||
<p className="admin-section-description">
|
||||
让访客知道联系渠道、服务范围和响应预期。
|
||||
</Typography.Text>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Row gutter={16}>
|
||||
@@ -177,14 +166,14 @@ export function BrandPage() {
|
||||
</Form.Item>
|
||||
</section>
|
||||
<section className="brand-settings-section" aria-labelledby="brand-visual-title">
|
||||
<div className="brand-settings-section__header">
|
||||
<div className="admin-section-head">
|
||||
<div>
|
||||
<Typography.Title id="brand-visual-title" level={4}>
|
||||
<h2 id="brand-visual-title" className="admin-section-title">
|
||||
模板与品牌视觉
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">
|
||||
</h2>
|
||||
<p className="admin-section-description">
|
||||
模板负责业务表达,品牌信息仍由你统一维护。
|
||||
</Typography.Text>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Form.Item
|
||||
@@ -221,12 +210,12 @@ export function BrandPage() {
|
||||
</Col>
|
||||
</Row>
|
||||
</section>
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
|
||||
<div className="admin-actions admin-offset-top-lg">
|
||||
<MutationError error={save.error} />
|
||||
<Button type="primary" htmlType="submit" loading={save.isPending} size="large">
|
||||
保存品牌表达
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
{template.data ? (
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
border-bottom: 1px solid var(--admin-border);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.component-template-preview__tools button {
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #d9d9d9;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.component-template-preview__tools button[aria-pressed="true"] {
|
||||
border-color: #1677ff;
|
||||
color: #1677ff;
|
||||
border-color: var(--admin-primary);
|
||||
color: var(--admin-primary);
|
||||
}
|
||||
|
||||
.component-template-preview {
|
||||
@@ -31,7 +31,7 @@
|
||||
padding: 24px 16px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
background: #f3f4f6;
|
||||
background: var(--admin-fill);
|
||||
}
|
||||
|
||||
.component-template-preview__canvas {
|
||||
@@ -102,13 +102,13 @@
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
pointer-events: none;
|
||||
border: 2px solid #91caff;
|
||||
border: 2px solid var(--admin-primary);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.component-template-preview__outline.is-selected {
|
||||
z-index: 6;
|
||||
border-color: #1677ff;
|
||||
border-color: var(--admin-primary);
|
||||
box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.16);
|
||||
}
|
||||
|
||||
@@ -117,10 +117,10 @@
|
||||
z-index: 7;
|
||||
width: max-content !important;
|
||||
padding: 2px 8px !important;
|
||||
border: 1px solid #1677ff !important;
|
||||
border: 1px solid var(--admin-primary) !important;
|
||||
border-radius: 4px !important;
|
||||
background: #fff !important;
|
||||
color: #0958d9 !important;
|
||||
color: var(--admin-primary) !important;
|
||||
font-size: 12px !important;
|
||||
line-height: 20px !important;
|
||||
cursor: pointer;
|
||||
@@ -135,7 +135,7 @@
|
||||
padding: 2px 7px;
|
||||
overflow: hidden;
|
||||
border-radius: 4px 4px 0 0;
|
||||
background: #1677ff;
|
||||
background: var(--admin-primary);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
|
||||
@@ -128,7 +128,12 @@ export function InquiryPreviewEditor({
|
||||
)}
|
||||
</Form.List>
|
||||
<MutationError error={save.error} />
|
||||
<Button style={{ marginTop: 24 }} type="primary" htmlType="submit" loading={save.isPending}>
|
||||
<Button
|
||||
className="admin-offset-top-lg"
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
loading={save.isPending}
|
||||
>
|
||||
保存表单字段
|
||||
</Button>
|
||||
</Form>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
.presentation-editor {
|
||||
margin-top: 0;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.presentation-editor__header {
|
||||
@@ -8,15 +7,7 @@
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.presentation-editor__header .ant-typography {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.presentation-editor__header .ant-typography + .ant-typography {
|
||||
margin-bottom: 0;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.presentation-editor > .ant-space {
|
||||
@@ -24,9 +15,9 @@
|
||||
width: 100%;
|
||||
margin-bottom: 24px !important;
|
||||
padding: 6px;
|
||||
border: 1px solid #e8e8e8;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 10px;
|
||||
background: #fafafa;
|
||||
background: var(--admin-fill-quiet);
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
@@ -45,16 +36,16 @@
|
||||
grid-template-columns: 200px minmax(300px, 1fr) minmax(280px, 360px);
|
||||
grid-template-areas: "outline preview inspector";
|
||||
margin: 0 !important;
|
||||
border: 1px solid #e5e7eb;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
background: var(--admin-surface);
|
||||
}
|
||||
|
||||
.presentation-editor__preview {
|
||||
grid-area: preview;
|
||||
padding: 20px !important;
|
||||
background: #f8fafc;
|
||||
background: var(--admin-fill);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -62,13 +53,13 @@
|
||||
grid-area: inspector;
|
||||
padding: 24px !important;
|
||||
min-width: 0;
|
||||
border-left: 1px solid #e5e7eb;
|
||||
border-left: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.presentation-editor__outline {
|
||||
grid-area: outline;
|
||||
padding: 20px 12px;
|
||||
border-right: 1px solid #e5e7eb;
|
||||
border-right: 1px solid var(--admin-border);
|
||||
}
|
||||
.presentation-editor__regions {
|
||||
display: flex;
|
||||
@@ -90,8 +81,8 @@
|
||||
padding-left: 24px;
|
||||
}
|
||||
.presentation-editor__regions .ant-btn[aria-pressed="true"] {
|
||||
background: #e6f4ff;
|
||||
color: #0958d9;
|
||||
background: var(--admin-primary-bg);
|
||||
color: var(--admin-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -117,26 +108,37 @@
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.presentation-editor__inspector form > section {
|
||||
padding: 16px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 12px;
|
||||
background: #f8fafc;
|
||||
.presentation-editor__form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.presentation-editor__inspector form > section + section {
|
||||
.presentation-editor__form-body {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.presentation-editor__inspector .presentation-editor__form-body > section {
|
||||
padding: 16px;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 12px;
|
||||
background: var(--admin-fill);
|
||||
}
|
||||
|
||||
.presentation-editor__inspector .presentation-editor__form-body > section + section {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.presentation-editor__inspector form > .ant-space:last-child {
|
||||
.presentation-editor__form-actions {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
padding: 16px 0 4px;
|
||||
border-top: 1px solid #e5e7eb;
|
||||
background: #fff;
|
||||
border-top: 1px solid var(--admin-border);
|
||||
background: var(--admin-surface);
|
||||
}
|
||||
.presentation-editor__inspector form > .ant-space:last-child .ant-btn-primary {
|
||||
|
||||
.presentation-editor__form-actions .ant-btn-primary {
|
||||
min-width: 140px;
|
||||
}
|
||||
.presentation-editor__inspector > .ant-tag {
|
||||
@@ -150,11 +152,11 @@
|
||||
}
|
||||
.presentation-editor__outline {
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
border-bottom: 1px solid var(--admin-border);
|
||||
}
|
||||
.presentation-editor__inspector {
|
||||
border-left: 0;
|
||||
border-top: 1px solid #e5e7eb;
|
||||
border-top: 1px solid var(--admin-border);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
Select,
|
||||
Segmented,
|
||||
Space,
|
||||
Tag,
|
||||
Typography,
|
||||
} from "antd";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
@@ -26,6 +25,7 @@ import { projectBrandAliases, projectTrustPresentation } from "@personal-brand/a
|
||||
import { TemplateListField } from "../../components/TemplateListField.js";
|
||||
import { TemplateFieldRenderer } from "../../components/TemplateFieldRenderer.js";
|
||||
import { MutationError } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import { RecordContentEditor } from "../../components/RecordContentEditor.js";
|
||||
import { TemplatePreview } from "./TemplatePreview.js";
|
||||
import { InquiryPreviewEditor } from "./InquiryPreviewEditor.js";
|
||||
@@ -483,14 +483,14 @@ export function PresentationEditor({
|
||||
<section className="presentation-editor" aria-labelledby="presentation-editor-title">
|
||||
<div className="presentation-editor__header">
|
||||
<div>
|
||||
<Typography.Title id="presentation-editor-title" level={3}>
|
||||
<h2 id="presentation-editor-title" className="admin-section-title">
|
||||
小程序页面配置
|
||||
</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
</h2>
|
||||
<p className="admin-section-description">
|
||||
按页面查找内容。这里修改的是草稿,发布后访客才会看到更新。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
</div>
|
||||
{templateContent ? <Tag color="blue">{templateContent.displayName}</Tag> : null}
|
||||
{templateContent ? <StatusTag tone="info" label={templateContent.displayName} /> : null}
|
||||
</div>
|
||||
{loading ? <Alert type="info" showIcon message="正在读取当前模板的编辑项目" /> : null}
|
||||
{error ? (
|
||||
@@ -517,7 +517,7 @@ export function PresentationEditor({
|
||||
setActivePage(value);
|
||||
})
|
||||
}
|
||||
style={{ minWidth: 180 }}
|
||||
className="admin-field-w-2xl"
|
||||
/>
|
||||
) : (
|
||||
<Segmented
|
||||
@@ -542,7 +542,7 @@ export function PresentationEditor({
|
||||
{selectedPage === "detail" && draftWorkspace?.offerings.length ? (
|
||||
<Select
|
||||
aria-label="选择详情页业务内容"
|
||||
style={{ width: "100%", marginBottom: 12 }}
|
||||
className="admin-block admin-offset-bottom-sm"
|
||||
value={selectedDetailOfferingId}
|
||||
options={draftWorkspace.offerings.map((item) => ({
|
||||
value: item.id,
|
||||
@@ -571,7 +571,7 @@ export function PresentationEditor({
|
||||
<Typography.Title level={5}>页面区域</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">选择区域,编辑对应内容</Typography.Paragraph>
|
||||
{visibleTargets.length ? (
|
||||
<Space className="presentation-editor__regions" wrap style={{ marginTop: 16 }}>
|
||||
<Space className="presentation-editor__regions admin-offset-top" wrap>
|
||||
{visibleTargets.map((target) => (
|
||||
<Button
|
||||
key={target.key}
|
||||
@@ -613,15 +613,24 @@ export function PresentationEditor({
|
||||
<Typography.Title level={5}>
|
||||
{selectedTarget?.label ?? pageTitle(selectedPage ?? "home")}
|
||||
</Typography.Title>
|
||||
<Tag color={brandDirty || recordDraft || inquiryDraft ? "orange" : "default"}>
|
||||
{save.isPending
|
||||
? "正在保存"
|
||||
: save.isError
|
||||
? "保存失败,请重试"
|
||||
: brandDirty || recordDraft || inquiryDraft
|
||||
? "有未保存修改"
|
||||
: "草稿已同步"}
|
||||
</Tag>
|
||||
<StatusTag
|
||||
tone={
|
||||
save.isError
|
||||
? "error"
|
||||
: save.isPending || brandDirty || recordDraft || inquiryDraft
|
||||
? "warning"
|
||||
: "neutral"
|
||||
}
|
||||
label={
|
||||
save.isPending
|
||||
? "正在保存"
|
||||
: save.isError
|
||||
? "保存失败,请重试"
|
||||
: brandDirty || recordDraft || inquiryDraft
|
||||
? "有未保存修改"
|
||||
: "草稿已同步"
|
||||
}
|
||||
/>
|
||||
{selectedPage === "detail" && !selectedTarget ? (
|
||||
<Alert
|
||||
type="info"
|
||||
@@ -787,9 +796,9 @@ export function PresentationEditor({
|
||||
initialValues={initialValues}
|
||||
onValuesChange={handleValuesChange}
|
||||
onFinish={() => save.mutate(form.getFieldsValue(true) as PresentationValues)}
|
||||
style={{ minHeight: 0, display: "flex", flexDirection: "column" }}
|
||||
className="presentation-editor__form"
|
||||
>
|
||||
<div style={{ flex: 1 }}>
|
||||
<div className="presentation-editor__form-body">
|
||||
{editableSections.map((section, index) => (
|
||||
<section key={section.key} aria-labelledby={`section-${section.key}`}>
|
||||
{selectedTarget && index > 0 ? <Divider /> : null}
|
||||
@@ -836,7 +845,7 @@ export function PresentationEditor({
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 24 }}
|
||||
className="admin-offset-bottom-lg"
|
||||
message="这个页面还有关联内容"
|
||||
description={
|
||||
<Space wrap>
|
||||
@@ -857,7 +866,7 @@ export function PresentationEditor({
|
||||
: "/admin/workspace",
|
||||
);
|
||||
}}
|
||||
style={{ padding: 0 }}
|
||||
className="admin-link-flush"
|
||||
>
|
||||
{item.label}
|
||||
</Button>
|
||||
@@ -880,12 +889,12 @@ export function PresentationEditor({
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
</div>
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
|
||||
<div className="presentation-editor__form-actions admin-actions admin-offset-top-lg">
|
||||
<MutationError error={save.error} />
|
||||
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
||||
保存页面内容
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Form>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
height: min(72vh, 760px);
|
||||
min-height: 560px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #e8e8e8;
|
||||
background: #f3f4f6;
|
||||
border: 1px solid var(--admin-border);
|
||||
background: var(--admin-fill);
|
||||
}
|
||||
|
||||
.template-preview iframe {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Card, Col, Empty, Row, Typography } from "antd";
|
||||
import { Card, Col, Empty, Row } from "antd";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
import { CapabilityCard } from "./components/CapabilityCard.js";
|
||||
@@ -14,7 +14,7 @@ export function CapabilitiesPage() {
|
||||
description="以经营者视角调整模板能力的开关与展示设置;保存后进入草稿,发布后生效。"
|
||||
/>
|
||||
{query.data?.length ? (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Row gutter={[16, 16]} className="admin-equal-height">
|
||||
{query.data.map((capability) => (
|
||||
<Col key={capability.capabilityKey} xs={24} lg={12}>
|
||||
<CapabilityCard capability={capability} />
|
||||
@@ -26,9 +26,9 @@ export function CapabilitiesPage() {
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前模板没有可配置能力。" />
|
||||
</Card>
|
||||
)}
|
||||
<Typography.Text type="secondary" style={{ display: "block", marginTop: 16 }}>
|
||||
<p className="admin-page-header-description admin-offset-top">
|
||||
技术信息仅用于排查问题,不作为运营判断依据。
|
||||
</Typography.Text>
|
||||
</p>
|
||||
</QueryState>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Alert, Button, Card, Input, Switch, Tag, Typography } from "antd";
|
||||
import { Button, Card, Input, Switch, Typography } from "antd";
|
||||
import { useState } from "react";
|
||||
import { ErrorNote } from "../../../components/QueryState.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
import { useCapabilityMutation } from "../hooks/useCapabilityQueries.js";
|
||||
import type { AdminCapability, CapabilityStatus } from "../types.js";
|
||||
import { CapabilityStatusControl, CapabilityStatusTag } from "./CapabilityStatusControl.js";
|
||||
@@ -46,10 +48,10 @@ export function CapabilityCard({ capability }: { capability: AdminCapability })
|
||||
return (
|
||||
<Card
|
||||
title={
|
||||
<span>
|
||||
<span className="admin-row-line">
|
||||
{capability.displayName ?? "未命名能力"}
|
||||
<Tag style={{ marginLeft: 8 }}>{sourceLabels[capability.source]}</Tag>
|
||||
<CapabilityStatusTag status={status} />
|
||||
<StatusTag tone="neutral" label={sourceLabels[capability.source]} />
|
||||
</span>
|
||||
}
|
||||
extra={
|
||||
@@ -59,48 +61,40 @@ export function CapabilityCard({ capability }: { capability: AdminCapability })
|
||||
}
|
||||
>
|
||||
{mutation.isError ? (
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
message="保存失败,已保留当前输入"
|
||||
description={
|
||||
mutation.error instanceof Error ? mutation.error.message : "请检查网络或稍后重试"
|
||||
}
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<div className="admin-offset-bottom">
|
||||
<ErrorNote error={mutation.error} />
|
||||
</div>
|
||||
) : null}
|
||||
{capability.description ? (
|
||||
<Typography.Paragraph>{capability.description}</Typography.Paragraph>
|
||||
<p className="admin-section-description">{capability.description}</p>
|
||||
) : null}
|
||||
{capability.impact ? (
|
||||
<Typography.Paragraph type="secondary">影响:{capability.impact}</Typography.Paragraph>
|
||||
<p className="admin-section-description">影响:{capability.impact}</p>
|
||||
) : null}
|
||||
<div style={{ display: "grid", gap: 12 }}>
|
||||
<div className="admin-field-stack">
|
||||
<div>
|
||||
<Typography.Text strong>运行状态</Typography.Text>
|
||||
<div style={{ marginTop: 8 }}>
|
||||
<span className="admin-field-label">运行状态</span>
|
||||
<div className="admin-offset-top-sm">
|
||||
<CapabilityStatusControl
|
||||
status={status}
|
||||
onChange={setStatus}
|
||||
disabled={mutation.isPending}
|
||||
/>
|
||||
</div>
|
||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
||||
保存后进入草稿,发布后生效。
|
||||
</Typography.Paragraph>
|
||||
<p className="admin-section-description admin-flush">保存后进入草稿,发布后生效。</p>
|
||||
{status === "disabled" && capability.disablePolicy ? (
|
||||
<Typography.Paragraph type="warning" style={{ marginBottom: 0 }}>
|
||||
<p className="admin-section-description admin-flush admin-text-warning">
|
||||
{disablePolicyLabels[capability.disablePolicy]}
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
{capability.configFields?.length ? (
|
||||
<div>
|
||||
<Typography.Text strong>能力设置</Typography.Text>
|
||||
<div style={{ display: "grid", gap: 12, marginTop: 8 }}>
|
||||
<span className="admin-field-label">能力设置</span>
|
||||
<div className="admin-field-stack admin-offset-top-sm">
|
||||
{capability.configFields.map((field) => (
|
||||
<div key={field.key}>
|
||||
<Typography.Text>{field.label}</Typography.Text>
|
||||
<span className="admin-field-label">{field.label}</span>
|
||||
{field.input === "switch" ? (
|
||||
<div>
|
||||
<Switch
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Segmented, Space, Switch, Tag, Typography } from "antd";
|
||||
import { Segmented, Space, Switch, Typography } from "antd";
|
||||
import type { CapabilityStatus } from "../types.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
import type { StatusTone } from "../../../components/StatusTag.js";
|
||||
|
||||
const statusLabels: Record<CapabilityStatus, string> = {
|
||||
enabled: "启用",
|
||||
@@ -7,14 +9,14 @@ const statusLabels: Record<CapabilityStatus, string> = {
|
||||
degraded: "降级",
|
||||
};
|
||||
|
||||
const statusColors: Record<CapabilityStatus, string> = {
|
||||
enabled: "green",
|
||||
disabled: "default",
|
||||
degraded: "orange",
|
||||
const statusTones: Record<CapabilityStatus, StatusTone> = {
|
||||
enabled: "success",
|
||||
disabled: "neutral",
|
||||
degraded: "warning",
|
||||
};
|
||||
|
||||
export function CapabilityStatusTag({ status }: { status: CapabilityStatus }) {
|
||||
return <Tag color={statusColors[status]}>{statusLabels[status]}</Tag>;
|
||||
return <StatusTag tone={statusTones[status]} label={statusLabels[status]} />;
|
||||
}
|
||||
|
||||
export function CapabilityStatusControl({
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Card,
|
||||
Descriptions,
|
||||
Drawer,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
Tag,
|
||||
message,
|
||||
Input,
|
||||
} from "antd";
|
||||
import { Badge, Button, Descriptions, Drawer, Select, Space, Table, message, Input } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { AdminBooking, InquirySubmission } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { useState } from "react";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { ErrorNote } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import type { StatusTone } from "../../components/StatusTag.js";
|
||||
|
||||
const statuses = ["received", "contacting", "confirmed", "completed", "cancelled"] as const;
|
||||
const labels: Record<string, string> = {
|
||||
@@ -41,6 +34,20 @@ const inquiryLabels: Record<string, string> = {
|
||||
closed: "已关闭",
|
||||
};
|
||||
|
||||
const statusTones: Record<string, StatusTone> = {
|
||||
received: "info",
|
||||
new: "info",
|
||||
contacting: "warning",
|
||||
reviewing: "warning",
|
||||
confirmed: "success",
|
||||
replied: "success",
|
||||
qualified: "success",
|
||||
converted: "success",
|
||||
completed: "success",
|
||||
cancelled: "error",
|
||||
closed: "neutral",
|
||||
};
|
||||
|
||||
export function InquiriesPage() {
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -94,117 +101,119 @@ export function InquiriesPage() {
|
||||
onError: (error) => message.error(error instanceof Error ? error.message : "更新失败,请重试"),
|
||||
});
|
||||
return (
|
||||
<Card
|
||||
title="咨询记录"
|
||||
extra={
|
||||
<Space>
|
||||
<Select
|
||||
allowClear
|
||||
placeholder="全部状态"
|
||||
style={{ width: 130 }}
|
||||
value={status}
|
||||
onChange={setStatus}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Badge
|
||||
count={
|
||||
query.data?.filter((item) => !(item as AdminBooking & { isRead?: boolean }).isRead)
|
||||
.length ?? 0
|
||||
}
|
||||
showZero
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
rowKey="id"
|
||||
loading={query.isLoading}
|
||||
dataSource={query.data ?? []}
|
||||
columns={[
|
||||
{
|
||||
title: "编号",
|
||||
dataIndex: "bookingNo",
|
||||
render: (value: string, item: AdminBooking) => (
|
||||
<Button type="link" onClick={() => setSelectedId(item.id)}>
|
||||
{value}
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
{ title: "联系人", dataIndex: "customerName" },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: string) => <Tag>{labels[value] ?? value}</Tag>,
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: AdminBooking) => (
|
||||
<Space>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Button size="small" onClick={() => read.mutate(item.id)}>
|
||||
标记已读
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Drawer
|
||||
title="咨询详情"
|
||||
open={Boolean(selectedId)}
|
||||
onClose={() => setSelectedId(undefined)}
|
||||
loading={detail.isLoading}
|
||||
width={520}
|
||||
<>
|
||||
<AdminPageHeader title="咨询记录" description="查看访客提交的咨询和预约,并跟进处理进度。" />
|
||||
<AdminSection
|
||||
title="预约咨询"
|
||||
extra={
|
||||
<Space>
|
||||
<Select
|
||||
allowClear
|
||||
placeholder="全部状态"
|
||||
className="admin-field-w-md"
|
||||
value={status}
|
||||
onChange={setStatus}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Badge
|
||||
count={
|
||||
query.data?.filter((item) => !(item as AdminBooking & { isRead?: boolean }).isRead)
|
||||
.length ?? 0
|
||||
}
|
||||
showZero
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{detail.data && (
|
||||
<Descriptions column={1} bordered size="small">
|
||||
<Descriptions.Item label="编号">{detail.data.bookingNo}</Descriptions.Item>
|
||||
<Descriptions.Item label="联系人">{detail.data.customerName}</Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
{labels[detail.data.status] ?? detail.data.status}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="提交时间">
|
||||
{new Date(detail.data.createdAt).toLocaleString("zh-CN")}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="管理员备注">
|
||||
{detail.data.adminNote || "暂无"}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Drawer>
|
||||
<Card
|
||||
<Table
|
||||
rowKey="id"
|
||||
loading={query.isLoading}
|
||||
locale={{ emptyText: "还没有预约咨询。" }}
|
||||
dataSource={query.data ?? []}
|
||||
columns={[
|
||||
{
|
||||
title: "编号",
|
||||
dataIndex: "bookingNo",
|
||||
render: (value: string, item: AdminBooking) => (
|
||||
<Button type="link" onClick={() => setSelectedId(item.id)}>
|
||||
{value}
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
{ title: "联系人", dataIndex: "customerName" },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: string) => (
|
||||
<StatusTag tone={statusTones[value] ?? "neutral"} label={labels[value] ?? value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: AdminBooking) => (
|
||||
<Space>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Button type="link" size="small" onClick={() => read.mutate(item.id)}>
|
||||
标记已读
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Drawer
|
||||
title="咨询详情"
|
||||
open={Boolean(selectedId)}
|
||||
onClose={() => setSelectedId(undefined)}
|
||||
loading={detail.isLoading}
|
||||
width={520}
|
||||
>
|
||||
{detail.data && (
|
||||
<Descriptions column={1} bordered size="small">
|
||||
<Descriptions.Item label="编号">{detail.data.bookingNo}</Descriptions.Item>
|
||||
<Descriptions.Item label="联系人">{detail.data.customerName}</Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
{labels[detail.data.status] ?? detail.data.status}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="提交时间">
|
||||
{new Date(detail.data.createdAt).toLocaleString("zh-CN")}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="管理员备注">
|
||||
{detail.data.adminNote || "暂无"}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Drawer>
|
||||
</AdminSection>
|
||||
<AdminSection
|
||||
title={`动态咨询提交${submissions.data ? `(${submissions.data.length})` : ""}`}
|
||||
style={{ marginTop: 24 }}
|
||||
description="按模板表单提交的咨询记录,字段随表单配置变化。"
|
||||
extra={
|
||||
<Button onClick={() => void submissions.refetch()} loading={submissions.isFetching}>
|
||||
刷新提交记录
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{submissions.isError && (
|
||||
<Card type="inner" style={{ marginBottom: 16 }}>
|
||||
动态咨询提交加载失败:
|
||||
{submissions.error instanceof Error ? submissions.error.message : "未知错误"}
|
||||
<Button type="link" onClick={() => void submissions.refetch()}>
|
||||
重试
|
||||
</Button>
|
||||
</Card>
|
||||
)}
|
||||
<Space style={{ marginBottom: 12 }}>
|
||||
{submissions.isError ? (
|
||||
<ErrorNote error={submissions.error} onRetry={() => void submissions.refetch()} />
|
||||
) : null}
|
||||
<Space
|
||||
className={`admin-offset-bottom-sm ${submissions.isError ? "admin-offset-top" : ""}`}
|
||||
>
|
||||
<Select
|
||||
allowClear
|
||||
placeholder="动态咨询状态"
|
||||
style={{ width: 140 }}
|
||||
className="admin-field-w-md"
|
||||
value={submissionStatus}
|
||||
onChange={setSubmissionStatus}
|
||||
options={inquiryStatuses.map((value) => ({ value, label: inquiryLabels[value] }))}
|
||||
@@ -228,7 +237,10 @@ export function InquiriesPage() {
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: InquirySubmission["status"]) => (
|
||||
<Tag>{inquiryLabels[value] ?? value}</Tag>
|
||||
<StatusTag
|
||||
tone={statusTones[value] ?? "neutral"}
|
||||
label={inquiryLabels[value] ?? value}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "版本", dataIndex: "formVersion", render: (value) => `v${value}` },
|
||||
@@ -251,7 +263,7 @@ export function InquiriesPage() {
|
||||
title: "跟进",
|
||||
render: (_: unknown, item: InquirySubmission) => (
|
||||
<Space>
|
||||
<Button size="small" onClick={() => setSelectedSubmission(item)}>
|
||||
<Button type="link" size="small" onClick={() => setSelectedSubmission(item)}>
|
||||
查看
|
||||
</Button>
|
||||
<Select
|
||||
@@ -314,7 +326,7 @@ export function InquiriesPage() {
|
||||
</Descriptions>
|
||||
)}
|
||||
</Drawer>
|
||||
</Card>
|
||||
</Card>
|
||||
</AdminSection>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Button, Card, Col, List, Progress, Row, Space, Statistic, Tag, Typography } from "antd";
|
||||
import { Button, Card, Col, Progress, Row, Typography } from "antd";
|
||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
import { MetricCard } from "../../components/MetricCard.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
|
||||
export function OverviewPage() {
|
||||
const navigate = useNavigate();
|
||||
@@ -82,41 +84,32 @@ export function OverviewPage() {
|
||||
title="品牌概览"
|
||||
description="从这里检查品牌表达、信任内容和业务承接是否完整。"
|
||||
/>
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<div className="admin-stack">
|
||||
<Card>
|
||||
<Typography.Title level={3} style={{ marginTop: 0 }}>
|
||||
{brand?.name || "未命名品牌"}
|
||||
</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
{brand?.tagline || "还没有设置一句话定位"}
|
||||
</Typography.Paragraph>
|
||||
<Tag color="blue">
|
||||
当前模板:{workspace?.templateContent?.displayName ?? "尚未安装模板"}
|
||||
</Tag>
|
||||
<h2 className="admin-brand-title">{brand?.name || "未命名品牌"}</h2>
|
||||
<p className="admin-brand-tagline">{brand?.tagline || "还没有设置一句话定位"}</p>
|
||||
<StatusTag
|
||||
tone="info"
|
||||
label={`当前模板:${workspace?.templateContent?.displayName ?? "尚未安装模板"}`}
|
||||
/>
|
||||
</Card>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col xs={24} sm={12} lg={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="信任证明"
|
||||
value={trust?.filter((item) => item.isPublished).length ?? 0}
|
||||
suffix="条已发布"
|
||||
/>
|
||||
</Card>
|
||||
<Col xs={24} sm={8}>
|
||||
<MetricCard
|
||||
label="信任证明"
|
||||
value={trust?.filter((item) => item.isPublished).length ?? 0}
|
||||
suffix="条已发布"
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} lg={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="业务展示内容"
|
||||
value={offerings?.filter((item) => item.isEnabled).length ?? 0}
|
||||
suffix="项公开"
|
||||
/>
|
||||
</Card>
|
||||
<Col xs={24} sm={8}>
|
||||
<MetricCard
|
||||
label="业务展示内容"
|
||||
value={offerings?.filter((item) => item.isEnabled).length ?? 0}
|
||||
suffix="项公开"
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} lg={6}>
|
||||
<Card>
|
||||
<Statistic title="咨询提交" value={submissions?.length ?? 0} suffix="条" />
|
||||
</Card>
|
||||
<Col xs={24} sm={8}>
|
||||
<MetricCard label="咨询提交" value={submissions?.length ?? 0} suffix="条" />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={[16, 16]}>
|
||||
@@ -139,57 +132,51 @@ export function OverviewPage() {
|
||||
: `还有 ${incompleteChecks.length} 项需要完善,完成后才能发布。`}
|
||||
</Typography.Paragraph>
|
||||
{incompleteChecks.length > 0 && (
|
||||
<List
|
||||
size="small"
|
||||
dataSource={incompleteChecks.slice(0, 4)}
|
||||
renderItem={(item) => (
|
||||
<List.Item
|
||||
actions={[
|
||||
<Button
|
||||
key={item.key}
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>,
|
||||
]}
|
||||
>
|
||||
{item.label}
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
<ul className="admin-list">
|
||||
{incompleteChecks.slice(0, 4).map((item) => (
|
||||
<li key={item.key} className="admin-row">
|
||||
<span className="admin-row-title">{item.label}</span>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</Card>
|
||||
</Col>
|
||||
<Col xs={24} lg={12}>
|
||||
<Card title="品牌内容检查">
|
||||
<List
|
||||
dataSource={checks}
|
||||
renderItem={(item) => (
|
||||
<List.Item>
|
||||
<Space>
|
||||
<Tag color={item.passed ? "success" : "default"}>
|
||||
{item.passed ? "已完成" : "待完善"}
|
||||
</Tag>
|
||||
<span>{item.label}</span>
|
||||
{!item.passed && (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
<ul className="admin-list">
|
||||
{checks.map((item) => (
|
||||
<li key={item.key} className="admin-row">
|
||||
<div className="admin-row-line">
|
||||
<StatusTag
|
||||
tone={item.passed ? "success" : "neutral"}
|
||||
label={item.passed ? "已完成" : "待完善"}
|
||||
/>
|
||||
<span className="admin-row-title">{item.label}</span>
|
||||
</div>
|
||||
{!item.passed ? (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Space>
|
||||
</div>
|
||||
</QueryState>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { Alert, Button, Card, Collapse, Flex, Space, Tag, Tooltip, Typography, theme } from "antd";
|
||||
import { LoadingOutlined } from "@ant-design/icons";
|
||||
import { Button, Card, Collapse, Flex, Space, Tooltip, Typography } from "antd";
|
||||
import type { MiniAppReleaseTask } from "@personal-brand/api-client";
|
||||
import { ErrorNote } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import type { StatusTone } from "../../components/StatusTag.js";
|
||||
|
||||
type ReleaseStatus = MiniAppReleaseTask["status"];
|
||||
|
||||
@@ -13,18 +15,18 @@ function isStaleBuilding(task: MiniAppReleaseTask): boolean {
|
||||
return !Number.isNaN(updatedAt) && Date.now() - updatedAt >= STALE_BUILDING_MS;
|
||||
}
|
||||
|
||||
const statusView: Record<ReleaseStatus, { label: string; color: string; hint: string }> = {
|
||||
built: { label: "待上传", color: "default", hint: "代码已构建,可上传到微信。" },
|
||||
uploaded: { label: "已上传微信", color: "blue", hint: "请在微信后台上传体验版并提交审核。" },
|
||||
const statusView: Record<ReleaseStatus, { label: string; tone: StatusTone; hint: string }> = {
|
||||
built: { label: "待上传", tone: "neutral", hint: "代码已构建,可上传到微信。" },
|
||||
uploaded: { label: "已上传微信", tone: "info", hint: "请在微信后台上传体验版并提交审核。" },
|
||||
under_review: {
|
||||
label: "审核中",
|
||||
color: "processing",
|
||||
tone: "warning",
|
||||
hint: "等待微信审核结果,通过后回到本页标记。",
|
||||
},
|
||||
approved: { label: "审核通过", color: "cyan", hint: "审核已通过,确认无误后标记为已发布。" },
|
||||
published: { label: "已发布", color: "green", hint: "该版本已发布,可继续编辑内容后再次上传。" },
|
||||
rejected: { label: "已驳回", color: "volcano", hint: "微信驳回后需修改内容并重新构建上传。" },
|
||||
failed: { label: "失败", color: "red", hint: "上次构建或上传失败,可直接重试。" },
|
||||
approved: { label: "审核通过", tone: "success", hint: "审核已通过,确认无误后标记为已发布。" },
|
||||
published: { label: "已发布", tone: "success", hint: "该版本已发布,可继续编辑内容后再次上传。" },
|
||||
rejected: { label: "已驳回", tone: "error", hint: "微信驳回后需修改内容并重新构建上传。" },
|
||||
failed: { label: "失败", tone: "error", hint: "上次构建或上传失败,可直接重试。" },
|
||||
};
|
||||
|
||||
function formatTime(value: string): string {
|
||||
@@ -50,7 +52,6 @@ export function MiniAppReleaseCard({
|
||||
onUpload: () => void;
|
||||
onStatusChange: (status: ReleaseStatus) => void;
|
||||
}) {
|
||||
const { token } = theme.useToken();
|
||||
const logRef = useRef<HTMLPreElement>(null);
|
||||
const logs = task.buildLogs ?? [];
|
||||
const status = statusView[task.status];
|
||||
@@ -104,72 +105,49 @@ export function MiniAppReleaseCard({
|
||||
<Space direction="vertical" size={4}>
|
||||
<Space wrap size={8} align="center">
|
||||
<Typography.Text strong>品牌内容 v{task.version}</Typography.Text>
|
||||
<Tag color={status.color}>{status.label}</Tag>
|
||||
<StatusTag label={status.label} tone={status.tone} />
|
||||
{building && (
|
||||
<Tag icon={<LoadingOutlined />} color="orange">
|
||||
{staleBuilding ? "构建已中断" : "构建中"}
|
||||
</Tag>
|
||||
<StatusTag tone="warning" label={staleBuilding ? "构建已中断" : "构建中"} />
|
||||
)}
|
||||
{task.weappUploadId && (
|
||||
<Typography.Text type="secondary">微信版本 {task.weappUploadId}</Typography.Text>
|
||||
)}
|
||||
</Space>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
<span className="admin-text-xs">
|
||||
{staleBuilding ? "超过 15 分钟没有新的构建输出,可能已中断;可直接重试。" : status.hint}
|
||||
</Typography.Text>
|
||||
</span>
|
||||
<Tooltip title={`创建于 ${formatTime(task.createdAt)}`}>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
更新于 {formatTime(task.updatedAt)}
|
||||
</Typography.Text>
|
||||
<span className="admin-text-xs-quiet">更新于 {formatTime(task.updatedAt)}</span>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
{actions}
|
||||
</Flex>
|
||||
|
||||
{task.error && <Alert type="error" showIcon message={task.error} style={{ marginTop: 12 }} />}
|
||||
{task.error && (
|
||||
<div className="admin-offset-top-md">
|
||||
<ErrorNote error={new Error(task.error)} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{logs.length > 0 && (
|
||||
<Collapse
|
||||
ghost
|
||||
size="small"
|
||||
style={{ marginTop: 8 }}
|
||||
className="admin-offset-top-sm"
|
||||
{...(building || task.buildStatus === "failed" ? { defaultActiveKey: ["logs"] } : {})}
|
||||
items={[
|
||||
{
|
||||
key: "logs",
|
||||
label: (
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
构建日志({logs.length} 行)
|
||||
</Typography.Text>
|
||||
),
|
||||
label: <span className="admin-text-xs">构建日志({logs.length} 行)</span>,
|
||||
children: (
|
||||
<pre
|
||||
ref={logRef}
|
||||
style={{
|
||||
margin: 0,
|
||||
padding: 12,
|
||||
maxHeight: 220,
|
||||
overflow: "auto",
|
||||
fontSize: 12,
|
||||
lineHeight: 1.7,
|
||||
borderRadius: token.borderRadius,
|
||||
border: `1px solid ${token.colorBorderSecondary}`,
|
||||
background: token.colorFillQuaternary,
|
||||
}}
|
||||
>
|
||||
<pre ref={logRef} className="admin-log">
|
||||
{logs.map((log, index) => (
|
||||
<div
|
||||
key={`${log.at}-${index}`}
|
||||
style={{
|
||||
color:
|
||||
log.stream === "stderr" ? token.colorError : token.colorTextSecondary,
|
||||
whiteSpace: "pre-wrap",
|
||||
wordBreak: "break-all",
|
||||
}}
|
||||
className="admin-log__line"
|
||||
data-stream={log.stream}
|
||||
>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
{formatLogTime(log.at)}
|
||||
</Typography.Text>
|
||||
<span className="admin-log__time">{formatLogTime(log.at)}</span>
|
||||
{" "}
|
||||
{log.message}
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
Divider,
|
||||
Empty,
|
||||
Input,
|
||||
@@ -13,7 +12,6 @@ import {
|
||||
Select,
|
||||
Space,
|
||||
Spin,
|
||||
Tag,
|
||||
Tabs,
|
||||
Typography,
|
||||
message,
|
||||
@@ -21,7 +19,9 @@ import {
|
||||
import type { BrandTemplateKey } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { ErrorNote, MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { StatusTag, statusLabel } from "../../components/StatusTag.js";
|
||||
import { MiniAppReleaseCard } from "./MiniAppReleaseCard.js";
|
||||
|
||||
const client = createApiClient();
|
||||
@@ -268,17 +268,16 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
|
||||
const contentTab = null;
|
||||
const miniAppSettingsTab = (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<Card title="小程序上传配置">
|
||||
<Typography.Paragraph type="secondary">
|
||||
AppID 用于服务端调用微信官方上传工具;上传私钥保存前会使用 AES-256-GCM
|
||||
加密。小程序产物目录由系统构建流程决定,不需要手动修改。
|
||||
</Typography.Paragraph>
|
||||
<div className="admin-stack admin-stack-lg">
|
||||
<AdminSection
|
||||
title="小程序上传配置"
|
||||
description="AppID 用于服务端调用微信官方上传工具;上传私钥保存前会使用 AES-256-GCM 加密。"
|
||||
>
|
||||
{miniAppSettings.data?.buildError ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
style={{ marginBottom: 12 }}
|
||||
className="admin-offset-bottom"
|
||||
message="小程序构建参数未就绪"
|
||||
description={miniAppSettings.data.buildError}
|
||||
/>
|
||||
@@ -286,7 +285,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 12 }}
|
||||
className="admin-offset-bottom"
|
||||
message={`请求域名 ${miniAppSettings.data?.requestDomain ?? "未确认"}`}
|
||||
description="该域名在构建时写入小程序包,必须与微信后台“开发设置 → 服务器域名 → request 合法域名”一致;不一致会导致小程序打开即加载失败。"
|
||||
/>
|
||||
@@ -337,7 +336,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
autoComplete="off"
|
||||
spellCheck={false}
|
||||
placeholder={"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"}
|
||||
style={{ fontFamily: "monospace", fontSize: 12 }}
|
||||
className="admin-code-input"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Space>
|
||||
@@ -345,15 +344,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
保存上传配置
|
||||
</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<Tag color="green">已加密保存上传凭据</Tag>
|
||||
<StatusTag tone="success" label="已加密保存上传凭据" />
|
||||
) : (
|
||||
<Tag color="warning">未配置上传私钥</Tag>
|
||||
<StatusTag tone="warning" label="未配置上传私钥" />
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={saveMiniAppSettings.error} />
|
||||
</Form>
|
||||
</Card>
|
||||
</Space>
|
||||
</AdminSection>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -380,13 +379,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
]}
|
||||
/>
|
||||
{activeTab === "content" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>1. 选择表达方式</Typography.Title>
|
||||
<div className="admin-stack">
|
||||
<AdminSection
|
||||
title="选择表达方式"
|
||||
description="行业模板决定内容结构,视觉模板决定小程序的排版风格。"
|
||||
>
|
||||
<Space wrap>
|
||||
<Select
|
||||
aria-label="行业模板"
|
||||
style={{ width: 220 }}
|
||||
className="admin-field-w-xl"
|
||||
value={industryKey}
|
||||
disabled={!canManageTemplate || Boolean(workspace.data?.installations.length)}
|
||||
options={(catalog.data?.industries ?? []).map((item) => ({
|
||||
@@ -397,7 +398,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
/>
|
||||
<Select
|
||||
aria-label="视觉模板"
|
||||
style={{ width: 220 }}
|
||||
className="admin-field-w-xl"
|
||||
value={visualKey}
|
||||
disabled={!canManageTemplate}
|
||||
loading={selectVisual.isPending}
|
||||
@@ -409,19 +410,20 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
)}
|
||||
</Space>
|
||||
{workspace.data?.installations.length ? (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
<p className="admin-section-description admin-offset-top-sm">
|
||||
当前品牌已安装主模板。模板版本与升级在高级设置中管理。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
) : null}
|
||||
<MutationError error={install.error || selectVisual.error} />
|
||||
<Divider />
|
||||
<Divider className="admin-divider" />
|
||||
<Space wrap>
|
||||
<Typography.Text>示例内容</Typography.Text>
|
||||
{sample.isLoading && <Spin size="small" />}
|
||||
{sample.data && (
|
||||
<Tag color={sample.data.alreadyImported ? "green" : "blue"}>
|
||||
{sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||
</Tag>
|
||||
<StatusTag
|
||||
tone={sample.data.alreadyImported ? "success" : "info"}
|
||||
label={sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
||||
@@ -433,60 +435,106 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
{sample.isError && <Button onClick={() => void sample.refetch()}>重试</Button>}
|
||||
</Space>
|
||||
{sample.isError && (
|
||||
<Alert
|
||||
type="error"
|
||||
message={sample.error instanceof Error ? sample.error.message : "示例内容加载失败"}
|
||||
showIcon
|
||||
style={{ marginTop: 8 }}
|
||||
/>
|
||||
<div className="admin-offset-top-sm">
|
||||
<ErrorNote error={sample.error} onRetry={() => void sample.refetch()} />
|
||||
</div>
|
||||
)}
|
||||
{sample.data && !sample.data.alreadyImported && (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
<p className="admin-section-description admin-offset-top-sm">
|
||||
将向草稿添加{" "}
|
||||
{Object.entries(sample.data.counts)
|
||||
.map(([key, count]) => `${key} ${count} 项`)
|
||||
.join("、")}
|
||||
;发布前请替换示例文案和图片。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
)}
|
||||
<MutationError error={importSample.error} />
|
||||
</section>
|
||||
</Space>
|
||||
)}
|
||||
{activeTab === "content" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>3. 检查并发布</Typography.Title>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Tag color={currentRelease ? "green" : "default"}>
|
||||
{currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||
</Tag>
|
||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||
</AdminSection>
|
||||
<AdminSection
|
||||
title="核对草稿内容"
|
||||
description="此处核对的是待发布内容,不是小程序视觉预览。"
|
||||
>
|
||||
<ul className="admin-list">
|
||||
<li className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">{brand.data?.name || "未命名品牌"}</span>
|
||||
<span className="admin-row-meta">
|
||||
{brand.data?.tagline || "尚未填写品牌定位"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">已启用业务项</span>
|
||||
<span className="admin-row-meta">
|
||||
{draftOfferings.map((item) => item.name).join("、") || "无"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">已启用咨询表单</span>
|
||||
<span className="admin-row-meta">
|
||||
{draftForms
|
||||
.filter((item) => item.isEnabled)
|
||||
.map((item) => item.name)
|
||||
.join("、") || "无"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<Space wrap className="admin-offset-top">
|
||||
<Button onClick={() => navigate("/admin/brand")}>编辑小程序页面</Button>
|
||||
<Button onClick={() => navigate("/admin/services")}>编辑业务展示和详情</Button>
|
||||
<Button onClick={() => navigate("/admin/trust")}>编辑信任证明</Button>
|
||||
</Space>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
</AdminSection>
|
||||
<AdminSection
|
||||
title="检查并发布"
|
||||
extra={
|
||||
<Space wrap>
|
||||
<StatusTag
|
||||
tone={currentRelease ? "success" : "neutral"}
|
||||
label={currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||
/>
|
||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<ul className="admin-list">
|
||||
{(readiness.data?.checks ?? []).map((check) => (
|
||||
<Space key={check.key}>
|
||||
<Tag color={check.passed ? "success" : "warning"}>
|
||||
{check.passed ? "已完成" : "待完善"}
|
||||
</Tag>
|
||||
<Typography.Text>{check.label}</Typography.Text>
|
||||
{check.help ? (
|
||||
<Typography.Text type="secondary">{check.help}</Typography.Text>
|
||||
) : null}
|
||||
{!check.passed && (
|
||||
<li key={check.key} className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<StatusTag
|
||||
tone={check.passed ? "success" : "warning"}
|
||||
label={check.passed ? "已完成" : "待完善"}
|
||||
/>
|
||||
<span className="admin-row-title">{check.label}</span>
|
||||
{check.help ? <span className="admin-row-meta">{check.help}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
{!check.passed ? (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() =>
|
||||
navigate(check.destination ?? destinations[check.key] ?? "/admin/overview")
|
||||
}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</Space>
|
||||
<Space wrap style={{ marginTop: 16 }}>
|
||||
</ul>
|
||||
<Space wrap className="admin-offset-top">
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!readiness.data?.ready}
|
||||
@@ -501,85 +549,69 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={publish.error || revoke.error} />
|
||||
<Divider />
|
||||
<Typography.Title level={5}>发布记录</Typography.Title>
|
||||
<Divider className="admin-divider" />
|
||||
<h3 className="admin-section-title">发布记录</h3>
|
||||
{releases.data?.length ? (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<ul className="admin-list admin-offset-top-xs">
|
||||
{releases.data.map((item) => (
|
||||
<Space key={item.id} wrap>
|
||||
<Typography.Text>v{item.version}</Typography.Text>
|
||||
<Tag color={item.status === "published" ? "green" : "default"}>
|
||||
{item.status}
|
||||
</Tag>
|
||||
<Typography.Text type="secondary">
|
||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||
</Typography.Text>
|
||||
{item.note && <Typography.Text>{item.note}</Typography.Text>}
|
||||
{item.status === "superseded" && publishedHistory.length > 1 && (
|
||||
<Button size="small" onClick={() => setRollbackVersion(item.version)}>
|
||||
<li key={item.id} className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">v{item.version}</span>
|
||||
<StatusTag
|
||||
tone={item.status === "published" ? "success" : "neutral"}
|
||||
label={statusLabel(item.status)}
|
||||
/>
|
||||
<span className="admin-row-meta">
|
||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||
</span>
|
||||
{item.note ? <span className="admin-row-meta">{item.note}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
{item.status === "superseded" && publishedHistory.length > 1 ? (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => setRollbackVersion(item.version)}
|
||||
>
|
||||
恢复此版本
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</Space>
|
||||
</ul>
|
||||
) : (
|
||||
<Empty description="暂无发布记录" />
|
||||
<Empty description="暂无发布记录" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
)}
|
||||
<MutationError error={rollback.error} />
|
||||
</section>
|
||||
<section>
|
||||
<Typography.Title level={4}>2. 核对草稿内容</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
此处核对的是待发布内容,不是小程序视觉预览。
|
||||
</Typography.Paragraph>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>{brand.data?.name || "未命名品牌"}</Typography.Text>
|
||||
<Typography.Text>{brand.data?.tagline || "尚未填写品牌定位"}</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用业务项:{draftOfferings.map((item) => item.name).join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用咨询表单:
|
||||
{draftForms
|
||||
.filter((item) => item.isEnabled)
|
||||
.map((item) => item.name)
|
||||
.join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Space wrap>
|
||||
<Button onClick={() => navigate("/admin/brand")}>编辑小程序页面</Button>
|
||||
<Button onClick={() => navigate("/admin/services")}>编辑业务展示和详情</Button>
|
||||
<Button onClick={() => navigate("/admin/trust")}>编辑信任证明</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</section>
|
||||
</Space>
|
||||
</AdminSection>
|
||||
</div>
|
||||
)}
|
||||
{activeTab === "miniapp" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>小程序代码发布</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
使用微信官方 miniprogram-ci 上传代码;审核与发布状态需按微信平台结果人工确认。
|
||||
</Typography.Paragraph>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!currentRelease}
|
||||
loading={uploadLatestMiniAppRelease.isPending}
|
||||
onClick={() => uploadLatestMiniAppRelease.mutate()}
|
||||
>
|
||||
上传当前版本到微信
|
||||
</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<Tag color="green">已配置上传凭据</Tag>
|
||||
) : (
|
||||
<Tag color="warning">未配置上传凭据</Tag>
|
||||
)}
|
||||
</Space>
|
||||
<Divider />
|
||||
<div className="admin-stack admin-stack-lg">
|
||||
<AdminSection
|
||||
title="小程序代码发布"
|
||||
description="使用微信官方工具上传代码;审核与发布状态需按微信平台结果人工确认。"
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!currentRelease}
|
||||
loading={uploadLatestMiniAppRelease.isPending}
|
||||
onClick={() => uploadLatestMiniAppRelease.mutate()}
|
||||
>
|
||||
上传当前版本到微信
|
||||
</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<StatusTag tone="success" label="已配置上传凭据" />
|
||||
) : (
|
||||
<StatusTag tone="warning" label="未配置上传凭据" />
|
||||
)}
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{miniAppReleases.data?.length ? (
|
||||
<Space direction="vertical" size={12} style={{ width: "100%" }}>
|
||||
<div className="admin-stack admin-stack-tight">
|
||||
{miniAppReleases.data.map((task) => (
|
||||
<MiniAppReleaseCard
|
||||
key={task.id}
|
||||
@@ -589,12 +621,12 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
onStatusChange={(status) => updateMiniAppStatus.mutate({ id: task.id, status })}
|
||||
/>
|
||||
))}
|
||||
</Space>
|
||||
</div>
|
||||
) : (
|
||||
<Empty description="暂无小程序发布任务" />
|
||||
<Empty description="暂无小程序发布任务" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
)}
|
||||
</section>
|
||||
</Space>
|
||||
</AdminSection>
|
||||
</div>
|
||||
)}
|
||||
<Modal
|
||||
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
||||
@@ -611,7 +643,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
message="撤回后,小程序将显示品牌尚未发布,新的咨询和预约会停止受理。"
|
||||
/>
|
||||
) : (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<div className="admin-stack">
|
||||
<Typography.Text>当前草稿将成为品牌新的公开版本。</Typography.Text>
|
||||
<Input
|
||||
value={note}
|
||||
@@ -619,7 +651,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
placeholder="发布备注(可选)"
|
||||
maxLength={200}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
<Modal
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Button, Popconfirm, Space, Table, Tag, Typography } from "antd";
|
||||
import { Button, Popconfirm, Space, Table } from "antd";
|
||||
import type { Offering } from "@personal-brand/api-client";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { MutationError } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import type { useOfferingMutations } from "./use-offering-data.js";
|
||||
|
||||
type OfferingsTableProps = {
|
||||
@@ -36,22 +38,27 @@ export function OfferingsTable({
|
||||
{
|
||||
title: "业务类型",
|
||||
dataIndex: "kind",
|
||||
render: (value: unknown) => <Tag>{offeringKindLabels[String(value)] ?? String(value)}</Tag>,
|
||||
render: (value: unknown) => (
|
||||
<StatusTag tone="neutral" label={offeringKindLabels[String(value)] ?? String(value)} />
|
||||
),
|
||||
},
|
||||
{ title: "价格", dataIndex: "priceText" },
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "isEnabled",
|
||||
render: (value: boolean) => (value ? "已启用" : "已停用"),
|
||||
render: (value: boolean) => (
|
||||
<StatusTag tone={value ? "success" : "neutral"} label={value ? "已启用" : "已停用"} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: Offering) => (
|
||||
<Space>
|
||||
<Button size="small" onClick={() => onEdit(item)}>
|
||||
<Button type="link" size="small" onClick={() => onEdit(item)}>
|
||||
编辑详情
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
loading={toggleOffering.isPending && toggleOffering.variables?.id === item.id}
|
||||
onClick={() => toggleOffering.mutate({ id: item.id, isEnabled: !item.isEnabled })}
|
||||
@@ -66,6 +73,7 @@ export function OfferingsTable({
|
||||
cancelText="取消"
|
||||
>
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
size="small"
|
||||
loading={deleteOffering.isPending && deleteOffering.variables === item.id}
|
||||
@@ -79,20 +87,14 @@ export function OfferingsTable({
|
||||
];
|
||||
|
||||
return (
|
||||
<section aria-label="业务提供项列表">
|
||||
<Space wrap style={{ marginBottom: 16 }}>
|
||||
<Typography.Title level={5} style={{ margin: 0 }}>
|
||||
{pageLabel}中的内容
|
||||
</Typography.Title>
|
||||
<Tag color="blue">已启用的项目会公开展示</Tag>
|
||||
</Space>
|
||||
{detailSectionTitles.length ? (
|
||||
<Typography.Paragraph type="secondary">
|
||||
编辑单项详情时,附加字段将用于:
|
||||
{detailSectionTitles.join("、")}
|
||||
。列表中的名称、说明、价格和封面也会显示在业务展示页。
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
<AdminSection
|
||||
title={`${pageLabel}中的内容`}
|
||||
description={
|
||||
detailSectionTitles.length
|
||||
? `编辑单项详情时,附加字段将用于:${detailSectionTitles.join("、")}。列表中的名称、说明、价格和封面也会显示在业务展示页。`
|
||||
: "已启用的项目会公开展示。"
|
||||
}
|
||||
>
|
||||
<Table
|
||||
scroll={{ x: 760 }}
|
||||
rowKey="id"
|
||||
@@ -101,13 +103,13 @@ export function OfferingsTable({
|
||||
columns={columns}
|
||||
/>
|
||||
{items.length === 0 && (
|
||||
<Typography.Paragraph type="secondary">
|
||||
<p className="admin-empty-inline">
|
||||
还没有公开业务提供项。创建后,小程序服务页会优先读取这些内容。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
)}
|
||||
<MutationError error={saveError} />
|
||||
<MutationError error={toggleOffering.error} />
|
||||
<MutationError error={deleteOffering.error} />
|
||||
</section>
|
||||
</AdminSection>
|
||||
);
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 72vh;
|
||||
border: 1px solid #e5e7eb;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -47,8 +47,8 @@
|
||||
overflow-y: auto;
|
||||
padding: 20px 16px 24px;
|
||||
border-radius: 12px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e5e7eb;
|
||||
background: var(--admin-fill);
|
||||
border: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.service-offering-editor__form-scroll > .ant-typography:first-child {
|
||||
@@ -62,7 +62,7 @@
|
||||
.service-offering-editor__form-scroll .ant-typography h5.ant-typography {
|
||||
margin: 28px 0 4px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
border-bottom: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.service-offering-editor__form-scroll > .ant-typography-secondary {
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
Form,
|
||||
Input,
|
||||
Modal,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import { Alert, Button, Card, Form, Input, Modal, Select, Space, Table, message } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { AdminBrandMember } from "@personal-brand/api-client";
|
||||
import { useState } from "react";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
|
||||
const roleLabels: Record<string, string> = {
|
||||
owner: "负责人",
|
||||
@@ -81,9 +69,9 @@ export function MembersPage() {
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
className="admin-offset-bottom"
|
||||
message="请将初始账号和密码安全地交给成员"
|
||||
description="当前采用负责人手动添加方式;系统不会再次显示成员初始密码。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Table
|
||||
rowKey="id"
|
||||
@@ -127,9 +115,12 @@ export function MembersPage() {
|
||||
title: "说明",
|
||||
render: (_: unknown, item: AdminBrandMember) => (
|
||||
<Space>
|
||||
<Tag>{roleLabels[item.role] ?? item.role}</Tag>
|
||||
<StatusTag
|
||||
tone={item.role === "owner" ? "info" : "neutral"}
|
||||
label={roleLabels[item.role] ?? item.role}
|
||||
/>
|
||||
{!item.adminUser.isEnabled ? (
|
||||
<Typography.Text type="danger">账号已停用</Typography.Text>
|
||||
<StatusTag tone="warning" label="账号已停用" />
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Button, Divider, Form, Typography } from "antd";
|
||||
import { Button, Form } from "antd";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
import { TrustContentEditorModal } from "./components/TrustContentEditorModal.js";
|
||||
import { TrustContentTable } from "./components/TrustContentTable.js";
|
||||
@@ -61,29 +62,27 @@ export function TrustContentPage() {
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<section aria-labelledby="trust-requirements-title">
|
||||
<Typography.Title id="trust-requirements-title" level={5}>
|
||||
当前模板需要配置的内容
|
||||
</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
标记为“发布必填”的项目需要填写完整后,才能发布小程序。
|
||||
</Typography.Paragraph>
|
||||
<AdminSection
|
||||
title="当前模板需要配置的内容"
|
||||
description="标记为「发布必填」的项目需要填写完整后,才能发布小程序。"
|
||||
>
|
||||
<TrustRequirementsList
|
||||
availableTypes={availableTypes}
|
||||
contentByType={contentByType}
|
||||
items={query.data ?? []}
|
||||
onEdit={begin}
|
||||
/>
|
||||
</section>
|
||||
<Divider />
|
||||
<TrustContentTable
|
||||
availableTypes={availableTypes}
|
||||
items={query.data ?? []}
|
||||
removeError={remove.error}
|
||||
removePending={remove.isPending}
|
||||
onEdit={(item) => begin(item)}
|
||||
onDelete={(id) => remove.mutate(id)}
|
||||
/>
|
||||
</AdminSection>
|
||||
<AdminSection title="已配置的品牌内容">
|
||||
<TrustContentTable
|
||||
availableTypes={availableTypes}
|
||||
items={query.data ?? []}
|
||||
removeError={remove.error}
|
||||
removePending={remove.isPending}
|
||||
onEdit={(item) => begin(item)}
|
||||
onDelete={(id) => remove.mutate(id)}
|
||||
/>
|
||||
</AdminSection>
|
||||
<TrustContentEditorModal
|
||||
availableTypes={availableTypes}
|
||||
editing={editing}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Button, Popconfirm, Space, Table, Tag } from "antd";
|
||||
import { Button, Popconfirm, Space, Table } from "antd";
|
||||
import type { TrustContent } from "@personal-brand/api-client";
|
||||
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
||||
import { getTrustContentPreview } from "../domain/trust-content-domain.js";
|
||||
import { MutationError } from "../../../components/QueryState.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
|
||||
export function TrustContentTable({
|
||||
availableTypes,
|
||||
@@ -30,7 +31,10 @@ export function TrustContentTable({
|
||||
title: "内容类型",
|
||||
dataIndex: "type",
|
||||
render: (value) => (
|
||||
<Tag>{availableTypes.find((item) => item.type === value)?.label ?? value}</Tag>
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={availableTypes.find((item) => item.type === value)?.label ?? String(value)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "标题", dataIndex: "title" },
|
||||
@@ -47,14 +51,17 @@ export function TrustContentTable({
|
||||
title: "发布状态",
|
||||
dataIndex: "isPublished",
|
||||
render: (value) => (
|
||||
<Tag color={value ? "success" : "default"}>{value ? "随发布展示" : "草稿"}</Tag>
|
||||
<StatusTag
|
||||
tone={value ? "success" : "neutral"}
|
||||
label={value ? "随发布展示" : "草稿"}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: TrustContent) => (
|
||||
<Space>
|
||||
<Button size="small" onClick={() => onEdit(item)}>
|
||||
<Button type="link" size="small" onClick={() => onEdit(item)}>
|
||||
编辑
|
||||
</Button>
|
||||
<Popconfirm
|
||||
@@ -62,7 +69,7 @@ export function TrustContentTable({
|
||||
description="删除后需发布品牌,才会更新小程序展示。"
|
||||
onConfirm={() => onDelete(item.id)}
|
||||
>
|
||||
<Button size="small" danger loading={removePending}>
|
||||
<Button type="link" size="small" danger loading={removePending}>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Button, List, Space, Tag, Typography } from "antd";
|
||||
import { Button } from "antd";
|
||||
import { isTrustContentComplete } from "@personal-brand/api-client";
|
||||
import type { TrustContent } from "@personal-brand/api-client";
|
||||
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
|
||||
export function TrustRequirementsList({
|
||||
availableTypes,
|
||||
@@ -15,10 +16,8 @@ export function TrustRequirementsList({
|
||||
onEdit: (item?: TrustContent, type?: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<List
|
||||
size="small"
|
||||
dataSource={availableTypes}
|
||||
renderItem={(item) => {
|
||||
<ul className="admin-list">
|
||||
{availableTypes.map((item) => {
|
||||
const content = contentByType.get(item.type);
|
||||
const publishedCount = items.filter(
|
||||
(record) => record.type === item.type && record.isPublished,
|
||||
@@ -28,38 +27,41 @@ export function TrustRequirementsList({
|
||||
const complete = Boolean(content && isTrustContentComplete(content, item) && !tooMany);
|
||||
|
||||
return (
|
||||
<List.Item
|
||||
actions={[
|
||||
<Button
|
||||
key={item.type}
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => (content ? onEdit(content) : onEdit(undefined, item.type))}
|
||||
>
|
||||
{content ? "编辑" : "新增"}
|
||||
</Button>,
|
||||
]}
|
||||
>
|
||||
<Space wrap>
|
||||
<Typography.Text strong>{item.label}</Typography.Text>
|
||||
{item.required && <Tag color="orange">发布必填</Tag>}
|
||||
{(item.pages ?? []).map((page) => (
|
||||
<Tag key={page}>{page}</Tag>
|
||||
))}
|
||||
<Tag color={complete ? "success" : "default"}>
|
||||
{tooMany
|
||||
? `公开内容过多(${publishedCount} 条)`
|
||||
: complete
|
||||
? "内容完整"
|
||||
: content
|
||||
? "需要完善"
|
||||
: "尚未填写"}
|
||||
</Tag>
|
||||
{item.help && <Typography.Text type="secondary">{item.help}</Typography.Text>}
|
||||
</Space>
|
||||
</List.Item>
|
||||
<li key={item.type} className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">{item.label}</span>
|
||||
{item.required ? <StatusTag tone="warning" label="发布必填" /> : null}
|
||||
<StatusTag
|
||||
tone={tooMany ? "error" : complete ? "success" : "neutral"}
|
||||
label={
|
||||
tooMany
|
||||
? `公开内容过多(${publishedCount} 条)`
|
||||
: complete
|
||||
? "内容完整"
|
||||
: content
|
||||
? "需要完善"
|
||||
: "尚未填写"
|
||||
}
|
||||
/>
|
||||
{(item.pages ?? []).map((page) => (
|
||||
<span key={page} className="admin-row-meta">
|
||||
{page}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{item.help ? <p className="admin-row-help">{item.help}</p> : null}
|
||||
</div>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => (content ? onEdit(content) : onEdit(undefined, item.type))}
|
||||
>
|
||||
{content ? "编辑" : "新增"}
|
||||
</Button>
|
||||
</li>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Card, Form, Input, Modal, Select, Space, Table, Tag, Typography } from "antd";
|
||||
import { Button, Card, Form, Input, Modal, Select, Space, Table, Typography } from "antd";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { ApiClientError } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import { supportsIndustry, type IndustryTarget } from "./workspace-templates.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
|
||||
export const inquiryFieldTypes = [
|
||||
{ value: "text", label: "简短文字" },
|
||||
@@ -146,12 +147,12 @@ export function WorkspacePage() {
|
||||
}
|
||||
const { fields, installations } = query.data;
|
||||
return (
|
||||
<Space direction="vertical" size="large" style={{ width: "100%" }}>
|
||||
<div className="admin-stack admin-stack-lg">
|
||||
<AdminPageHeader
|
||||
title="模板与表单设置"
|
||||
description="日常小程序内容请从页面配置、业务展示和信任证明进入;这里主要管理模板、咨询入口和负责人设置。"
|
||||
/>
|
||||
<Card title="先完成日常配置" style={{ marginBottom: 24 }}>
|
||||
<Card title="先完成日常配置">
|
||||
<Typography.Paragraph type="secondary">
|
||||
下面这些入口面向日常经营,不需要理解模板或技术设置。完成后回到“配置与发布”统一检查并上线。
|
||||
</Typography.Paragraph>
|
||||
@@ -166,38 +167,45 @@ export function WorkspacePage() {
|
||||
</Card>
|
||||
<Card title="小程序当前状态" loading={runtimeQuery.isLoading}>
|
||||
{runtimeQuery.isError ? (
|
||||
<Typography.Text type="danger">公开运行时工作空间暂时无法加载。</Typography.Text>
|
||||
<StatusTag tone="error" label="公开运行时工作空间暂时无法加载" />
|
||||
) : (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<div className="admin-stack">
|
||||
<Space wrap>
|
||||
<Tag color="green">小程序数据已同步</Tag>
|
||||
<Tag>公开业务 {runtimeQuery.data?.offerings?.length ?? 0} 项</Tag>
|
||||
<Tag>已启用能力 {runtimeQuery.data?.capabilities?.length ?? 0} 项</Tag>
|
||||
<StatusTag tone="success" label="小程序数据已同步" />
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={`公开业务 ${runtimeQuery.data?.offerings?.length ?? 0} 项`}
|
||||
/>
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={`已启用能力 ${runtimeQuery.data?.capabilities?.length ?? 0} 项`}
|
||||
/>
|
||||
</Space>
|
||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
||||
<p className="admin-section-description admin-flush-top">
|
||||
小程序和后台预览会使用同一份已发布内容。这里的能力由当前模板自动提供,通常不需要手动调整。
|
||||
</Typography.Paragraph>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>已启用的服务能力</Typography.Text>
|
||||
</p>
|
||||
<div className="admin-stack">
|
||||
<h3 className="admin-section-title">已启用的服务能力</h3>
|
||||
{(runtimeQuery.data?.plugins ?? []).map((plugin) => (
|
||||
<Card key={plugin.key} size="small">
|
||||
<Space wrap>
|
||||
<Typography.Text strong>{plugin.displayName}</Typography.Text>
|
||||
<Tag color={plugin.status === "enabled" ? "green" : "orange"}>
|
||||
{plugin.status}
|
||||
</Tag>
|
||||
</Space>
|
||||
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">{plugin.displayName}</span>
|
||||
<StatusTag
|
||||
tone={plugin.status === "enabled" ? "success" : "warning"}
|
||||
label={plugin.status === "enabled" ? "已启用" : "未启用"}
|
||||
/>
|
||||
</div>
|
||||
<p className="admin-section-description admin-flush">
|
||||
这项能力已接入当前小程序流程,无需单独配置技术参数。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
</Card>
|
||||
))}
|
||||
{!runtimeQuery.data?.plugins?.length && (
|
||||
<Typography.Text type="secondary">当前模板未启用能力插件。</Typography.Text>
|
||||
<p className="admin-empty-inline">当前模板未启用能力插件。</p>
|
||||
)}
|
||||
</Space>
|
||||
</div>
|
||||
<Space wrap>
|
||||
<Typography.Text strong>视觉模板</Typography.Text>
|
||||
<span className="admin-field-label admin-flush">视觉模板</span>
|
||||
<Select
|
||||
value={runtimeQuery.data?.visualTemplate?.key}
|
||||
loading={visualTemplate.isPending}
|
||||
@@ -207,28 +215,33 @@ export function WorkspacePage() {
|
||||
]}
|
||||
/>
|
||||
{runtimeQuery.data?.visualTemplate && (
|
||||
<Tag>
|
||||
v{runtimeQuery.data.visualTemplate.version} ·{" "}
|
||||
{Object.values(runtimeQuery.data.visualTemplate.variants).join(" / ")}
|
||||
</Tag>
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={`v${runtimeQuery.data.visualTemplate.version} · ${Object.values(
|
||||
runtimeQuery.data.visualTemplate.variants,
|
||||
).join(" / ")}`}
|
||||
/>
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={visualTemplate.error} />
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>视觉模板切换历史</Typography.Text>
|
||||
<div className="admin-stack">
|
||||
<h3 className="admin-section-title">视觉模板切换历史</h3>
|
||||
{visualHistory.data?.history.length ? (
|
||||
visualHistory.data.history.map((item) => (
|
||||
<Tag key={`${item.visualTemplateKey}-${item.savedAt}`}>
|
||||
{item.visualTemplateKey} · {item.savedAt}
|
||||
</Tag>
|
||||
))
|
||||
<div className="admin-row-line">
|
||||
{visualHistory.data.history.map((item) => (
|
||||
<StatusTag
|
||||
key={`${item.visualTemplateKey}-${item.savedAt}`}
|
||||
tone="neutral"
|
||||
label={`${item.visualTemplateKey} · ${item.savedAt}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Typography.Text type="secondary">暂无历史版本</Typography.Text>
|
||||
<p className="admin-empty-inline">暂无历史版本</p>
|
||||
)}
|
||||
{visualHistory.data?.history.length ? (
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => rollbackVisual.mutate()}
|
||||
loading={rollbackVisual.isPending}
|
||||
>
|
||||
@@ -236,33 +249,33 @@ export function WorkspacePage() {
|
||||
</Button>
|
||||
) : null}
|
||||
<MutationError error={rollbackVisual.error} />
|
||||
</Space>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>可用视觉模板</Typography.Text>
|
||||
</div>
|
||||
<div className="admin-stack">
|
||||
<h3 className="admin-section-title">可用视觉模板</h3>
|
||||
<Space wrap>
|
||||
{compatibleVisuals.map((visual) => (
|
||||
<Card key={visual.key} size="small" style={{ width: 260 }}>
|
||||
<Typography.Text strong>{visual.name}</Typography.Text>
|
||||
<Typography.Paragraph type="secondary" ellipsis={{ rows: 2 }}>
|
||||
{visual.description}
|
||||
</Typography.Paragraph>
|
||||
<Space wrap>
|
||||
<Card key={visual.key} size="small" className="admin-visual-card">
|
||||
<span className="admin-row-title">{visual.name}</span>
|
||||
<p className="admin-row-summary">{visual.description}</p>
|
||||
<div className="admin-row-line">
|
||||
{Object.entries(visual.theme.colors).map(([name, color]) => (
|
||||
<Tag key={name} color={color.startsWith("#") ? "default" : "blue"}>
|
||||
<span
|
||||
key={name}
|
||||
className="admin-swatch"
|
||||
title={`${name} ${color}`}
|
||||
style={{ "--swatch-color": color } as React.CSSProperties}
|
||||
>
|
||||
{name}
|
||||
</Tag>
|
||||
</span>
|
||||
))}
|
||||
</Space>
|
||||
<Typography.Paragraph
|
||||
type="secondary"
|
||||
style={{ marginTop: 12, marginBottom: 0 }}
|
||||
>
|
||||
</div>
|
||||
<p className="admin-row-meta admin-flush">
|
||||
{Object.values(visual.variants).join(" / ")}
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
</Card>
|
||||
))}
|
||||
</Space>
|
||||
</Space>
|
||||
</div>
|
||||
<Modal
|
||||
title="确认切换视觉模板"
|
||||
open={visualTarget !== null}
|
||||
@@ -281,7 +294,7 @@ export function WorkspacePage() {
|
||||
只会替换视觉主题和模块变体,不会覆盖品牌内容、业务提供项或咨询记录。
|
||||
</Typography.Paragraph>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
<Card
|
||||
@@ -303,17 +316,20 @@ export function WorkspacePage() {
|
||||
<Typography.Paragraph type="secondary">
|
||||
模板只提供行业表达样例,不会替代你的品牌定位、经历、作品和合作方式。
|
||||
</Typography.Paragraph>
|
||||
<Tag>{installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}</Tag>
|
||||
<StatusTag
|
||||
tone={installations.length ? "info" : "neutral"}
|
||||
label={installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}
|
||||
/>
|
||||
{installations.length > 0 && (
|
||||
<Card size="small" style={{ marginTop: 16 }} title="模板版本">
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Card size="small" className="admin-offset-top" title="模板版本">
|
||||
<div className="admin-stack">
|
||||
<Typography.Text>
|
||||
当前版本:{templatePreview.data?.currentVersion ?? "加载中"},最新版本:
|
||||
{templatePreview.data?.latestVersion ?? "加载中"}
|
||||
</Typography.Text>
|
||||
{templatePreview.data?.canUpgrade ? (
|
||||
<>
|
||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
||||
<Typography.Paragraph type="secondary" className="admin-flush">
|
||||
可升级内容:新增 {templatePreview.data.missingModules.length} 个模块,新增{" "}
|
||||
{templatePreview.data.missingFields.length} 个字段。已有内容不会被覆盖。
|
||||
</Typography.Paragraph>
|
||||
@@ -326,7 +342,9 @@ export function WorkspacePage() {
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Tag color="green">已是最新版本</Tag>
|
||||
<div>
|
||||
<StatusTag tone="success" label="已是最新版本" />
|
||||
</div>
|
||||
)}
|
||||
{templatePreview.data?.canRollback && (
|
||||
<Button danger onClick={() => rollback.mutate()} loading={rollback.isPending}>
|
||||
@@ -336,7 +354,7 @@ export function WorkspacePage() {
|
||||
<MutationError error={templatePreview.error} />
|
||||
<MutationError error={upgrade.error} />
|
||||
<MutationError error={rollback.error} />
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
<MutationError error={install.error} />
|
||||
@@ -360,7 +378,6 @@ export function WorkspacePage() {
|
||||
</Modal>
|
||||
<Card
|
||||
title="模板组合预览"
|
||||
style={{ marginBottom: 24 }}
|
||||
extra={<Typography.Text type="secondary">高级预览</Typography.Text>}
|
||||
>
|
||||
<Typography.Paragraph type="secondary">
|
||||
@@ -384,19 +401,18 @@ export function WorkspacePage() {
|
||||
/>
|
||||
</Space>
|
||||
{combinationPreview.isLoading ? (
|
||||
<Card loading style={{ marginTop: 16 }} />
|
||||
<Card loading className="admin-offset-top" />
|
||||
) : combinationPreview.data ? (
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 16 }}>
|
||||
<div className="admin-stack admin-offset-top">
|
||||
<Typography.Text strong>
|
||||
{combinationPreview.data.industry.name} × {combinationPreview.data.visual.name}
|
||||
</Typography.Text>
|
||||
<Space wrap></Space>
|
||||
<Typography.Text type="secondary">
|
||||
能力:
|
||||
{combinationPreview.data.runtime.capabilities.map((item) => item.key).join("、") ||
|
||||
"无"}
|
||||
</Typography.Text>
|
||||
</Space>
|
||||
</div>
|
||||
) : null}
|
||||
</Card>
|
||||
<Card
|
||||
@@ -414,18 +430,29 @@ export function WorkspacePage() {
|
||||
locale={{ emptyText: "还没有咨询入口,点击右上角即可从默认表单开始。" }}
|
||||
columns={[
|
||||
{ title: "名称", dataIndex: "name" },
|
||||
{ title: "版本", dataIndex: "version", render: (value) => <Tag>v{value}</Tag> },
|
||||
{
|
||||
title: "版本",
|
||||
dataIndex: "version",
|
||||
render: (value) => <StatusTag tone="neutral" label={`v${value}`} />,
|
||||
},
|
||||
{
|
||||
title: "字段数",
|
||||
dataIndex: "fieldsSnapshot",
|
||||
render: (value: unknown[]) => value?.length ?? 0,
|
||||
},
|
||||
{ title: "状态", dataIndex: "isEnabled", render: (value) => (value ? "启用" : "停用") },
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "isEnabled",
|
||||
render: (value: boolean) => (
|
||||
<StatusTag tone={value ? "success" : "neutral"} label={value ? "启用" : "停用"} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: InquiryForm) => (
|
||||
<Space>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
setEditingForm(item);
|
||||
@@ -637,7 +664,7 @@ export function WorkspacePage() {
|
||||
>
|
||||
<Input placeholder="例如:预约上门测量、家庭聚餐预订" />
|
||||
</Form.Item>
|
||||
<Space style={{ display: "flex" }} align="start">
|
||||
<div className="admin-form-row">
|
||||
<Form.Item
|
||||
name="purpose"
|
||||
label="客户要做什么"
|
||||
@@ -645,7 +672,7 @@ export function WorkspacePage() {
|
||||
initialValue="inquiry"
|
||||
>
|
||||
<Select
|
||||
style={{ width: 160 }}
|
||||
className="admin-field-w-lg"
|
||||
options={[
|
||||
{ value: "inquiry", label: "需求咨询" },
|
||||
{ value: "quote-request", label: "获取报价" },
|
||||
@@ -656,7 +683,7 @@ export function WorkspacePage() {
|
||||
<Form.Item name="offeringId" label="关联哪项业务" help="不选择表示这是品牌通用入口。">
|
||||
<Select
|
||||
allowClear
|
||||
style={{ width: 220 }}
|
||||
className="admin-field-w-xl"
|
||||
placeholder="品牌级表单"
|
||||
options={(runtimeQuery.data?.offerings ?? []).map((item) => ({
|
||||
value: item.id,
|
||||
@@ -664,7 +691,7 @@ export function WorkspacePage() {
|
||||
}))}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Space>
|
||||
</div>
|
||||
<Form.List name="fieldsSnapshot">
|
||||
{(fields, { add, remove }) => (
|
||||
<>
|
||||
@@ -685,36 +712,36 @@ export function WorkspacePage() {
|
||||
</Button>
|
||||
</Form.Item>
|
||||
{fields.map(({ key, name, ...restField }) => (
|
||||
<Card key={key} size="small" style={{ marginBottom: 12 }}>
|
||||
<Card key={key} size="small" className="admin-offset-bottom-sm">
|
||||
<Form.Item {...restField} name={[name, "key"]} hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Space align="start" style={{ display: "flex" }}>
|
||||
<div className="admin-form-row">
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, "label"]}
|
||||
label="要询问客户什么"
|
||||
rules={[{ required: true, message: "请填写字段名称" }]}
|
||||
style={{ flex: 1 }}
|
||||
className="admin-flex-1"
|
||||
>
|
||||
<Input placeholder="例如:联系电话、预计预算、项目地址" />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "type"]} label="回答方式">
|
||||
<Select style={{ width: 150 }} options={inquiryFieldTypes} />
|
||||
<Select className="admin-field-w-md" options={inquiryFieldTypes} />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "required"]} label="必填">
|
||||
<Select
|
||||
style={{ width: 90 }}
|
||||
className="admin-field-w-sm"
|
||||
options={[
|
||||
{ value: true, label: "必填" },
|
||||
{ value: false, label: "选填" },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Button danger onClick={() => remove(name)} style={{ marginTop: 30 }}>
|
||||
<Button danger onClick={() => remove(name)} className="admin-field-offset">
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{({ getFieldValue }) =>
|
||||
["select", "radio", "multi-select"].includes(
|
||||
@@ -735,32 +762,28 @@ export function WorkspacePage() {
|
||||
{(optionFields, { add, remove }, { errors }) => (
|
||||
<>
|
||||
{optionFields.map((optionField) => (
|
||||
<Space
|
||||
key={optionField.key}
|
||||
align="center"
|
||||
style={{ display: "flex" }}
|
||||
>
|
||||
<div key={optionField.key} className="admin-form-row-center">
|
||||
<Form.Item
|
||||
{...optionField}
|
||||
name={[optionField.name, "label"]}
|
||||
initialValue=""
|
||||
rules={[{ required: true, message: "请填写选项内容" }]}
|
||||
style={{ flex: 1, minWidth: 240, marginBottom: 8 }}
|
||||
className="admin-flex-1 admin-offset-bottom-xs"
|
||||
>
|
||||
<Input placeholder="例如:预算内" />
|
||||
</Form.Item>
|
||||
<Button
|
||||
danger
|
||||
onClick={() => remove(optionField.name)}
|
||||
style={{ marginBottom: 8 }}
|
||||
className="admin-offset-bottom-xs"
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
))}
|
||||
<Button
|
||||
onClick={() => add({ label: "", value: "" })}
|
||||
style={{ marginBottom: 8 }}
|
||||
className="admin-offset-bottom-xs"
|
||||
>
|
||||
新增选项
|
||||
</Button>
|
||||
@@ -778,6 +801,6 @@ export function WorkspacePage() {
|
||||
</Form.List>
|
||||
</Form>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user