2nd version
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>My Google AI Studio App</title>
|
||||
<title>Audi Rednote Mini App Backend</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
BIN
audi-content-portal/public/images/audi_logo.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
audi-content-portal/public/images/cars/a3-1.jpg
Normal file
|
After Width: | Height: | Size: 7.3 MiB |
BIN
audi-content-portal/public/images/cars/a3-2.jpg
Normal file
|
After Width: | Height: | Size: 7.3 MiB |
BIN
audi-content-portal/public/images/cars/a4-1.jpg
Normal file
|
After Width: | Height: | Size: 8.6 MiB |
BIN
audi-content-portal/public/images/cars/a4-2.jpg
Normal file
|
After Width: | Height: | Size: 531 KiB |
BIN
audi-content-portal/public/images/cars/a6-1.jpg
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
audi-content-portal/public/images/cars/a6-2.jpg
Normal file
|
After Width: | Height: | Size: 12 MiB |
BIN
audi-content-portal/public/images/cars/a7-1.jpg
Normal file
|
After Width: | Height: | Size: 316 KiB |
BIN
audi-content-portal/public/images/cars/a7-2.jpg
Normal file
|
After Width: | Height: | Size: 302 KiB |
BIN
audi-content-portal/public/images/cars/a7-3.jpg
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
audi-content-portal/public/images/cars/a7spb-侧身.png
Normal file
|
After Width: | Height: | Size: 933 KiB |
BIN
audi-content-portal/public/images/cars/a8-1.jpg
Normal file
|
After Width: | Height: | Size: 4.8 MiB |
BIN
audi-content-portal/public/images/cars/a8-2.jpg
Normal file
|
After Width: | Height: | Size: 4.8 MiB |
BIN
audi-content-portal/public/images/cars/q3-1.jpg
Normal file
|
After Width: | Height: | Size: 9.1 MiB |
BIN
audi-content-portal/public/images/cars/q3-2.jpg
Normal file
|
After Width: | Height: | Size: 9.1 MiB |
BIN
audi-content-portal/public/images/cars/q5-1.jpg
Normal file
|
After Width: | Height: | Size: 5.6 MiB |
BIN
audi-content-portal/public/images/cars/q5-2.jpg
Normal file
|
After Width: | Height: | Size: 5.6 MiB |
BIN
audi-content-portal/public/images/cars/rs7-1.jpg
Normal file
|
After Width: | Height: | Size: 389 KiB |
BIN
audi-content-portal/public/images/cars/rs7-2.jpg
Normal file
|
After Width: | Height: | Size: 473 KiB |
@@ -1,22 +1,14 @@
|
||||
import * as React from "react"
|
||||
import { SidebarProvider, SidebarInset, SidebarTrigger } from "@/components/ui/sidebar"
|
||||
import { AppSidebar } from "@/components/layout/AppSidebar"
|
||||
import { Dashboard } from "@/components/dashboard/Dashboard"
|
||||
import { CarLibrary } from "@/components/car-library/CarLibrary"
|
||||
import { MiniAppContentLibrary } from "@/components/content-library/MiniAppContentLibrary"
|
||||
import { LeadManagement } from "@/components/leads/LeadManagement"
|
||||
import { UserAccessManagement } from "@/components/users/UserAccessManagement"
|
||||
import { SystemSettings } from "@/components/settings/SystemSettings"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { Bell, Search, User } from "lucide-react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
type NewContentRequest = {
|
||||
sourceCarId: string
|
||||
sourceCarName: string
|
||||
requestId: string
|
||||
}
|
||||
|
||||
export type RoleView = "biz-market" | "content-ops" | "pm-ops"
|
||||
|
||||
export type WorkflowConfig = {
|
||||
@@ -24,14 +16,14 @@ export type WorkflowConfig = {
|
||||
allowRecall: boolean
|
||||
publishStrategy: "manual" | "scheduled"
|
||||
defaultPublishTime: string
|
||||
syncFrequency: "daily" | "weekly"
|
||||
syncFrequency: "weekly"
|
||||
syncExecutionTime: string
|
||||
retryCount: number
|
||||
manualConfirmSync: boolean
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const [activeTab, setActiveTab] = React.useState("dashboard")
|
||||
const [activeTab, setActiveTab] = React.useState("car-library")
|
||||
const [roleView, setRoleView] = React.useState<RoleView>("content-ops")
|
||||
const [workflowConfig, setWorkflowConfig] = React.useState<WorkflowConfig>({
|
||||
enablePrePublish: true,
|
||||
@@ -48,34 +40,20 @@ export default function App() {
|
||||
"业务/市场负责人批准 Audi Q5L 进入预发布(2026-04-10 15:45)",
|
||||
"内容运营专员发布 Audi A3 Sportback(2026-04-09 11:30)",
|
||||
])
|
||||
const [pendingNewContent, setPendingNewContent] = React.useState<NewContentRequest | null>(null)
|
||||
|
||||
const appendLog = (message: string) => {
|
||||
const now = new Date().toLocaleString("zh-CN", { hour12: false })
|
||||
setAuditLogs((prev) => [`${message}(${now})`, ...prev].slice(0, 12))
|
||||
}
|
||||
|
||||
const handleCreateContentFromCar = (sourceCarId: string, sourceCarName: string) => {
|
||||
setPendingNewContent({
|
||||
sourceCarId,
|
||||
sourceCarName,
|
||||
requestId: String(Date.now()),
|
||||
})
|
||||
appendLog(`内容运营专员基于官网 ${sourceCarName} 新建内容草稿`)
|
||||
setActiveTab("mini-content")
|
||||
}
|
||||
|
||||
const renderContent = () => {
|
||||
switch (activeTab) {
|
||||
case "dashboard":
|
||||
return <Dashboard />
|
||||
case "car-library":
|
||||
return (
|
||||
<CarLibrary
|
||||
roleView={roleView}
|
||||
workflowConfig={workflowConfig}
|
||||
onAddAuditLog={appendLog}
|
||||
onCreateContent={handleCreateContentFromCar}
|
||||
/>
|
||||
)
|
||||
case "mini-content":
|
||||
@@ -84,11 +62,9 @@ export default function App() {
|
||||
roleView={roleView}
|
||||
workflowConfig={workflowConfig}
|
||||
onAddAuditLog={appendLog}
|
||||
newContentRequest={pendingNewContent}
|
||||
newContentRequest={null}
|
||||
/>
|
||||
)
|
||||
case "leads":
|
||||
return <LeadManagement />
|
||||
case "user-access":
|
||||
return <UserAccessManagement />
|
||||
case "settings":
|
||||
@@ -102,7 +78,13 @@ export default function App() {
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return <Dashboard />
|
||||
return (
|
||||
<CarLibrary
|
||||
roleView={roleView}
|
||||
workflowConfig={workflowConfig}
|
||||
onAddAuditLog={appendLog}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,10 +97,8 @@ export default function App() {
|
||||
<Separator orientation="vertical" className="mr-2 h-4" />
|
||||
<div className="flex flex-1 items-center justify-between">
|
||||
<div className="text-sm font-medium text-muted-foreground">
|
||||
{activeTab === "dashboard" && "仪表盘"}
|
||||
{activeTab === "car-library" && "车型库"}
|
||||
{activeTab === "car-library" && "官网车型库"}
|
||||
{activeTab === "mini-content" && "小程序内容库"}
|
||||
{activeTab === "leads" && "潜客管理"}
|
||||
{activeTab === "user-access" && "用户与权限"}
|
||||
{activeTab === "settings" && "系统设置"}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import { AlertCircle, CheckCircle2, Clock, Filter, Plus, RefreshCw, Search } from "lucide-react"
|
||||
import { AlertCircle, CheckCircle2, ChevronLeft, ChevronRight, Clock, Eye, Pencil, RefreshCw, Search, X } from "lucide-react"
|
||||
|
||||
import type { RoleView, WorkflowConfig } from "@/App"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
@@ -21,10 +21,30 @@ type SyncStatus = "synced" | "pending" | "error"
|
||||
type SourceCar = {
|
||||
id: string
|
||||
name: string
|
||||
pageType: "车型页" | "活动页" | "专题页"
|
||||
title: string
|
||||
subtitle: string
|
||||
highlights: string
|
||||
description: string
|
||||
ctaText: string
|
||||
scheduledPublishAt: string
|
||||
officialTagline: string
|
||||
sourceUpdatedAt: string
|
||||
updatedBy: string
|
||||
syncStatus: SyncStatus
|
||||
imageCount: number
|
||||
imageUrls: string[]
|
||||
}
|
||||
|
||||
type SourceCarDraft = {
|
||||
pageType: "车型页" | "活动页" | "专题页"
|
||||
title: string
|
||||
subtitle: string
|
||||
highlights: string
|
||||
description: string
|
||||
ctaText: string
|
||||
scheduledPublishAt: string
|
||||
imageUrls: string[]
|
||||
}
|
||||
|
||||
type SyncLog = {
|
||||
@@ -38,46 +58,152 @@ type CarLibraryProps = {
|
||||
roleView: RoleView
|
||||
workflowConfig: WorkflowConfig
|
||||
onAddAuditLog: (message: string) => void
|
||||
onCreateContent?: (sourceCarId: string, sourceCarName: string) => void
|
||||
}
|
||||
|
||||
const SOURCE_CARS: SourceCar[] = [
|
||||
{
|
||||
id: "a3",
|
||||
name: "Audi A3 Sportback",
|
||||
pageType: "车型页",
|
||||
title: "Audi A3 Sportback",
|
||||
subtitle: "进取,不负期待",
|
||||
highlights: "数字座舱\n城市通勤\n智能互联",
|
||||
description: "适合城市用户的豪华紧凑车型,兼顾效率与智能体验。",
|
||||
ctaText: "立即预约试驾",
|
||||
scheduledPublishAt: "",
|
||||
officialTagline: "进取,不负期待",
|
||||
sourceUpdatedAt: "2026-04-11 09:30",
|
||||
updatedBy: "内容运营专员",
|
||||
syncStatus: "synced",
|
||||
imageCount: 8,
|
||||
imageCount: 2,
|
||||
imageUrls: [
|
||||
"/images/cars/a3-1.jpg",
|
||||
"/images/cars/a3-2.jpg",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "a4l",
|
||||
name: "Audi A4L",
|
||||
pageType: "车型页",
|
||||
title: "Audi A4L",
|
||||
subtitle: "做更强大的自己",
|
||||
highlights: "quattro\n商务舒适\n智能互联",
|
||||
description: "面向商务人群的主推内容版本,突出舒适与操控。",
|
||||
ctaText: "了解更多",
|
||||
scheduledPublishAt: "",
|
||||
officialTagline: "做更强大的自己",
|
||||
sourceUpdatedAt: "2026-04-11 09:30",
|
||||
updatedBy: "内容运营专员",
|
||||
syncStatus: "synced",
|
||||
imageCount: 6,
|
||||
imageCount: 1,
|
||||
imageUrls: [
|
||||
"/images/cars/a4-1.jpg",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "a6l",
|
||||
name: "Audi A6L",
|
||||
pageType: "车型页",
|
||||
title: "Audi A6L",
|
||||
subtitle: "懂你,更懂未来",
|
||||
highlights: "行政旗舰\n长轴空间\n智能辅助",
|
||||
description: "正在进行文案优化,待业务审核。",
|
||||
ctaText: "预约顾问回电",
|
||||
scheduledPublishAt: "",
|
||||
officialTagline: "懂你,更懂未来",
|
||||
sourceUpdatedAt: "2026-04-10 14:20",
|
||||
updatedBy: "内容运营专员",
|
||||
syncStatus: "pending",
|
||||
imageCount: 5,
|
||||
imageCount: 2,
|
||||
imageUrls: [
|
||||
"/images/cars/a6-1.jpg",
|
||||
"/images/cars/a6-2.jpg",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "q5l",
|
||||
name: "Audi Q5L",
|
||||
pageType: "车型页",
|
||||
title: "Audi Q5L",
|
||||
subtitle: "自由,由我定义",
|
||||
highlights: "四驱性能\n家庭空间\n全场景出行",
|
||||
description: "因权益文案与活动规则不一致,当前版本待修订。",
|
||||
ctaText: "预约试驾",
|
||||
scheduledPublishAt: "",
|
||||
officialTagline: "自由,由我定义",
|
||||
sourceUpdatedAt: "2026-04-10 09:15",
|
||||
updatedBy: "项目与运维负责人",
|
||||
syncStatus: "error",
|
||||
imageCount: 0,
|
||||
imageCount: 2,
|
||||
imageUrls: [
|
||||
"/images/cars/q5-1.jpg",
|
||||
"/images/cars/q5-2.jpg",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "q3",
|
||||
name: "Audi Q3",
|
||||
pageType: "车型页",
|
||||
title: "Audi Q3",
|
||||
subtitle: "活出生命的辽阔",
|
||||
highlights: "紧凑SUV\n智能互联\n都市通勤",
|
||||
description: "新建草稿,待进一步补充图文和活动权益信息。",
|
||||
ctaText: "预约试驾",
|
||||
scheduledPublishAt: "",
|
||||
officialTagline: "活出生命的辽阔",
|
||||
sourceUpdatedAt: "2026-04-10 17:30",
|
||||
updatedBy: "内容运营专员",
|
||||
syncStatus: "synced",
|
||||
imageCount: 2,
|
||||
imageUrls: [
|
||||
"/images/cars/q3-1.jpg",
|
||||
"/images/cars/q3-2.jpg",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "a8l",
|
||||
name: "Audi A8L",
|
||||
pageType: "车型页",
|
||||
title: "Audi A8L",
|
||||
subtitle: "旗舰格局,沉稳之选",
|
||||
highlights: "旗舰行政\n豪华座舱\n专属服务",
|
||||
description: "旗舰车型物料已完成本周核对。",
|
||||
ctaText: "预约专属顾问",
|
||||
scheduledPublishAt: "",
|
||||
officialTagline: "旗舰格局,沉稳之选",
|
||||
sourceUpdatedAt: "2026-04-10 16:20",
|
||||
updatedBy: "内容运营专员",
|
||||
syncStatus: "synced",
|
||||
imageCount: 2,
|
||||
imageUrls: [
|
||||
"/images/cars/a8-1.jpg",
|
||||
"/images/cars/a8-2.jpg",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rs7",
|
||||
name: "Audi RS7",
|
||||
pageType: "车型页",
|
||||
title: "Audi RS7 Performance",
|
||||
subtitle: "高性能美学,锋芒尽释",
|
||||
highlights: "V8双涡轮\nquattro四驱\nRS专属运动套件",
|
||||
description: "高性能车型内容新增,本周已补齐素材并进入巡检列表。",
|
||||
ctaText: "预约性能试驾",
|
||||
scheduledPublishAt: "",
|
||||
officialTagline: "高性能美学,锋芒尽释",
|
||||
sourceUpdatedAt: "2026-04-12 10:10",
|
||||
updatedBy: "内容运营专员",
|
||||
syncStatus: "pending",
|
||||
imageCount: 2,
|
||||
imageUrls: [
|
||||
"/images/cars/rs7-1.jpg",
|
||||
"/images/cars/rs7-2.jpg",
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
const INITIAL_LOGS: SyncLog[] = [
|
||||
{ id: "l1", time: "2026-04-11 09:30", status: "success", message: "同步成功:4 个车型,素材 19 张" },
|
||||
{ id: "l1", time: "2026-04-11 09:30", status: "success", message: "同步成功:7 个车型,素材 31 张" },
|
||||
{ id: "l2", time: "2026-04-10 09:15", status: "failed", message: "Audi Q5L 图片拉取失败:CDN 超时" },
|
||||
]
|
||||
|
||||
@@ -107,14 +233,53 @@ function nowString() {
|
||||
return new Date().toLocaleString("zh-CN", { hour12: false })
|
||||
}
|
||||
|
||||
export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps) {
|
||||
export function CarLibrary({ roleView, workflowConfig, onAddAuditLog }: CarLibraryProps) {
|
||||
const [sourceCars, setSourceCars] = React.useState<SourceCar[]>(SOURCE_CARS)
|
||||
const [query, setQuery] = React.useState("")
|
||||
const [isSyncing, setIsSyncing] = React.useState(false)
|
||||
const [progress, setProgress] = React.useState(0)
|
||||
const [syncLogs, setSyncLogs] = React.useState<SyncLog[]>(INITIAL_LOGS)
|
||||
const [previewCarId, setPreviewCarId] = React.useState<string | null>(null)
|
||||
const [previewImageIndex, setPreviewImageIndex] = React.useState(0)
|
||||
const [viewMode, setViewMode] = React.useState<"list" | "editor">("list")
|
||||
const [editingCarId, setEditingCarId] = React.useState<string | null>(null)
|
||||
const [editorDraft, setEditorDraft] = React.useState<SourceCarDraft | null>(null)
|
||||
const [newImageUrl, setNewImageUrl] = React.useState("")
|
||||
const initialDraftRef = React.useRef<SourceCarDraft | null>(null)
|
||||
const listPageSize = 7
|
||||
const listTotalPages = 10
|
||||
const listPage = 1
|
||||
|
||||
const filtered = sourceCars.filter((car) => car.name.toLowerCase().includes(query.toLowerCase()))
|
||||
const pagedCars = filtered.slice((listPage - 1) * listPageSize, listPage * listPageSize)
|
||||
const previewCar = sourceCars.find((car) => car.id === previewCarId) ?? null
|
||||
const previewImages = previewCar?.imageUrls ?? []
|
||||
const canEdit = roleView === "content-ops"
|
||||
|
||||
const isEditorDirty = React.useMemo(() => {
|
||||
if (!editorDraft || !initialDraftRef.current) return false
|
||||
return JSON.stringify(editorDraft) !== JSON.stringify(initialDraftRef.current)
|
||||
}, [editorDraft])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!previewCarId || previewImages.length === 0) return
|
||||
|
||||
const handleKeydown = (event: KeyboardEvent) => {
|
||||
if (event.key === "ArrowLeft") {
|
||||
setPreviewImageIndex((curr) => Math.max(curr - 1, 0))
|
||||
}
|
||||
if (event.key === "ArrowRight") {
|
||||
setPreviewImageIndex((curr) => Math.min(curr + 1, previewImages.length - 1))
|
||||
}
|
||||
if (event.key === "Escape") {
|
||||
setPreviewCarId(null)
|
||||
setPreviewImageIndex(0)
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("keydown", handleKeydown)
|
||||
return () => window.removeEventListener("keydown", handleKeydown)
|
||||
}, [previewCarId, previewImages.length])
|
||||
|
||||
const handleSync = () => {
|
||||
setIsSyncing(true)
|
||||
@@ -129,15 +294,16 @@ export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps)
|
||||
curr.map((car) => ({
|
||||
...car,
|
||||
sourceUpdatedAt: time,
|
||||
updatedBy: "内容运营专员",
|
||||
syncStatus: "synced",
|
||||
imageCount: car.imageCount || 4,
|
||||
imageCount: car.imageUrls.length || car.imageCount || 1,
|
||||
}))
|
||||
)
|
||||
setSyncLogs((curr) => [
|
||||
{ id: String(Date.now()), time, status: "success", message: "手动同步完成:4 个车型已更新" },
|
||||
{ id: String(Date.now()), time, status: "success", message: "本周人工周更完成:7 个车型素材已核对并更新" },
|
||||
...curr,
|
||||
])
|
||||
onAddAuditLog("内容运营专员执行官网车型同步")
|
||||
onAddAuditLog("内容运营专员执行 JV 官网人工周更")
|
||||
setTimeout(() => setIsSyncing(false), 300)
|
||||
return 100
|
||||
}
|
||||
@@ -154,21 +320,231 @@ export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps)
|
||||
)
|
||||
)
|
||||
setSourceCars((curr) =>
|
||||
curr.map((car) => (car.syncStatus === "error" ? { ...car, syncStatus: "synced", sourceUpdatedAt: time, imageCount: 4 } : car))
|
||||
curr.map((car) =>
|
||||
car.syncStatus === "error"
|
||||
? {
|
||||
...car,
|
||||
syncStatus: "synced",
|
||||
sourceUpdatedAt: time,
|
||||
imageCount: car.imageUrls.length || car.imageCount || 1,
|
||||
updatedBy: "项目与运维负责人",
|
||||
}
|
||||
: car
|
||||
)
|
||||
)
|
||||
onAddAuditLog("项目与运维负责人重试 JV 官网素材异常任务")
|
||||
}
|
||||
|
||||
const openEditor = (car: SourceCar) => {
|
||||
const draft: SourceCarDraft = {
|
||||
pageType: car.pageType,
|
||||
title: car.title,
|
||||
subtitle: car.subtitle,
|
||||
highlights: car.highlights,
|
||||
description: car.description,
|
||||
ctaText: car.ctaText,
|
||||
scheduledPublishAt: car.scheduledPublishAt,
|
||||
imageUrls: [...car.imageUrls],
|
||||
}
|
||||
|
||||
initialDraftRef.current = draft
|
||||
setEditorDraft(draft)
|
||||
setEditingCarId(car.id)
|
||||
setNewImageUrl("")
|
||||
setViewMode("editor")
|
||||
}
|
||||
|
||||
const updateDraft = (patch: Partial<SourceCarDraft>) => {
|
||||
setEditorDraft((prev) => (prev ? { ...prev, ...patch } : prev))
|
||||
}
|
||||
|
||||
const addImageToDraft = () => {
|
||||
if (!editorDraft) return
|
||||
const url = newImageUrl.trim()
|
||||
if (!url) return
|
||||
updateDraft({ imageUrls: [...editorDraft.imageUrls, url] })
|
||||
setNewImageUrl("")
|
||||
}
|
||||
|
||||
const removeImageFromDraft = (index: number) => {
|
||||
if (!editorDraft) return
|
||||
updateDraft({ imageUrls: editorDraft.imageUrls.filter((_, idx) => idx !== index) })
|
||||
}
|
||||
|
||||
const handleCancelEditor = () => {
|
||||
if (isEditorDirty && !window.confirm("当前有未保存修改,确认取消并返回车型库吗?")) {
|
||||
return
|
||||
}
|
||||
setViewMode("list")
|
||||
setEditingCarId(null)
|
||||
setEditorDraft(null)
|
||||
setNewImageUrl("")
|
||||
initialDraftRef.current = null
|
||||
}
|
||||
|
||||
const handleSaveEditor = () => {
|
||||
if (!editingCarId || !editorDraft) return
|
||||
const now = nowString()
|
||||
|
||||
setSourceCars((curr) =>
|
||||
curr.map((car) => {
|
||||
if (car.id !== editingCarId) return car
|
||||
return {
|
||||
...car,
|
||||
pageType: editorDraft.pageType,
|
||||
title: editorDraft.title,
|
||||
subtitle: editorDraft.subtitle,
|
||||
highlights: editorDraft.highlights,
|
||||
description: editorDraft.description,
|
||||
ctaText: editorDraft.ctaText,
|
||||
scheduledPublishAt: editorDraft.scheduledPublishAt,
|
||||
officialTagline: editorDraft.subtitle || car.officialTagline,
|
||||
imageUrls: editorDraft.imageUrls,
|
||||
imageCount: editorDraft.imageUrls.length,
|
||||
sourceUpdatedAt: now,
|
||||
updatedBy: "内容运营专员",
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
const carName = sourceCars.find((car) => car.id === editingCarId)?.name ?? "目标车型"
|
||||
onAddAuditLog(`内容运营专员编辑并保存 ${carName} 车型内容`)
|
||||
|
||||
setViewMode("list")
|
||||
setEditingCarId(null)
|
||||
setEditorDraft(null)
|
||||
setNewImageUrl("")
|
||||
initialDraftRef.current = null
|
||||
}
|
||||
|
||||
if (viewMode === "editor" && editingCarId && editorDraft) {
|
||||
const editingCar = sourceCars.find((car) => car.id === editingCarId)
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6 p-8">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<Button variant="outline" size="sm" onClick={handleCancelEditor}>
|
||||
<ChevronLeft className="mr-1 h-3.5 w-3.5" />返回车型库
|
||||
</Button>
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold tracking-tight">官网车型编辑</h1>
|
||||
<p className="text-muted-foreground">编辑车型内容与素材图片,不含预览与审核动作。</p>
|
||||
</div>
|
||||
</div>
|
||||
<Badge variant="outline">{editingCar?.name ?? "车型"}</Badge>
|
||||
</div>
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">编辑字段</CardTitle>
|
||||
<CardDescription>字段结构与小程序内容编辑页一致。</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">来源车型</label>
|
||||
<Input value={editingCar?.name ?? ""} disabled />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">页面类型</label>
|
||||
<Input value={editorDraft.pageType} disabled />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">标题</label>
|
||||
<Input value={editorDraft.title} disabled={!canEdit} onChange={(e) => updateDraft({ title: e.target.value })} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">副标题</label>
|
||||
<Input value={editorDraft.subtitle} disabled={!canEdit} onChange={(e) => updateDraft({ subtitle: e.target.value })} />
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">卖点(每行一条)</label>
|
||||
<textarea
|
||||
className="min-h-24 rounded-lg border border-input bg-background px-3 py-2 text-sm outline-none focus-visible:border-ring"
|
||||
value={editorDraft.highlights}
|
||||
disabled={!canEdit}
|
||||
onChange={(e) => updateDraft({ highlights: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">图文描述(轻量编排)</label>
|
||||
<textarea
|
||||
className="min-h-28 rounded-lg border border-input bg-background px-3 py-2 text-sm outline-none focus-visible:border-ring"
|
||||
value={editorDraft.description}
|
||||
disabled={!canEdit}
|
||||
onChange={(e) => updateDraft({ description: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">按钮文案</label>
|
||||
<Input value={editorDraft.ctaText} disabled={!canEdit} onChange={(e) => updateDraft({ ctaText: e.target.value })} />
|
||||
</div>
|
||||
|
||||
{workflowConfig.publishStrategy === "scheduled" && (
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">预约发布时间</label>
|
||||
<Input
|
||||
type="datetime-local"
|
||||
disabled={!canEdit}
|
||||
value={editorDraft.scheduledPublishAt}
|
||||
onChange={(e) => updateDraft({ scheduledPublishAt: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">图片素材(多图)</label>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
value={newImageUrl}
|
||||
disabled={!canEdit}
|
||||
onChange={(e) => setNewImageUrl(e.target.value)}
|
||||
placeholder="粘贴图片 URL"
|
||||
/>
|
||||
<Button variant="outline" disabled={!canEdit} onClick={addImageToDraft}>新增</Button>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{editorDraft.imageUrls.map((url, idx) => (
|
||||
<div key={`${url}-${idx}`} className="rounded-lg border p-2">
|
||||
<img src={url} alt={`official-${idx}`} className="aspect-video w-full rounded object-cover" />
|
||||
<div className="mt-2 flex justify-end">
|
||||
<Button size="sm" variant="ghost" disabled={!canEdit} onClick={() => removeImageFromDraft(idx)}>
|
||||
删除
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 pt-2">
|
||||
<Button variant="outline" onClick={handleCancelEditor}>取消</Button>
|
||||
<Button disabled={!canEdit} onClick={handleSaveEditor}>
|
||||
<Pencil className="mr-1 h-3.5 w-3.5" />保存
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
onAddAuditLog("项目与运维负责人重试官网同步失败任务")
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6 p-8">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex flex-col gap-1">
|
||||
<h1 className="text-3xl font-bold tracking-tight">车型库(官网同步源)</h1>
|
||||
<p className="text-muted-foreground">本页仅管理官网同步原始数据。编辑、审核、发布请前往“小程序内容库”。</p>
|
||||
<h1 className="text-3xl font-bold tracking-tight">官网车型库</h1>
|
||||
<p className="text-muted-foreground">本页用于每周人工巡检 JV 官网素材,确认差异后再进入“小程序内容库”完成页面更新与发布。</p>
|
||||
</div>
|
||||
<Button onClick={handleSync} disabled={isSyncing} className="bg-audi-black hover:bg-audi-dark-gray text-white px-6">
|
||||
{isSyncing ? <RefreshCw className="mr-2 h-4 w-4 animate-spin" /> : <RefreshCw className="mr-2 h-4 w-4" />}
|
||||
从官网同步
|
||||
执行本周周更
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -177,7 +553,7 @@ export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps)
|
||||
<CardContent className="pt-6">
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<span className="font-medium text-audi-red">正在同步官网车型素材...</span>
|
||||
<span className="font-medium text-audi-red">正在执行本周人工周更任务...</span>
|
||||
<span className="text-muted-foreground">{Math.round(progress)}%</span>
|
||||
</div>
|
||||
<Progress value={progress} className="h-2 bg-audi-red/10" />
|
||||
@@ -189,15 +565,14 @@ export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps)
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle className="text-lg font-bold">官网车型列表</CardTitle>
|
||||
<Badge variant="outline" className="text-xs">Source Entity: SourceCar</Badge>
|
||||
<CardTitle className="text-lg font-bold">官网素材巡检列表</CardTitle>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 w-full max-w-sm">
|
||||
<Search className="h-4 w-4 text-muted-foreground absolute ml-3" />
|
||||
<Input
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="搜索官网车型名称..."
|
||||
placeholder="搜索官网车型名称或待处理项..."
|
||||
className="pl-9 bg-gray-50/50 border-none"
|
||||
/>
|
||||
</div>
|
||||
@@ -208,40 +583,50 @@ export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps)
|
||||
<TableRow className="hover:bg-transparent border-b border-gray-100">
|
||||
<TableHead className="font-bold text-audi-black">车型名称</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">官网文案</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">图片数量</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">同步状态</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">最近同步</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">素材数量</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">处理状态</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">最近更新</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">操作人</TableHead>
|
||||
<TableHead className="text-right font-bold text-audi-black">操作</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{filtered.map((car) => (
|
||||
{pagedCars.map((car) => (
|
||||
<TableRow key={car.id} className="hover:bg-gray-50/50 border-b border-gray-50 transition-colors">
|
||||
<TableCell className="font-medium">{car.name}</TableCell>
|
||||
<TableCell className="text-muted-foreground">{car.officialTagline}</TableCell>
|
||||
<TableCell>{car.imageCount} 张</TableCell>
|
||||
<TableCell>
|
||||
<div className="flex items-center gap-2">
|
||||
<span>{car.imageCount} 张</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className="h-7 px-2"
|
||||
onClick={() => setPreviewCarId(car.id)}
|
||||
>
|
||||
<Eye className="mr-1 h-3.5 w-3.5" />预览
|
||||
</Button>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>{syncBadge(car.syncStatus)}</TableCell>
|
||||
<TableCell className="text-muted-foreground text-xs">{car.sourceUpdatedAt}</TableCell>
|
||||
<TableCell className="text-muted-foreground text-xs">{car.updatedBy}</TableCell>
|
||||
<TableCell className="text-right">
|
||||
{car.syncStatus === "synced" ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
onCreateContent?.(car.id, car.name)
|
||||
onAddAuditLog(`内容运营专员基于官网 ${car.name} 新建内容草稿`)
|
||||
}}
|
||||
onClick={() => openEditor(car)}
|
||||
>
|
||||
<Plus className="mr-1 h-3.5 w-3.5" />新建内容
|
||||
<Pencil className="mr-1 h-3.5 w-3.5" />编辑
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
disabled
|
||||
title={car.syncStatus === "pending" ? "车型待同步,完成同步后可新建内容" : "车型同步失败,请先重试同步"}
|
||||
onClick={() => openEditor(car)}
|
||||
>
|
||||
<Plus className="mr-1 h-3.5 w-3.5" />新建内容
|
||||
<Pencil className="mr-1 h-3.5 w-3.5" />编辑
|
||||
</Button>
|
||||
)}
|
||||
</TableCell>
|
||||
@@ -249,13 +634,32 @@ export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps)
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
<div className="mt-4 flex items-center justify-between border-t pt-4">
|
||||
<p className="text-xs text-muted-foreground">每页 7 条,共 10 页</p>
|
||||
<div className="flex items-center gap-1">
|
||||
<Button size="sm" variant="outline" disabled>上一页</Button>
|
||||
{Array.from({ length: listTotalPages }, (_, index) => (
|
||||
<Button
|
||||
key={`car-page-${index + 1}`}
|
||||
size="sm"
|
||||
variant={index + 1 === listPage ? "default" : "outline"}
|
||||
className={index + 1 === listPage ? "bg-audi-black hover:bg-audi-dark-gray text-white" : ""}
|
||||
disabled
|
||||
>
|
||||
{index + 1}
|
||||
</Button>
|
||||
))}
|
||||
<Button size="sm" variant="outline" disabled>下一页</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">同步记录</CardTitle>
|
||||
<CardDescription>同步异常可重试,重试结果将写入本页日志。</CardDescription>
|
||||
<CardTitle className="text-lg font-bold">周更记录</CardTitle>
|
||||
<CardDescription>官网素材异常可重试,重试结果将写入本页日志。</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-2">
|
||||
{syncLogs.map((log) => (
|
||||
@@ -278,6 +682,62 @@ export function CarLibrary({ onAddAuditLog, onCreateContent }: CarLibraryProps)
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{previewCarId && (
|
||||
<div className="fixed inset-0 z-50 bg-black/80 p-4 md:p-6">
|
||||
<Card className="mx-auto flex h-full w-full max-w-none flex-col border-none bg-white shadow-2xl">
|
||||
<CardHeader className="flex flex-row items-center justify-between">
|
||||
<div>
|
||||
<CardTitle className="text-lg font-bold">素材图片预览</CardTitle>
|
||||
<CardDescription>
|
||||
{sourceCars.find((car) => car.id === previewCarId)?.name}
|
||||
</CardDescription>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon" onClick={() => { setPreviewCarId(null); setPreviewImageIndex(0) }}>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</CardHeader>
|
||||
<CardContent className="relative flex-1 overflow-hidden p-4 md:p-6">
|
||||
<div className="relative h-full w-full rounded-lg bg-black">
|
||||
{previewImages.length > 0 ? (
|
||||
<>
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<img
|
||||
src={previewImages[previewImageIndex]}
|
||||
alt={`preview-${previewImageIndex}`}
|
||||
className="max-h-full max-w-full object-contain"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="outline"
|
||||
className="absolute left-4 top-1/2 -translate-y-1/2 bg-white/90"
|
||||
disabled={previewImageIndex <= 0}
|
||||
onClick={() => setPreviewImageIndex((curr) => Math.max(curr - 1, 0))}
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="outline"
|
||||
className="absolute right-4 top-1/2 -translate-y-1/2 bg-white/90"
|
||||
disabled={previewImageIndex >= previewImages.length - 1}
|
||||
onClick={() => setPreviewImageIndex((curr) => Math.min(curr + 1, previewImages.length - 1))}
|
||||
>
|
||||
<ChevronRight className="h-4 w-4" />
|
||||
</Button>
|
||||
<div className="absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full bg-black/65 px-3 py-1 text-xs text-white">
|
||||
{previewImageIndex + 1} / {previewImages.length}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="flex h-full items-center justify-center text-sm text-white/80">该车型暂无可预览图片</div>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ import {
|
||||
ArrowLeft,
|
||||
Eye,
|
||||
Pencil,
|
||||
RotateCcw,
|
||||
Search,
|
||||
Send,
|
||||
ShieldCheck,
|
||||
Undo2,
|
||||
Upload,
|
||||
Trash2,
|
||||
XCircle,
|
||||
} from "lucide-react"
|
||||
|
||||
@@ -24,12 +25,22 @@ import {
|
||||
TableRow,
|
||||
} from "@/components/ui/table"
|
||||
|
||||
type WorkflowStatus = "draft" | "pending" | "prepublished" | "published" | "rejected" | "recalled"
|
||||
type WorkflowStatus = "draft" | "prepublished" | "published"
|
||||
|
||||
type SourceSnapshot = {
|
||||
title: string
|
||||
subtitle: string
|
||||
highlights: string
|
||||
description: string
|
||||
ctaText: string
|
||||
imageUrls: string[]
|
||||
}
|
||||
|
||||
type MiniAppContent = {
|
||||
id: string
|
||||
sourceCarId: string
|
||||
sourceCarName: string
|
||||
pageType: "车型页" | "活动页" | "专题页"
|
||||
title: string
|
||||
subtitle: string
|
||||
highlights: string
|
||||
@@ -58,6 +69,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
id: "c1",
|
||||
sourceCarId: "a3",
|
||||
sourceCarName: "Audi A3 Sportback",
|
||||
pageType: "车型页",
|
||||
title: "Audi A3 Sportback",
|
||||
subtitle: "进取,不负期待",
|
||||
highlights: "数字座舱\n城市通勤\n智能互联",
|
||||
@@ -65,9 +77,8 @@ const CONTENTS: MiniAppContent[] = [
|
||||
ctaText: "立即预约试驾",
|
||||
scheduledPublishAt: "",
|
||||
imageUrls: [
|
||||
"https://images.unsplash.com/photo-1606152421802-db97b9c7a11b?auto=format&fit=crop&q=80&w=1200",
|
||||
"https://picsum.photos/seed/a3-content-1/900/600",
|
||||
"https://picsum.photos/seed/a3-content-2/900/600",
|
||||
"/images/cars/a3-1.jpg",
|
||||
"/images/cars/a3-2.jpg",
|
||||
],
|
||||
workflowStatus: "published",
|
||||
updatedBy: "内容运营专员",
|
||||
@@ -77,6 +88,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
id: "c2",
|
||||
sourceCarId: "a4l",
|
||||
sourceCarName: "Audi A4L",
|
||||
pageType: "活动页",
|
||||
title: "Audi A4L 四月限时礼遇",
|
||||
subtitle: "豪华与性能平衡",
|
||||
highlights: "quattro\n商务舒适\n限时礼遇",
|
||||
@@ -84,8 +96,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
ctaText: "获取活动详情",
|
||||
scheduledPublishAt: "2026-04-14T10:00",
|
||||
imageUrls: [
|
||||
"https://images.unsplash.com/photo-1614162692292-7ac56d7f7f1e?auto=format&fit=crop&q=80&w=1200",
|
||||
"https://picsum.photos/seed/a4-content-1/900/600",
|
||||
"/images/cars/a4-1.jpg",
|
||||
],
|
||||
workflowStatus: "prepublished",
|
||||
updatedBy: "业务/市场负责人",
|
||||
@@ -95,6 +106,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
id: "c3",
|
||||
sourceCarId: "a6l",
|
||||
sourceCarName: "Audi A6L",
|
||||
pageType: "车型页",
|
||||
title: "Audi A6L",
|
||||
subtitle: "懂你,更懂未来",
|
||||
highlights: "行政旗舰\n长轴空间\n智能辅助",
|
||||
@@ -102,9 +114,10 @@ const CONTENTS: MiniAppContent[] = [
|
||||
ctaText: "预约顾问回电",
|
||||
scheduledPublishAt: "",
|
||||
imageUrls: [
|
||||
"https://images.unsplash.com/photo-1541348263662-e0c86433610a?auto=format&fit=crop&q=80&w=1200",
|
||||
"/images/cars/a6-1.jpg",
|
||||
"/images/cars/a6-2.jpg",
|
||||
],
|
||||
workflowStatus: "pending",
|
||||
workflowStatus: "prepublished",
|
||||
updatedBy: "内容运营专员",
|
||||
updatedAt: "2026-04-11 09:30",
|
||||
},
|
||||
@@ -112,6 +125,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
id: "c4",
|
||||
sourceCarId: "q3",
|
||||
sourceCarName: "Audi Q3",
|
||||
pageType: "专题页",
|
||||
title: "Audi Q3 城市灵动版",
|
||||
subtitle: "年轻进阶,灵动出行",
|
||||
highlights: "紧凑SUV\n智能互联\n都市通勤",
|
||||
@@ -119,7 +133,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
ctaText: "预约试驾",
|
||||
scheduledPublishAt: "",
|
||||
imageUrls: [
|
||||
"https://picsum.photos/seed/q3-content-1/900/600",
|
||||
"/images/cars/q3-1.jpg",
|
||||
],
|
||||
workflowStatus: "draft",
|
||||
updatedBy: "内容运营专员",
|
||||
@@ -129,6 +143,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
id: "c5",
|
||||
sourceCarId: "q5l",
|
||||
sourceCarName: "Audi Q5L",
|
||||
pageType: "活动页",
|
||||
title: "Audi Q5L 周末试驾礼遇",
|
||||
subtitle: "自由,由我定义",
|
||||
highlights: "四驱性能\n家庭空间\n周末活动",
|
||||
@@ -136,9 +151,10 @@ const CONTENTS: MiniAppContent[] = [
|
||||
ctaText: "了解礼遇",
|
||||
scheduledPublishAt: "",
|
||||
imageUrls: [
|
||||
"https://picsum.photos/seed/q5-content-1/900/600",
|
||||
"/images/cars/q5-1.jpg",
|
||||
"/images/cars/q5-2.jpg",
|
||||
],
|
||||
workflowStatus: "rejected",
|
||||
workflowStatus: "draft",
|
||||
updatedBy: "业务/市场负责人",
|
||||
updatedAt: "2026-04-11 08:10",
|
||||
},
|
||||
@@ -146,6 +162,7 @@ const CONTENTS: MiniAppContent[] = [
|
||||
id: "c6",
|
||||
sourceCarId: "a8l",
|
||||
sourceCarName: "Audi A8L",
|
||||
pageType: "车型页",
|
||||
title: "Audi A8L 尊享礼宾版",
|
||||
subtitle: "旗舰格局,沉稳之选",
|
||||
highlights: "旗舰行政\n豪华座舱\n专属服务",
|
||||
@@ -153,37 +170,136 @@ const CONTENTS: MiniAppContent[] = [
|
||||
ctaText: "预约专属顾问",
|
||||
scheduledPublishAt: "2026-04-15T09:30",
|
||||
imageUrls: [
|
||||
"https://picsum.photos/seed/a8-content-1/900/600",
|
||||
"/images/cars/a8-1.jpg",
|
||||
],
|
||||
workflowStatus: "recalled",
|
||||
workflowStatus: "published",
|
||||
updatedBy: "业务/市场负责人",
|
||||
updatedAt: "2026-04-11 07:55",
|
||||
},
|
||||
{
|
||||
id: "c7",
|
||||
sourceCarId: "rs7",
|
||||
sourceCarName: "Audi RS7",
|
||||
pageType: "车型页",
|
||||
title: "Audi RS7 Performance",
|
||||
subtitle: "高性能美学,锋芒尽释",
|
||||
highlights: "V8双涡轮\nquattro四驱\nRS专属运动套件",
|
||||
description: "聚焦高性能驾驶体验与豪华运动设计,适配高意向用户内容触达场景。",
|
||||
ctaText: "预约性能试驾",
|
||||
scheduledPublishAt: "",
|
||||
imageUrls: [
|
||||
"/images/cars/rs7-1.jpg",
|
||||
"/images/cars/rs7-2.jpg",
|
||||
],
|
||||
workflowStatus: "draft",
|
||||
updatedBy: "内容运营专员",
|
||||
updatedAt: "2026-04-12 10:20",
|
||||
},
|
||||
]
|
||||
|
||||
const WORKFLOW_LABEL: Record<WorkflowStatus, string> = {
|
||||
draft: "草稿",
|
||||
pending: "待审核",
|
||||
prepublished: "预发布",
|
||||
published: "已发布",
|
||||
rejected: "已驳回",
|
||||
recalled: "已撤回",
|
||||
}
|
||||
|
||||
const SOURCE_SNAPSHOTS: Record<string, SourceSnapshot> = {
|
||||
a3: {
|
||||
title: "Audi A3 Sportback",
|
||||
subtitle: "进取,不负期待",
|
||||
highlights: "数字座舱\n城市通勤\n智能互联",
|
||||
description: "来自官网车型库的车型基线内容。",
|
||||
ctaText: "立即预约试驾",
|
||||
imageUrls: [
|
||||
"/images/cars/a3-1.jpg",
|
||||
"/images/cars/a3-2.jpg",
|
||||
],
|
||||
},
|
||||
a4l: {
|
||||
title: "Audi A4L",
|
||||
subtitle: "做更强大的自己",
|
||||
highlights: "quattro\n商务舒适\n智能互联",
|
||||
description: "来自官网车型库的车型基线内容。",
|
||||
ctaText: "了解更多",
|
||||
imageUrls: [
|
||||
"/images/cars/a4-1.jpg",
|
||||
],
|
||||
},
|
||||
a6l: {
|
||||
title: "Audi A6L",
|
||||
subtitle: "懂你,更懂未来",
|
||||
highlights: "行政旗舰\n长轴空间\n智能辅助",
|
||||
description: "来自官网车型库的车型基线内容。",
|
||||
ctaText: "预约顾问回电",
|
||||
imageUrls: [
|
||||
"/images/cars/a6-1.jpg",
|
||||
"/images/cars/a6-2.jpg",
|
||||
],
|
||||
},
|
||||
q3: {
|
||||
title: "Audi Q3",
|
||||
subtitle: "活出生命的辽阔",
|
||||
highlights: "紧凑SUV\n智能互联\n都市通勤",
|
||||
description: "来自官网车型库的车型基线内容。",
|
||||
ctaText: "立即预约试驾",
|
||||
imageUrls: [
|
||||
"/images/cars/q3-1.jpg",
|
||||
"/images/cars/q3-2.jpg",
|
||||
],
|
||||
},
|
||||
q5l: {
|
||||
title: "Audi Q5L",
|
||||
subtitle: "自由,由我定义",
|
||||
highlights: "四驱性能\n家庭空间\n全场景出行",
|
||||
description: "来自官网车型库的车型基线内容。",
|
||||
ctaText: "预约试驾",
|
||||
imageUrls: [
|
||||
"/images/cars/q5-1.jpg",
|
||||
"/images/cars/q5-2.jpg",
|
||||
],
|
||||
},
|
||||
a8l: {
|
||||
title: "Audi A8L",
|
||||
subtitle: "旗舰格局,沉稳之选",
|
||||
highlights: "旗舰行政\n豪华座舱\n专属服务",
|
||||
description: "来自官网车型库的车型基线内容。",
|
||||
ctaText: "预约专属顾问",
|
||||
imageUrls: [
|
||||
"/images/cars/a8-1.jpg",
|
||||
"/images/cars/a8-2.jpg",
|
||||
],
|
||||
},
|
||||
rs7: {
|
||||
title: "Audi RS7 Performance",
|
||||
subtitle: "高性能美学,锋芒尽释",
|
||||
highlights: "V8双涡轮\nquattro四驱\nRS专属运动套件",
|
||||
description: "来自官网车型库的车型基线内容。",
|
||||
ctaText: "预约性能试驾",
|
||||
imageUrls: [
|
||||
"/images/cars/rs7-1.jpg",
|
||||
"/images/cars/rs7-2.jpg",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
const SOURCE_CAR_OPTIONS = [
|
||||
{ id: "a3", name: "Audi A3 Sportback" },
|
||||
{ id: "a4l", name: "Audi A4L" },
|
||||
{ id: "a6l", name: "Audi A6L" },
|
||||
{ id: "q3", name: "Audi Q3" },
|
||||
{ id: "q5l", name: "Audi Q5L" },
|
||||
{ id: "a8l", name: "Audi A8L" },
|
||||
{ id: "rs7", name: "Audi RS7" },
|
||||
] as const
|
||||
|
||||
function workflowBadgeClass(status: WorkflowStatus) {
|
||||
switch (status) {
|
||||
case "draft":
|
||||
return "bg-gray-100 text-gray-700 border-gray-200"
|
||||
case "pending":
|
||||
return "bg-amber-50 text-amber-700 border-amber-200"
|
||||
case "prepublished":
|
||||
return "bg-blue-50 text-blue-700 border-blue-200"
|
||||
case "published":
|
||||
return "bg-emerald-50 text-emerald-700 border-emerald-200"
|
||||
case "rejected":
|
||||
return "bg-rose-50 text-rose-700 border-rose-200"
|
||||
case "recalled":
|
||||
return "bg-zinc-100 text-zinc-700 border-zinc-200"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +311,12 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
const [contents, setContents] = React.useState<MiniAppContent[]>(CONTENTS)
|
||||
const [viewMode, setViewMode] = React.useState<"list" | "editor">("list")
|
||||
const [selectedId, setSelectedId] = React.useState<string>(CONTENTS[0].id)
|
||||
const [query, setQuery] = React.useState("")
|
||||
const [newImageUrl, setNewImageUrl] = React.useState("")
|
||||
const [pendingResetPatch, setPendingResetPatch] = React.useState<Record<string, Partial<MiniAppContent>>>({})
|
||||
const listPageSize = 7
|
||||
const listTotalPages = 10
|
||||
const listPage = 1
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!newContentRequest) return
|
||||
@@ -207,6 +328,7 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
id,
|
||||
sourceCarId: newContentRequest.sourceCarId,
|
||||
sourceCarName: newContentRequest.sourceCarName,
|
||||
pageType: "车型页",
|
||||
title: newContentRequest.sourceCarName,
|
||||
subtitle: "",
|
||||
highlights: "",
|
||||
@@ -228,6 +350,11 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
const canEdit = roleView === "content-ops"
|
||||
const canApprove = roleView === "biz-market"
|
||||
const selected = contents.find((item) => item.id === selectedId) ?? null
|
||||
const filteredContents = contents.filter((item) => {
|
||||
const key = `${item.sourceCarName} ${item.sourceCarId} ${item.pageType} ${item.title}`.toLowerCase()
|
||||
return key.includes(query.toLowerCase())
|
||||
})
|
||||
const pagedContents = filteredContents.slice((listPage - 1) * listPageSize, listPage * listPageSize)
|
||||
|
||||
const updateContent = (id: string, patch: Partial<MiniAppContent>) => {
|
||||
setContents((prev) =>
|
||||
@@ -236,46 +363,51 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
}
|
||||
|
||||
const saveDraft = (item: MiniAppContent) => {
|
||||
updateContent(item.id, { workflowStatus: "draft", updatedBy: "内容运营专员" })
|
||||
onAddAuditLog(`内容运营专员保存 ${item.sourceCarName} 内容草稿`)
|
||||
const stagedPatch = pendingResetPatch[item.id] ?? {}
|
||||
updateContent(item.id, { ...stagedPatch, workflowStatus: "draft", updatedBy: "内容运营专员" })
|
||||
setPendingResetPatch((prev) => {
|
||||
if (!prev[item.id]) return prev
|
||||
const next = { ...prev }
|
||||
delete next[item.id]
|
||||
return next
|
||||
})
|
||||
if (Object.keys(stagedPatch).length > 0) {
|
||||
onAddAuditLog(`内容运营专员保存并重置 ${item.sourceCarName} 到官网源数据(回草稿)`)
|
||||
} else {
|
||||
onAddAuditLog(`内容运营专员保存 ${item.sourceCarName} 内容草稿`)
|
||||
}
|
||||
}
|
||||
|
||||
const stageResetFromSource = (item: MiniAppContent) => {
|
||||
const source = SOURCE_SNAPSHOTS[item.sourceCarId]
|
||||
if (!source) return
|
||||
setPendingResetPatch((prev) => ({
|
||||
...prev,
|
||||
[item.id]: {
|
||||
title: source.title,
|
||||
subtitle: source.subtitle,
|
||||
highlights: source.highlights,
|
||||
description: source.description,
|
||||
ctaText: source.ctaText,
|
||||
imageUrls: source.imageUrls,
|
||||
},
|
||||
}))
|
||||
onAddAuditLog(`内容运营专员发起 ${item.sourceCarName} 源数据重置(待保存生效)`)
|
||||
}
|
||||
|
||||
const submitForReview = (item: MiniAppContent) => {
|
||||
updateContent(item.id, { workflowStatus: "pending", updatedBy: "内容运营专员" })
|
||||
onAddAuditLog(`内容运营专员提交 ${item.sourceCarName} 到审核队列`)
|
||||
}
|
||||
|
||||
const withdrawReview = (item: MiniAppContent) => {
|
||||
updateContent(item.id, { workflowStatus: "draft", updatedBy: "内容运营专员" })
|
||||
onAddAuditLog(`内容运营专员撤回 ${item.sourceCarName} 的审核申请`)
|
||||
updateContent(item.id, { workflowStatus: "prepublished", updatedBy: "内容运营专员" })
|
||||
onAddAuditLog(`内容运营专员提交 ${item.sourceCarName} 进入预发布待审`)
|
||||
}
|
||||
|
||||
const approve = (item: MiniAppContent) => {
|
||||
const nextStatus: WorkflowStatus = workflowConfig.enablePrePublish ? "prepublished" : "published"
|
||||
updateContent(item.id, { workflowStatus: nextStatus, updatedBy: "业务/市场负责人" })
|
||||
onAddAuditLog(`业务/市场负责人审批通过 ${item.sourceCarName}`)
|
||||
updateContent(item.id, { workflowStatus: "published", updatedBy: "业务/市场负责人" })
|
||||
onAddAuditLog(`业务/市场负责人通过 ${item.sourceCarName},状态变为已发布`)
|
||||
}
|
||||
|
||||
const reject = (item: MiniAppContent) => {
|
||||
updateContent(item.id, { workflowStatus: "rejected", updatedBy: "业务/市场负责人" })
|
||||
onAddAuditLog(`业务/市场负责人驳回 ${item.sourceCarName} 内容版本`)
|
||||
}
|
||||
|
||||
const publish = (item: MiniAppContent) => {
|
||||
const actor = roleView === "biz-market" ? "业务/市场负责人" : "内容运营专员"
|
||||
updateContent(item.id, { workflowStatus: "published", updatedBy: actor })
|
||||
onAddAuditLog(`${actor}发布 ${item.sourceCarName} 到小程序`)
|
||||
}
|
||||
|
||||
const recall = (item: MiniAppContent) => {
|
||||
updateContent(item.id, { workflowStatus: "recalled", updatedBy: "业务/市场负责人" })
|
||||
onAddAuditLog(`业务/市场负责人撤回 ${item.sourceCarName} 已发布内容`)
|
||||
}
|
||||
|
||||
const revive = (item: MiniAppContent) => {
|
||||
const nextStatus: WorkflowStatus = workflowConfig.enablePrePublish ? "prepublished" : "published"
|
||||
updateContent(item.id, { workflowStatus: nextStatus, updatedBy: "业务/市场负责人" })
|
||||
onAddAuditLog(`业务/市场负责人恢复 ${item.sourceCarName} 的发布流程`)
|
||||
updateContent(item.id, { workflowStatus: "draft", updatedBy: "业务/市场负责人" })
|
||||
onAddAuditLog(`业务/市场负责人驳回 ${item.sourceCarName},状态退回草稿`)
|
||||
}
|
||||
|
||||
const createNewVersion = (item: MiniAppContent) => {
|
||||
@@ -283,6 +415,44 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
onAddAuditLog(`内容运营专员基于 ${item.sourceCarName} 发布版本创建新稿`)
|
||||
}
|
||||
|
||||
const createNewContent = () => {
|
||||
const id = `c${Date.now()}`
|
||||
const draft: MiniAppContent = {
|
||||
id,
|
||||
sourceCarId: "",
|
||||
sourceCarName: "",
|
||||
pageType: "车型页",
|
||||
title: "",
|
||||
subtitle: "",
|
||||
highlights: "",
|
||||
description: "",
|
||||
ctaText: "立即预约试驾",
|
||||
scheduledPublishAt: "",
|
||||
imageUrls: [],
|
||||
workflowStatus: "draft",
|
||||
updatedBy: "内容运营专员",
|
||||
updatedAt: nowString(),
|
||||
}
|
||||
setContents((prev) => [draft, ...prev])
|
||||
setSelectedId(id)
|
||||
setViewMode("editor")
|
||||
onAddAuditLog("内容运营专员新增小程序内容草稿")
|
||||
}
|
||||
|
||||
const deleteContent = (item: MiniAppContent) => {
|
||||
if (!window.confirm(`确认删除 ${item.sourceCarName || "当前草稿"} 吗?`)) return
|
||||
|
||||
setContents((prev) => {
|
||||
const next = prev.filter((content) => content.id !== item.id)
|
||||
if (next.length > 0) {
|
||||
setSelectedId(next[0].id)
|
||||
}
|
||||
return next
|
||||
})
|
||||
setViewMode("list")
|
||||
onAddAuditLog(`内容运营专员删除 ${item.sourceCarName || "未命名"} 内容草稿`)
|
||||
}
|
||||
|
||||
const addImage = (item: MiniAppContent) => {
|
||||
const next = newImageUrl.trim()
|
||||
if (!next) return
|
||||
@@ -298,24 +468,10 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
const actions: React.ReactNode[] = []
|
||||
|
||||
if (canEdit) {
|
||||
if (item.workflowStatus === "draft" || item.workflowStatus === "rejected" || item.workflowStatus === "recalled") {
|
||||
if (item.workflowStatus === "draft") {
|
||||
actions.push(
|
||||
<Button key="submit" size="sm" variant="outline" onClick={() => submitForReview(item)}>
|
||||
<Send className="mr-1 h-3.5 w-3.5" />{item.workflowStatus === "draft" ? "提交审核" : "重新提审"}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
if (item.workflowStatus === "pending") {
|
||||
actions.push(
|
||||
<Button key="withdraw" size="sm" variant="outline" onClick={() => withdrawReview(item)}>
|
||||
<Undo2 className="mr-1 h-3.5 w-3.5" />撤回提审
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
if (item.workflowStatus === "prepublished") {
|
||||
actions.push(
|
||||
<Button key="publish" size="sm" variant="outline" onClick={() => publish(item)}>
|
||||
<Upload className="mr-1 h-3.5 w-3.5" />发布
|
||||
<Send className="mr-1 h-3.5 w-3.5" />提交审核
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -329,7 +485,7 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
}
|
||||
|
||||
if (canApprove) {
|
||||
if (item.workflowStatus === "pending") {
|
||||
if (item.workflowStatus === "prepublished") {
|
||||
actions.push(
|
||||
<Button key="approve" size="sm" variant="outline" onClick={() => approve(item)}>
|
||||
<ShieldCheck className="mr-1 h-3.5 w-3.5" />通过
|
||||
@@ -341,32 +497,23 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
if (workflowConfig.allowRecall && item.workflowStatus === "published") {
|
||||
actions.push(
|
||||
<Button key="recall" size="sm" variant="outline" onClick={() => recall(item)}>
|
||||
<Undo2 className="mr-1 h-3.5 w-3.5" />撤回
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
if (item.workflowStatus === "recalled") {
|
||||
actions.push(
|
||||
<Button key="revive" size="sm" variant="outline" onClick={() => revive(item)}>
|
||||
<Upload className="mr-1 h-3.5 w-3.5" />恢复流程
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
actions.push(
|
||||
<Button key="detail" size="sm" variant="ghost" onClick={() => { setSelectedId(item.id); setViewMode("editor") }}>
|
||||
<Eye className="mr-1 h-3.5 w-3.5" />详情
|
||||
</Button>
|
||||
)
|
||||
if (!canApprove) {
|
||||
actions.push(
|
||||
<Button key="detail" size="sm" variant="ghost" onClick={() => { setSelectedId(item.id); setViewMode("editor") }}>
|
||||
<Eye className="mr-1 h-3.5 w-3.5" />详情
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
return actions
|
||||
}
|
||||
|
||||
if (viewMode === "editor" && selected) {
|
||||
const isNewContent = !selected.sourceCarId
|
||||
const canResetFromSource = Boolean(selected.sourceCarId && SOURCE_SNAPSHOTS[selected.sourceCarId])
|
||||
const previewHeroImage = selected.imageUrls[0]
|
||||
const highlights = selected.highlights
|
||||
.split("\n")
|
||||
.map((s) => s.trim())
|
||||
@@ -398,7 +545,54 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
<CardContent className="space-y-4">
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">来源车型</label>
|
||||
<Input value={selected.sourceCarName} disabled />
|
||||
{isNewContent && canEdit ? (
|
||||
<select
|
||||
className="h-10 rounded-lg border border-input bg-background px-3 text-sm"
|
||||
value={selected.sourceCarId}
|
||||
onChange={(e) => {
|
||||
const nextId = e.target.value
|
||||
const option = SOURCE_CAR_OPTIONS.find((item) => item.id === nextId)
|
||||
const snapshot = SOURCE_SNAPSHOTS[nextId]
|
||||
updateContent(selected.id, {
|
||||
sourceCarId: nextId,
|
||||
sourceCarName: option?.name ?? "",
|
||||
title: snapshot?.title ?? selected.title,
|
||||
subtitle: snapshot?.subtitle ?? selected.subtitle,
|
||||
highlights: snapshot?.highlights ?? selected.highlights,
|
||||
description: snapshot?.description ?? selected.description,
|
||||
ctaText: snapshot?.ctaText ?? selected.ctaText,
|
||||
imageUrls: snapshot?.imageUrls ?? selected.imageUrls,
|
||||
})
|
||||
if (snapshot) {
|
||||
onAddAuditLog(`内容运营专员选择来源车型 ${option?.name ?? nextId} 并载入官网基线内容`)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<option value="">请选择来源车型</option>
|
||||
{SOURCE_CAR_OPTIONS.map((option) => (
|
||||
<option key={option.id} value={option.id}>{option.name}</option>
|
||||
))}
|
||||
</select>
|
||||
) : (
|
||||
<Input value={selected.sourceCarName} disabled />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<label className="text-xs font-semibold tracking-wide text-muted-foreground uppercase">页面类型</label>
|
||||
{isNewContent && canEdit ? (
|
||||
<select
|
||||
className="h-10 rounded-lg border border-input bg-background px-3 text-sm"
|
||||
value={selected.pageType}
|
||||
onChange={(e) => updateContent(selected.id, { pageType: e.target.value as MiniAppContent["pageType"] })}
|
||||
>
|
||||
<option value="车型页">车型页</option>
|
||||
<option value="活动页">活动页</option>
|
||||
<option value="专题页">专题页</option>
|
||||
</select>
|
||||
) : (
|
||||
<Input value={selected.pageType} disabled />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
@@ -468,13 +662,29 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 pt-2">
|
||||
<Button variant="outline" disabled={!canEdit} onClick={() => saveDraft(selected)}>
|
||||
<Pencil className="mr-1 h-3.5 w-3.5" />保存草稿
|
||||
</Button>
|
||||
<Button disabled={!canEdit} onClick={() => submitForReview(selected)}>
|
||||
<Send className="mr-1 h-3.5 w-3.5" />提交审核
|
||||
</Button>
|
||||
{pendingResetPatch[selected.id] && (
|
||||
<div className="rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700">
|
||||
已暂存“重置为官网源数据”,请点击“保存草稿”生效并回到草稿状态。
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex items-center justify-between gap-3 pt-2">
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" disabled={!canEdit} onClick={() => saveDraft(selected)}>
|
||||
<Pencil className="mr-1 h-3.5 w-3.5" />保存草稿
|
||||
</Button>
|
||||
<Button disabled={!canEdit || selected.workflowStatus !== "draft"} onClick={() => submitForReview(selected)}>
|
||||
<Send className="mr-1 h-3.5 w-3.5" />提交审核
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" disabled={!canEdit || !canResetFromSource} onClick={() => stageResetFromSource(selected)}>
|
||||
<RotateCcw className="mr-1 h-3.5 w-3.5" />重置
|
||||
</Button>
|
||||
<Button variant="outline" disabled={!canEdit} onClick={() => deleteContent(selected)}>
|
||||
<Trash2 className="mr-1 h-3.5 w-3.5" />删除
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -482,13 +692,17 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">小程序预览(手机窗口)</CardTitle>
|
||||
<CardDescription>按钮上方展示预约试驾表单视觉区(仅演示,不提交)。</CardDescription>
|
||||
<CardDescription>按钮上方展示预约试驾表单视觉区(仅演示,不提交;真实留资将直接进入企业 CRM)。</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="flex justify-center">
|
||||
<div className="w-[360px] rounded-[28px] border border-gray-200 bg-white shadow-2xl overflow-hidden">
|
||||
<div className="h-9 bg-black text-white px-4 flex items-center text-[10px] tracking-[0.18em] uppercase">Audi</div>
|
||||
<div className="relative">
|
||||
<img src={selected.imageUrls[0]} alt={selected.title} className="h-48 w-full object-cover" />
|
||||
{previewHeroImage ? (
|
||||
<img src={previewHeroImage} alt={selected.title} className="h-48 w-full object-cover" />
|
||||
) : (
|
||||
<div className="flex h-48 w-full items-center justify-center bg-gray-100 text-xs text-gray-500">请先添加图片素材</div>
|
||||
)}
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/65 to-transparent" />
|
||||
<div className="absolute left-4 right-4 bottom-3 text-white">
|
||||
<p className="text-lg font-bold tracking-tight">{selected.title}</p>
|
||||
@@ -548,7 +762,7 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
<label className="flex items-start gap-2 text-[11px] leading-5 text-gray-600">
|
||||
<input type="checkbox" className="mt-0.5" />
|
||||
<span>
|
||||
我已阅读并同意《个人信息保护政策》,授权奥迪及授权经销商与我联系。
|
||||
我已阅读并同意《个人信息保护政策》,授权奥迪及授权经销商与我联系。信息提交后将直接进入企业 CRM,本平台不留存潜客数据。
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -570,20 +784,37 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex flex-col gap-1">
|
||||
<h1 className="text-3xl font-bold tracking-tight">小程序内容库</h1>
|
||||
<p className="text-muted-foreground">集中管理编辑、审核、保存和发布后的内容版本。</p>
|
||||
<p className="text-muted-foreground">集中管理内容模板与内容版本。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">内容版本列表</CardTitle>
|
||||
<CardDescription>与官网车型源数据分离,避免同步数据和发布内容混用。</CardDescription>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle className="text-lg font-bold">内容版本列表</CardTitle>
|
||||
<CardDescription>与官网素材巡检数据分离,避免人工周更任务和发布内容混用。</CardDescription>
|
||||
</div>
|
||||
<Button onClick={createNewContent} className="bg-audi-black hover:bg-audi-dark-gray text-white">
|
||||
<Pencil className="mr-1 h-3.5 w-3.5" />新增
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 w-full max-w-sm">
|
||||
<Search className="h-4 w-4 text-muted-foreground absolute ml-3" />
|
||||
<Input
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="搜索官网车型名称或待处理项..."
|
||||
className="pl-9 bg-gray-50/50 border-none"
|
||||
/>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow className="hover:bg-transparent border-b border-gray-100">
|
||||
<TableHead className="font-bold text-audi-black">来源车型</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">页面类型</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">内容标题</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">状态</TableHead>
|
||||
<TableHead className="font-bold text-audi-black">最近更新</TableHead>
|
||||
@@ -591,12 +822,15 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{contents.map((item) => (
|
||||
{pagedContents.map((item) => (
|
||||
<TableRow key={item.id} className="hover:bg-gray-50/50 border-b border-gray-50 transition-colors">
|
||||
<TableCell>
|
||||
<p className="font-medium">{item.sourceCarName}</p>
|
||||
<p className="text-xs text-muted-foreground">{item.sourceCarId}</p>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Badge variant="outline">{item.pageType}</Badge>
|
||||
</TableCell>
|
||||
<TableCell className="font-medium">{item.title}</TableCell>
|
||||
<TableCell>
|
||||
<Badge variant="outline" className={workflowBadgeClass(item.workflowStatus)}>
|
||||
@@ -614,6 +848,25 @@ export function MiniAppContentLibrary({ roleView, workflowConfig, onAddAuditLog,
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
<div className="mt-4 flex items-center justify-between border-t pt-4">
|
||||
<p className="text-xs text-muted-foreground">每页 7 条,共 10 页</p>
|
||||
<div className="flex items-center gap-1">
|
||||
<Button size="sm" variant="outline" disabled>上一页</Button>
|
||||
{Array.from({ length: listTotalPages }, (_, index) => (
|
||||
<Button
|
||||
key={`mini-page-${index + 1}`}
|
||||
size="sm"
|
||||
variant={index + 1 === listPage ? "default" : "outline"}
|
||||
className={index + 1 === listPage ? "bg-audi-black hover:bg-audi-dark-gray text-white" : ""}
|
||||
disabled
|
||||
>
|
||||
{index + 1}
|
||||
</Button>
|
||||
))}
|
||||
<Button size="sm" variant="outline" disabled>下一页</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import * as React from "react"
|
||||
import {
|
||||
LayoutDashboard,
|
||||
Car,
|
||||
NotebookPen,
|
||||
Users,
|
||||
UserCog,
|
||||
Settings,
|
||||
LogOut,
|
||||
@@ -23,15 +21,11 @@ import {
|
||||
SidebarMenuItem,
|
||||
SidebarRail,
|
||||
} from "@/components/ui/sidebar"
|
||||
import { LogoIconOnly } from "./Logo"
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
title: "仪表盘",
|
||||
icon: LayoutDashboard,
|
||||
id: "dashboard",
|
||||
},
|
||||
{
|
||||
title: "车型库",
|
||||
title: "官网车型库",
|
||||
icon: Car,
|
||||
id: "car-library",
|
||||
},
|
||||
@@ -40,11 +34,6 @@ const navItems = [
|
||||
icon: NotebookPen,
|
||||
id: "mini-content",
|
||||
},
|
||||
{
|
||||
title: "潜客管理",
|
||||
icon: Users,
|
||||
id: "leads",
|
||||
},
|
||||
{
|
||||
title: "用户与权限",
|
||||
icon: UserCog,
|
||||
@@ -66,16 +55,25 @@ export function AppSidebar({
|
||||
}) {
|
||||
return (
|
||||
<Sidebar collapsible="icon">
|
||||
<SidebarHeader className="border-b border-sidebar-border/50 py-6">
|
||||
<div className="flex items-center gap-3 px-2">
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-sm bg-audi-red text-white">
|
||||
<span className="text-xs font-bold tracking-tighter">A</span>
|
||||
<SidebarHeader className="border-b border-sidebar-border/50">
|
||||
{/* Expanded: full logo banner */}
|
||||
<div className="group-data-[collapsible=icon]:hidden">
|
||||
<div className="bg-black px-4 py-3">
|
||||
<img
|
||||
src="/images/audi_logo.png"
|
||||
alt="Audi"
|
||||
className="h-7 w-auto object-contain"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col overflow-hidden group-data-[collapsible=icon]:hidden">
|
||||
<span className="text-sm font-bold tracking-[0.15em] uppercase truncate">Audi Portal</span>
|
||||
<span className="text-[10px] text-muted-foreground tracking-widest uppercase truncate">Smart Operations</span>
|
||||
<div className="px-4 py-2">
|
||||
<p className="text-[11px] font-semibold text-gray-800 leading-tight tracking-wide">Rednote Mini App</p>
|
||||
<p className="text-[10px] text-gray-400 leading-tight tracking-widest uppercase">Backend Portal</p>
|
||||
</div>
|
||||
</div>
|
||||
{/* Collapsed: icon only */}
|
||||
<div className="hidden group-data-[collapsible=icon]:flex justify-center py-3">
|
||||
<LogoIconOnly />
|
||||
</div>
|
||||
</SidebarHeader>
|
||||
<SidebarContent>
|
||||
<SidebarGroup>
|
||||
|
||||
31
audi-content-portal/src/components/layout/Logo.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
|
||||
export const Logo: React.FC = () => {
|
||||
return (
|
||||
<div className="flex items-center gap-3">
|
||||
{/* Black badge with Audi logo PNG */}
|
||||
<div className="flex h-10 w-16 items-center justify-center rounded-sm bg-black px-2 shrink-0">
|
||||
<img
|
||||
src="/images/audi_logo.png"
|
||||
alt="Audi"
|
||||
className="h-6 w-auto object-contain"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<span className="text-[13px] font-bold text-gray-900 leading-tight tracking-wide">Audi</span>
|
||||
<span className="text-[10px] text-gray-500 leading-tight tracking-wider uppercase">Rednote Mini App Backend</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const LogoIconOnly: React.FC = () => (
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-sm bg-black">
|
||||
<img
|
||||
src="/images/audi_logo.png"
|
||||
alt="Audi"
|
||||
className="h-5 w-auto object-contain"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as React from "react"
|
||||
import { Settings2 } from "lucide-react"
|
||||
|
||||
import type { RoleView, WorkflowConfig } from "@/App"
|
||||
@@ -25,7 +26,7 @@ export function SystemSettings({
|
||||
<div className="flex flex-col gap-6 p-8">
|
||||
<div className="flex flex-col gap-1">
|
||||
<h1 className="text-3xl font-bold tracking-tight">系统设置</h1>
|
||||
<p className="text-muted-foreground">管理角色视角、审核发布策略与同步规则。</p>
|
||||
<p className="text-muted-foreground">管理角色视角、可选发布能力、私有云账号与导出迁移准备。</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-6 lg:grid-cols-2">
|
||||
@@ -58,8 +59,8 @@ export function SystemSettings({
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">发布策略</CardTitle>
|
||||
<CardDescription>覆盖预发布、撤回与发布时间策略。</CardDescription>
|
||||
<CardTitle className="text-lg font-bold">可选发布能力</CardTitle>
|
||||
<CardDescription>以下能力用于展示成熟平台的扩展性,均不作为本期上线阻断项。</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3 text-sm">
|
||||
<div className="flex items-center justify-between rounded-lg border p-3">
|
||||
@@ -135,35 +136,16 @@ export function SystemSettings({
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">内容与同步规则</CardTitle>
|
||||
<CardDescription>配置字段模板与同步任务策略。</CardDescription>
|
||||
<CardTitle className="text-lg font-bold">官网周更规则</CardTitle>
|
||||
<CardDescription>当前口径为每周人工巡检和人工更新,不展示自动日更能力。</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3 text-sm">
|
||||
<div className="grid gap-2">
|
||||
<span className="text-muted-foreground">同步频率</span>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant={workflowConfig.syncFrequency === "daily" ? "default" : "outline"}
|
||||
onClick={() =>
|
||||
onWorkflowConfigChange({ ...workflowConfig, syncFrequency: "daily" })
|
||||
}
|
||||
>
|
||||
每日
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant={workflowConfig.syncFrequency === "weekly" ? "default" : "outline"}
|
||||
onClick={() =>
|
||||
onWorkflowConfigChange({ ...workflowConfig, syncFrequency: "weekly" })
|
||||
}
|
||||
>
|
||||
每周
|
||||
</Button>
|
||||
</div>
|
||||
<span className="text-muted-foreground">执行频率</span>
|
||||
<Badge variant="outline" className="w-fit">固定为每周人工巡检</Badge>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<span className="text-muted-foreground">同步执行时间</span>
|
||||
<span className="text-muted-foreground">建议执行时间</span>
|
||||
<Input
|
||||
type="time"
|
||||
value={workflowConfig.syncExecutionTime}
|
||||
@@ -176,7 +158,7 @@ export function SystemSettings({
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<span className="text-muted-foreground">失败重试次数</span>
|
||||
<span className="text-muted-foreground">异常重试次数</span>
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
@@ -191,7 +173,7 @@ export function SystemSettings({
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between rounded-lg border p-3">
|
||||
<span>同步后人工确认</span>
|
||||
<span>更新后人工确认</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant={workflowConfig.manualConfirmSync ? "default" : "outline"}
|
||||
@@ -206,11 +188,53 @@ export function SystemSettings({
|
||||
</Button>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
需要确认:同步完成后进入待确认队列,由项目与运维负责人核查差异摘要并手动放行。
|
||||
需要确认:周更完成后进入待确认队列,由项目与运维负责人核查差异摘要并手动放行。
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">私有云账号与访问</CardTitle>
|
||||
<CardDescription>展示平台部署和后台登录的基础准备项。</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3 text-sm">
|
||||
<div className="grid gap-2">
|
||||
<span className="text-muted-foreground">后台访问地址</span>
|
||||
<Input defaultValue="https://portal.audi-private-cloud.example" />
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<span className="text-muted-foreground">账号开通原则</span>
|
||||
<Input defaultValue="按角色开通账号,最小权限访问" />
|
||||
</div>
|
||||
<div className="flex items-center justify-between rounded-lg border p-3">
|
||||
<span>专有云环境状态</span>
|
||||
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200">已纳入部署方案</Badge>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">导出与迁移准备</CardTitle>
|
||||
<CardDescription>用于说明内容平台后续迁移到 Audi 其他平台时的交接能力。</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3 text-sm">
|
||||
<div className="flex items-center justify-between rounded-lg border p-3">
|
||||
<span>内容全量导出</span>
|
||||
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200">支持</Badge>
|
||||
</div>
|
||||
<div className="flex items-center justify-between rounded-lg border p-3">
|
||||
<span>素材打包导出</span>
|
||||
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200">支持</Badge>
|
||||
</div>
|
||||
<div className="flex items-center justify-between rounded-lg border p-3">
|
||||
<span>配置与日志交接</span>
|
||||
<Badge variant="outline" className="bg-emerald-50 text-emerald-700 border-emerald-200">支持</Badge>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="border-none shadow-sm bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-bold">变更与审计</CardTitle>
|
||||
|
||||
@@ -26,12 +26,10 @@ type UserRecord = {
|
||||
}
|
||||
|
||||
type PermissionKey =
|
||||
| "dashboard.view"
|
||||
| "source.sync"
|
||||
| "content.edit"
|
||||
| "content.approve"
|
||||
| "content.publish"
|
||||
| "leads.manage"
|
||||
| "settings.manage"
|
||||
| "users.manage"
|
||||
|
||||
@@ -76,12 +74,10 @@ const INITIAL_USERS: UserRecord[] = [
|
||||
]
|
||||
|
||||
const PERMISSION_LABEL: Record<PermissionKey, string> = {
|
||||
"dashboard.view": "查看仪表盘",
|
||||
"source.sync": "车型同步",
|
||||
"source.sync": "官网车型库",
|
||||
"content.edit": "内容编辑",
|
||||
"content.approve": "内容审核",
|
||||
"content.publish": "内容发布",
|
||||
"leads.manage": "潜客管理",
|
||||
"settings.manage": "系统设置",
|
||||
"users.manage": "用户与权限管理",
|
||||
}
|
||||
@@ -90,26 +86,21 @@ const INITIAL_ROLE_PERMISSIONS: RolePermission[] = [
|
||||
{
|
||||
roleName: "业务/市场负责人",
|
||||
permissions: [
|
||||
"dashboard.view",
|
||||
"content.approve",
|
||||
"content.publish",
|
||||
"leads.manage",
|
||||
],
|
||||
},
|
||||
{
|
||||
roleName: "内容运营专员",
|
||||
permissions: [
|
||||
"dashboard.view",
|
||||
"source.sync",
|
||||
"content.edit",
|
||||
"content.publish",
|
||||
"leads.manage",
|
||||
],
|
||||
},
|
||||
{
|
||||
roleName: "项目与运维负责人",
|
||||
permissions: [
|
||||
"dashboard.view",
|
||||
"source.sync",
|
||||
"settings.manage",
|
||||
"users.manage",
|
||||
@@ -118,12 +109,10 @@ const INITIAL_ROLE_PERMISSIONS: RolePermission[] = [
|
||||
]
|
||||
|
||||
const PERMISSION_COLUMNS: PermissionKey[] = [
|
||||
"dashboard.view",
|
||||
"source.sync",
|
||||
"content.edit",
|
||||
"content.approve",
|
||||
"content.publish",
|
||||
"leads.manage",
|
||||
"settings.manage",
|
||||
"users.manage",
|
||||
]
|
||||
@@ -168,7 +157,7 @@ export function UserAccessManagement() {
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex flex-col gap-1">
|
||||
<h1 className="text-3xl font-bold tracking-tight">用户与权限管理</h1>
|
||||
<p className="text-muted-foreground">集中维护账号状态、角色定义与权限边界。</p>
|
||||
<p className="text-muted-foreground">集中维护后台账号状态、角色定义与内容平台权限边界。</p>
|
||||
</div>
|
||||
<Button className="bg-audi-black hover:bg-audi-dark-gray text-white px-6">新增用户</Button>
|
||||
</div>
|
||||
|
||||
@@ -11,6 +11,7 @@ const __dirname = dirname(__filename);
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, '.', '');
|
||||
return {
|
||||
base: './',
|
||||
plugins: [react(), tailwindcss()],
|
||||
define: {
|
||||
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
||||
|
||||