From 61bcbf279029e7579b97b89809868d80b88b6656 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Wed, 21 May 2025 09:27:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=BA=93=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[id]/materials/edit/[materialId]/page.tsx | 367 +++++++++++----- .../app/content/[id]/materials/new/page.tsx | 411 +++++++++++------- .../api/controller/WebSocketController.php | 6 +- Server/application/cunkebao/config/route.php | 3 +- .../controller/ContentLibraryController.php | 24 +- 5 files changed, 540 insertions(+), 271 deletions(-) diff --git a/Cunkebao/app/content/[id]/materials/edit/[materialId]/page.tsx b/Cunkebao/app/content/[id]/materials/edit/[materialId]/page.tsx index e8188f913..174e36ac2 100644 --- a/Cunkebao/app/content/[id]/materials/edit/[materialId]/page.tsx +++ b/Cunkebao/app/content/[id]/materials/edit/[materialId]/page.tsx @@ -4,7 +4,7 @@ import type React from "react" import { useState, useEffect, use } from "react" import { useRouter } from "next/navigation" -import { ChevronLeft, Plus, X, Image as ImageIcon, UploadCloud, Link, Video, FileText, Layers } from "lucide-react" +import { ChevronLeft, Plus, X, Image as ImageIcon, UploadCloud, Link, Video, FileText, Layers, CalendarDays, ChevronDown } from "lucide-react" import { Card } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Textarea } from "@/components/ui/textarea" @@ -40,6 +40,9 @@ interface Material { location: string | null lat: string lng: string + comment: string | null + icon: string | null + videoUrl?: string } const isImageUrl = (url: string) => { @@ -65,6 +68,11 @@ export default function EditMaterialPage({ params }: { params: Promise<{ id: str const [originalMaterial, setOriginalMaterial] = useState(null) const [materialType, setMaterialType] = useState(1) // 默认为图片类型 const [url, setUrl] = useState("") + const [title, setTitle] = useState("") + const [iconUrl, setIconUrl] = useState("") + const [videoUrl, setVideoUrl] = useState("") + const [publishTime, setPublishTime] = useState("") + const [comment, setComment] = useState("") // 获取素材详情 useEffect(() => { @@ -77,6 +85,10 @@ export default function EditMaterialPage({ params }: { params: Promise<{ id: str const material = response.data setOriginalMaterial(material) setContent(material.content) + setTitle(material.title || "") + setIconUrl(material.icon || "") + setVideoUrl(material.videoUrl || "") + setComment(material.comment || "") // 设置素材类型 setMaterialType(Number(material.type) || 1) @@ -166,6 +178,10 @@ export default function EditMaterialPage({ params }: { params: Promise<{ id: str id: resolvedParams.materialId, type: materialType, content: content, + title: materialType === 2 ? title : undefined, + icon: materialType === 2 ? iconUrl : undefined, + videoUrl: materialType === 3 ? videoUrl : undefined, + comment: comment, } // 根据类型添加不同的字段 @@ -215,145 +231,270 @@ export default function EditMaterialPage({ params }: { params: Promise<{ id: str
- -
- {/* 素材类型选择器 */} -
- -
- {MATERIAL_TYPES.map((type) => ( -