From 90f29da343089298a952fdd17d70873cfe137d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Mon, 11 Aug 2025 11:18:02 +0800 Subject: [PATCH] =?UTF-8?q?FEAT=20=3D>=20=E6=9C=AC=E6=AC=A1=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=A1=B9=E7=9B=AE=E4=B8=BA=EF=BC=9A=E5=B0=86=20Friend?= =?UTF-8?q?Selection=20=E7=BB=84=E4=BB=B6=E7=9A=84=20selectedOptions=20?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=80=89=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E5=9C=A8=E7=9B=B8=E5=85=B3=E7=BB=84=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=9B=B8=E5=BA=94=E8=B0=83=E6=95=B4=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E6=8F=90=E5=8D=87=E4=BB=A3=E7=A0=81=E7=9A=84=E7=81=B5?= =?UTF-8?q?=E6=B4=BB=E6=80=A7=E5=92=8C=E5=8F=AF=E8=AF=BB=E6=80=A7=E3=80=82?= =?UTF-8?q?=E5=90=8C=E6=97=B6=EF=BC=8C=E6=9B=B4=E6=96=B0=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=BB=A5=E7=BB=9F=E4=B8=80=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nkebao/src/components/FriendSelection/data.ts | 2 +- nkebao/src/components/FriendSelection/index.tsx | 12 ++++++------ nkebao/src/pages/mobile/content/form/index.tsx | 2 +- nkebao/src/pages/mobile/content/list/index.tsx | 2 +- nkebao/src/pages/mobile/mine/content/form/index.tsx | 4 ++-- nkebao/src/pages/mobile/mine/content/list/index.tsx | 7 ++----- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/nkebao/src/components/FriendSelection/data.ts b/nkebao/src/components/FriendSelection/data.ts index 42f57f743..30b9ec700 100644 --- a/nkebao/src/components/FriendSelection/data.ts +++ b/nkebao/src/components/FriendSelection/data.ts @@ -8,7 +8,7 @@ export interface FriendSelectionItem { // 组件属性接口 export interface FriendSelectionProps { - selectedOptions: FriendSelectionItem[]; + selectedOptions?: FriendSelectionItem[]; onSelect: (friends: FriendSelectionItem[]) => void; deviceIds?: string[]; enableDeviceFilter?: boolean; diff --git a/nkebao/src/components/FriendSelection/index.tsx b/nkebao/src/components/FriendSelection/index.tsx index efdcad64d..63c04a458 100644 --- a/nkebao/src/components/FriendSelection/index.tsx +++ b/nkebao/src/components/FriendSelection/index.tsx @@ -7,7 +7,7 @@ import { FriendSelectionProps } from "./data"; import SelectionPopup from "./selectionPopup"; export default function FriendSelection({ - selectedOptions, + selectedOptions = [], onSelect, deviceIds = [], enableDeviceFilter = true, @@ -39,14 +39,14 @@ export default function FriendSelection({ // 获取显示文本 const getDisplayText = () => { - if (selectedOptions.length === 0) return ""; + if (!selectedOptions || selectedOptions.length === 0) return ""; return `已选择 ${selectedOptions.length} 个好友`; }; // 删除已选好友 const handleRemoveFriend = (id: number) => { if (readonly) return; - onSelect(selectedOptions.filter(v => v.id !== id)); + onSelect((selectedOptions || []).filter(v => v.id !== id)); }; // 弹窗确认回调 @@ -80,7 +80,7 @@ export default function FriendSelection({ )} {/* 已选好友列表窗口 */} - {showSelectedList && selectedOptions.length > 0 && ( + {showSelectedList && (selectedOptions || []).length > 0 && (
- {selectedOptions.map(friend => ( + {(selectedOptions || []).map(friend => (
@@ -128,7 +128,7 @@ export default function FriendSelection({ { }, [fetchLibraries]); const handleCreateNew = () => { - navigate("/content/new"); + navigate("/mine/content/new"); }; const handleEdit = (id: string) => { diff --git a/nkebao/src/pages/mobile/mine/content/form/index.tsx b/nkebao/src/pages/mobile/mine/content/form/index.tsx index d51e646de..ccc279875 100644 --- a/nkebao/src/pages/mobile/mine/content/form/index.tsx +++ b/nkebao/src/pages/mobile/mine/content/form/index.tsx @@ -123,7 +123,7 @@ export default function ContentForm() { await request("/v1/content/library/create", payload, "POST"); Toast.show({ content: "创建成功", position: "top" }); } - navigate("/content"); + navigate("/mine/content"); } catch (e: any) { Toast.show({ content: e?.message || (isEdit ? "保存失败" : "创建失败"), @@ -195,7 +195,7 @@ export default function ContentForm() { > diff --git a/nkebao/src/pages/mobile/mine/content/list/index.tsx b/nkebao/src/pages/mobile/mine/content/list/index.tsx index a601710cf..0933c7509 100644 --- a/nkebao/src/pages/mobile/mine/content/list/index.tsx +++ b/nkebao/src/pages/mobile/mine/content/list/index.tsx @@ -128,7 +128,7 @@ const ContentLibraryList: React.FC = () => { }, [fetchLibraries]); const handleCreateNew = () => { - navigate("/content/new"); + navigate("/mine/content/new"); }; const handleEdit = (id: string) => { @@ -171,10 +171,6 @@ const ContentLibraryList: React.FC = () => { navigate(`/content/materials/${id}`); }; - const handleSearch = () => { - fetchLibraries(); - }; - const handleRefresh = () => { fetchLibraries(); }; @@ -191,6 +187,7 @@ const ContentLibraryList: React.FC = () => { <> navigate("/mine")} right={