浏览代码

token联登问题修改

huiqi 3 月之前
父节点
当前提交
f0b7d69ff0
共有 3 个文件被更改,包括 48 次插入36 次删除
  1. 3 3
      src/apis/config.ts
  2. 1 0
      src/pages/deepseek/questionAnswer/info/index.tsx
  3. 44 33
      src/pages/deepseek/questionAnswer/list/index.tsx

+ 3 - 3
src/apis/config.ts

@@ -7,12 +7,12 @@ const config = {
 };
 
 export const getHeaders = () => {
-    const headers: { 'token'?: string } = {};
+    const headers: { 'Authorization'?: string } = {};
     const token = LocalStorage.getToken();
     if (token) {
-        headers['token'] = token;
+        headers['Authorization'] = token;
     }
     return headers;
 };
 
-export default config;
+export default config;

+ 1 - 0
src/pages/deepseek/questionAnswer/info/index.tsx

@@ -451,6 +451,7 @@ const QuestionAnswerInfo: React.FC = () => {
                                         options={appProjectList}
                                         placeholder="请选择项目"
                                         showSearch
+                                        className="questionAnswerInfo-content-title"
                                     />
                                 </FormItem>
                             </>

+ 44 - 33
src/pages/deepseek/questionAnswer/list/index.tsx

@@ -17,7 +17,7 @@ import {
   Space,
   Row,
   Col,
-  Input
+  Input, Cascader
 } from 'antd';
 import {
   PlusOutlined,
@@ -251,14 +251,17 @@ const QuestionAnswerList: React.FC = () => {
   const appProTypeApi = {
     fetchAppProType: async () => {
       try {
-        const res = await apis.fetchTakaiAppTypeList('project_type');
-        const list = res.data.map((item: any) => {
-          return {
-            label: item.dictLabel,
-            value: item.dictCode,
-          }
-        });
+        const res = await apis.fetchTakaiAppTypeList('projectTree');
+        const list: AppTypeList = res.data;
         setAppProjectList(list);
+        // const res = await apis.fetchTakaiAppTypeList('projectTree');
+        // const list = res.data.map((item: any) => {
+        //   return {
+        //     label: item.dictLabel,
+        //     value: item.dictCode,
+        //   }
+        // });
+        // setAppProjectList(list);
       } catch (error: any) {
         console.error(error);
       }
@@ -351,6 +354,9 @@ const QuestionAnswerList: React.FC = () => {
       if (values.typeId === '全部') {
         values.typeId = null;
       }
+      if(values.projectId instanceof Array && values.projectId.length == 2) {
+          values.projectId = values.projectId[1];
+      }
       await indexApi.fetchIndex(values.typeId, values.projectId);
       await appApi.fetchList(values.typeId, values.projectId);
     }).catch((error) => {
@@ -507,29 +513,34 @@ const QuestionAnswerList: React.FC = () => {
                             ))
                         } */ }
           <FormItem name='projectId'>
-            <Select
-              placeholder='请选择项目'
-              allowClear
-              onChange={(value) => {
-                // 项目选择器自动提交逻辑
-                const currentTypeId = form.getFieldValue('typeId');
-                const typeId = currentTypeId === '全部' ? null : currentTypeId;
-                appApi.fetchList(typeId, value);
-                indexApi.fetchIndex(typeId, value);
-              }}
-            >
-              {
-                projectList.map((item, index) => {
-                  return <Option value={item.value} key={index}>
-                    {item.label}
-                  </Option>
-                })
-              }
-            </Select>
-          </FormItem>
-          <FormItem name='keyword'>
-            <Input placeholder='请输入关键字' allowClear />
+            <Cascader
+                options={appProjectList}
+                placeholder="请选择项目"
+                showSearch
+            />
+            {/*<Select*/}
+            {/*  placeholder='请选择项目'*/}
+            {/*  allowClear*/}
+            {/*  onChange={(value) => {*/}
+            {/*    // 项目选择器自动提交逻辑*/}
+            {/*    const currentTypeId = form.getFieldValue('typeId');*/}
+            {/*    const typeId = currentTypeId === '全部' ? null : currentTypeId;*/}
+            {/*    appApi.fetchList(typeId, value);*/}
+            {/*    indexApi.fetchIndex(typeId, value);*/}
+            {/*  }}*/}
+            {/*>*/}
+            {/*  {*/}
+            {/*    projectList.map((item, index) => {*/}
+            {/*      return <Option value={item.value} key={index}>*/}
+            {/*        {item.label}*/}
+            {/*      </Option>*/}
+            {/*    })*/}
+            {/*  }*/}
+            {/*</Select>*/}
           </FormItem>
+          {/*<FormItem name='keyword'>*/}
+          {/*  <Input placeholder='请输入关键字' allowClear />*/}
+          {/*</FormItem>*/}
           <FormItem>
             <Space size={12}>
               <Tooltip title="重置">
@@ -552,7 +563,7 @@ const QuestionAnswerList: React.FC = () => {
 
           {/* {
                 createFlag && (
-                    
+
                     <div style={ { marginLeft: 'auto' } }>
                       <Button type='primary'
                               icon={ <PlusOutlined /> }
@@ -561,7 +572,7 @@ const QuestionAnswerList: React.FC = () => {
                               } }>创建问答应用</Button>
                     </div>
                 )
-            } 
+            }
              */}
           {/* 创建按钮已移至面包屑组件 */}
 
@@ -817,4 +828,4 @@ const QuestionAnswerList: React.FC = () => {
   )
 };
 
-export default observer(QuestionAnswerList);
+export default observer(QuestionAnswerList);