From f5b80f616e98a8e6c2adfe2f6203d7324418b310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AC=94=E8=AE=B0=E6=9C=AC=E9=87=8C=E7=9A=84=E6=B0=B8?= =?UTF-8?q?=E5=B9=B3?= Date: Thu, 24 Jul 2025 21:37:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9C=AC=E6=AC=A1=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E5=A6=82=E4=B8=8B=20?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E9=A1=B9=E7=9B=AE=E6=9E=84=E5=BB=BA=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/workspace/moments-sync/new.tsx | 6 +- nkebao/.env.development | 4 +- nkebao/src/pages/content/form/index.tsx | 565 ++++++++-------- .../workspace/auto-like/record/index.tsx | 618 +++++++++--------- 4 files changed, 624 insertions(+), 569 deletions(-) diff --git a/Cunkebao/src/pages/workspace/moments-sync/new.tsx b/Cunkebao/src/pages/workspace/moments-sync/new.tsx index 188d321c..b28bff06 100644 --- a/Cunkebao/src/pages/workspace/moments-sync/new.tsx +++ b/Cunkebao/src/pages/workspace/moments-sync/new.tsx @@ -357,7 +357,9 @@ export default function NewMomentsSyncTask() { > -

新建朋友圈同步

+

+ {isEditMode ? "编辑朋友圈同步" : "新建朋友圈同步"} +

@@ -436,7 +438,7 @@ export default function NewMomentsSyncTask() { loading={loading} className="flex-1 h-12 bg-blue-500 hover:bg-blue-600 rounded-lg text-white" > - {loading ? "创建中..." : "完成"} + {loading ? (isEditMode ? "保存中..." : "创建中...") : "完成"} diff --git a/nkebao/.env.development b/nkebao/.env.development index da6a111b..6d0e088c 100644 --- a/nkebao/.env.development +++ b/nkebao/.env.development @@ -1,4 +1,6 @@ # 基础环境变量示例 -VITE_API_BASE_URL=http://www.yishi.com +# VITE_API_BASE_URL=http://www.yishi.com +VITE_API_BASE_URL=https://ckbapi.quwanzhi.com + VITE_APP_TITLE=Nkebao Base diff --git a/nkebao/src/pages/content/form/index.tsx b/nkebao/src/pages/content/form/index.tsx index 49ea7a06..ff099ed5 100644 --- a/nkebao/src/pages/content/form/index.tsx +++ b/nkebao/src/pages/content/form/index.tsx @@ -1,257 +1,308 @@ -import React, { useState } from "react"; -import { useNavigate } from "react-router-dom"; -import { Input as AntdInput, Switch } from "antd"; -import { Button, Collapse, Toast, DatePicker, Tabs } from "antd-mobile"; -import NavCommon from "@/components/NavCommon"; -import FriendSelection from "@/components/FriendSelection"; -import GroupSelection from "@/components/GroupSelection"; -import Layout from "@/components/Layout/Layout"; -import style from "./index.module.scss"; -import request from "@/api/request"; - -const { TextArea } = AntdInput; - -function formatDate(date: Date | null) { - if (!date) return ""; - // 格式化为 YYYY-MM-DD - const y = date.getFullYear(); - const m = (date.getMonth() + 1).toString().padStart(2, "0"); - const d = date.getDate().toString().padStart(2, "0"); - return `${y}-${m}-${d}`; -} - -export default function ContentForm() { - const navigate = useNavigate(); - const [sourceType, setSourceType] = useState<"friends" | "groups">("friends"); - const [name, setName] = useState(""); - const [selectedFriends, setSelectedFriends] = useState([]); - const [selectedGroups, setSelectedGroups] = useState([]); - const [useAI, setUseAI] = useState(false); - const [aiPrompt, setAIPrompt] = useState(""); - const [enabled, setEnabled] = useState(true); - const [dateRange, setDateRange] = useState<[Date | null, Date | null]>([ - null, - null, - ]); - const [showStartPicker, setShowStartPicker] = useState(false); - const [showEndPicker, setShowEndPicker] = useState(false); - const [keywordsInclude, setKeywordsInclude] = useState(""); - const [keywordsExclude, setKeywordsExclude] = useState(""); - const [submitting, setSubmitting] = useState(false); - - const handleSubmit = async (e?: React.FormEvent) => { - if (e) e.preventDefault(); - if (!name.trim()) { - Toast.show({ content: "请输入内容库名称", position: "top" }); - return; - } - setSubmitting(true); - try { - const payload = { - name, - sourceType: sourceType === "friends" ? 1 : 2, - friends: selectedFriends, - groups: selectedGroups, - groupMembers: {}, - keywordInclude: keywordsInclude - .split(/,|,|\n|\s+/) - .map((s) => s.trim()) - .filter(Boolean), - keywordExclude: keywordsExclude - .split(/,|,|\n|\s+/) - .map((s) => s.trim()) - .filter(Boolean), - aiPrompt, - timeEnabled: dateRange[0] || dateRange[1] ? 1 : 0, - startTime: dateRange[0] ? formatDate(dateRange[0]) : "", - endTime: dateRange[1] ? formatDate(dateRange[1]) : "", - status: enabled ? 1 : 0, - }; - await request("/v1/content/library/create", payload, "POST"); - Toast.show({ content: "创建成功", position: "top" }); - navigate("/content"); - } catch (e: any) { - Toast.show({ content: e?.message || "创建失败", position: "top" }); - } finally { - setSubmitting(false); - } - }; - - return ( - } - footer={ -
- -
- } - > -
-
e.preventDefault()} - autoComplete="off" - > -
- - setName(e.target.value)} - className={style["input"]} - /> -
- -
数据来源配置
-
- setSourceType(key as "friends" | "groups")} - className={style["tabs-bar"]} - > - - - - - - - -
- - - 关键词设置} - > -
- -