Prechádzať zdrojové kódy

chore(api): 适配“获取文件列表”接口

ccnnde 2 mesiacov pred
rodič
commit
326c1c6cba
1 zmenil súbory, kde vykonal 10 pridanie a 6 odobranie
  1. 10 6
      src/views/components/Graphics.vue

+ 10 - 6
src/views/components/Graphics.vue

@@ -850,14 +850,14 @@ const groupChange = async (name: string) => {
 const getCollectionImageList = async (name?: string, collection?: string, system?:boolean, template?:boolean) => {
   //1. 获取网盘文件夹
   const fullpath = `/大屏/${name}`;
-  let ret: { list: any[] } = await axios.post('/api/directory/list', {
+  let ret: any[] = await axios.post('/api/directory/list', {
     fullpath,
   });
   if (!ret) {
     return [];
   }
   let list = [];
-  for (let i of ret.list) {
+  for (let i of ret) {
     if (
       i.fullpath !== `${fullpath}/默认` &&
       i.fullpath.split('/').length === 4
@@ -895,7 +895,11 @@ const getCollectionImageList = async (name?: string, collection?: string, system
     },
   };
   //2.请求所有图纸/组件数据
-  const res: any = await getCollectionList(collection, data, config);
+  const res: any = await getCollectionList(collection, {
+    pageIndex: 1,
+    pageSize: 1000,
+    ...data
+  }, {});
 
   //3.将数据对应到云盘文件夹
   const results = [];
@@ -909,7 +913,7 @@ const getCollectionImageList = async (name?: string, collection?: string, system
     }
   }
 
-  for (const item of res.list) {
+  for (const item of res.records) {
     if(collection === 'v.component') {
       item.component = true;
     }
@@ -1022,7 +1026,7 @@ const getCaseProjects = async (name: string, system:boolean, template:boolean, c
   if (!ret) {
     return [];
   }
-  for (const item of ret.list) {
+  for (const item of ret.records) {
     if (!item.id) {
       item.id = item._id;
     }
@@ -1032,7 +1036,7 @@ const getCaseProjects = async (name: string, system:boolean, template:boolean, c
       item.component = true;
     }
   }
-  return ret.list;
+  return ret.records;
 };
 
 // const getUserProjects = async (name: string, current = 1, pageSize = 1000) => {