Ver Fonte

调整首页获取数据

李富豪 há 7 meses atrás
pai
commit
2ac7232f61
1 ficheiros alterados com 33 adições e 9 exclusões
  1. 33 9
      app/components/DeekSeekHome.tsx

+ 33 - 9
app/components/DeekSeekHome.tsx

@@ -24,6 +24,7 @@ const DeekSeek: React.FC = () => {
             showMenu: string,
             chatMode: string,
             appId: string,
+            children: List[number]['children'],
         }[],
     }[];
 
@@ -66,15 +67,38 @@ const DeekSeek: React.FC = () => {
                                 menu={{
                                     items: item.children.map((child, i) => {
                                         return {
-                                            key: i,
-                                            label: child.title,
-                                            onClick: () => {
-                                                const search = `?showMenu=${child.showMenu}&chatMode=${child.chatMode}&appId=${child.appId}`;
-                                                navigate({
-                                                    pathname: '/knowledgeChat',
-                                                    search: search,
-                                                })
-                                            },
+                                            key: 'child' + i,
+                                            label: <div
+                                                onClick={() => {
+                                                    const search = `?showMenu=${child.showMenu}&chatMode=${child.chatMode}&appId=${child.appId}`;
+                                                    if (child.appId) {
+                                                        navigate({
+                                                            pathname: '/knowledgeChat',
+                                                            search: search,
+                                                        })
+                                                    }
+                                                }}
+                                            >
+                                                {child.title}
+                                            </div>,
+                                            children: child.children ? child.children.map((record, ind) => {
+                                                return {
+                                                    key: 'record' + ind,
+                                                    label: <div
+                                                        onClick={() => {
+                                                            const search = `?showMenu=${record.showMenu}&chatMode=${record.chatMode}&appId=${record.appId}`;
+                                                            if (record.appId) {
+                                                                navigate({
+                                                                    pathname: '/knowledgeChat',
+                                                                    search: search,
+                                                                })
+                                                            }
+                                                        }}
+                                                    >
+                                                        {record.title}
+                                                    </div>
+                                                };
+                                            }) : undefined,
                                         };
                                     })
                                 }}