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={