Переглянути джерело

基本完成java后端接口的适配

Wind-Breaker1 1 рік тому
батько
коміт
a39b13e2b0

+ 58 - 46
src/views/components/Graphics.vue

@@ -707,15 +707,15 @@ const getCollectionImageList = async (name?: string, collection?: string, userFl
     //   tags: name !== '组件' ? name : undefined,
     // },
     userFlag,
-    projection: {
-      image: 1,
-      id: 1,
-      name: 1,
-      tags: 1,
-      folder: 1,
-      component: 1,
-      filename: 1,
-    },
+    // projection: {
+    //   image: 1,
+    //   id: 1,
+    //   name: 1,
+    //   tags: 1,
+    //   folder: 1,
+    //   component: 1,
+    //   filename: 1,
+    // },
   };
   const config = {
     params: {
@@ -907,12 +907,13 @@ const getPrivateGroups = async () => {
   let ret: any = await axios.post(
     '/api/data/folders/list',
     {
-      projection: {
-        image: 1,
-        _id: 1,
-        name: 1,
-        list: 1,
-      },
+      // projection: {
+      //   image: 1,
+      //   _id: 1,
+      //   name: 1,
+      //   list: 1,
+      // },
+      projection:'image,_id,name,list',
       // query: {
       //   type: `v-components`,
       // },
@@ -953,12 +954,13 @@ const getUserComponents = async () => {
   let ret: any = await axios.post(
     '/api/data/folders/list',
     {
-      projection: {
-        image: 1,
-        _id: 1,
-        name: 1,
-        list: 1,
-      },
+      // projection: {
+      //   image: 1,
+      //   _id: 1,
+      //   name: 1,
+      //   list: 1,
+      // },
+      projection:'image,_id,name,list',
       // query: {
       //   type: `v.component`,
       // },
@@ -993,12 +995,13 @@ const getUserProjects = async (type: string) => {
   let ret: any = await axios.post(
     '/api/data/folders/list',
     {
-      projection: {
-        image: 1,
-        _id: 1,
-        name: 1,
-        list: 1,
-      },
+      // projection: {
+      //   image: 1,
+      //   _id: 1,
+      //   name: 1,
+      //   list: 1,
+      // },
+      projection:'image,_id,name,list',
       // query: {
       //   type,
       // },
@@ -1027,12 +1030,13 @@ const getPrivateProjects = async (type: string) => {
           //   folder: '',
           //   tags: type === 'v-template' ? '模板' : '方案',
           // },
-          projection: {
-            image: 1,
-            _id: 1,
-            name: 1,
-            tags: 1,
-          },
+          // projection: {
+          //   image: 1,
+          //   _id: 1,
+          //   name: 1,
+          //   tags: 1,
+          // },
+          projection:'image,_id,name,tags'
         };
         const config = {
           params: {
@@ -1222,12 +1226,13 @@ const getPrivateGraphics = async () => {
       if (item.name === '默认') {
         const data = {
           // query: { folder: '' },
-          projection: {
-            image: 1,
-            _id: 1,
-            name: 1,
-            component: 1,
-          },
+          // projection: {
+          //   image: 1,
+          //   _id: 1,
+          //   name: 1,
+          //   component: 1,
+          // },
+          projection:'image,_id,name,component'
         };
         const config = {
           params: {
@@ -1241,11 +1246,12 @@ const getPrivateGraphics = async () => {
         }
       } else if (item.name === '3D') {
         const data = {
-          projection: {
-            image: 1,
-            _id: 1,
-            name: 1,
-          },
+          // projection: {
+          //   image: 1,
+          //   _id: 1,
+          //   name: 1,
+          // },
+          projection:'image,_id,name'
         };
         const config = {
           params: {
@@ -1639,7 +1645,7 @@ const onMenu = async (val: string) => {
       if (imageDrive && filename.startsWith(imageDrive)) {
         filename = filename.slice(imageDrive.length);
       }
-      let fullname: string =
+      let path: string =
         contextmenu.component.filename || contextmenu.component.image;
       //更新缩略图位置
       // await axios.post('/api/files/update', {
@@ -1648,7 +1654,10 @@ const onMenu = async (val: string) => {
       // });
       // 原接口路径是 /api/file/{fullname}
       // 因为img的路径中包含file,所以做如下拼接
-      await axios.patch(`/api${fullname}`, {
+      if(!path.startsWith('/api')) {
+        path = '/api' + path;
+      }
+      await axios.patch(`${path}`, {
         // filenames: [filename],
         directory: `/大屏/${activedGroup.value}/${val || '默认'}`,
       });
@@ -1785,6 +1794,9 @@ const delComponent = async () => {
   if(fullname.startsWith('/file')) {
     fullname = fullname.slice('/file'.length);
   }
+  if(fullname.startsWith('/api/file/')) {
+    fullname = fullname.slice('/api/file/'.length);
+  }
   await axios.post(`/api/files/delete`, {
     fullnames: [fullname],
     physically: false,

+ 6 - 5
src/views/components/PenDatas.vue

@@ -1270,11 +1270,12 @@ const getThumbImg = async () => {
   if (!id) {
     return;
   }
-  let projection = {
-    image: 1,
-    _id: 1,
-    name: 1,
-  };
+  // let projection = {
+  //   image: 1,
+  //   _id: 1,
+  //   name: 1,
+  // };
+  let projection = 'image,_id,name';
   let res: any;
   if (arr[0].indexOf('2d.le5le') !== -1) {
     res = await getLe5le2d(id, projection);

+ 1 - 5
src/views/components/PenProps.vue

@@ -1549,11 +1549,7 @@ const getThumbImg = async () => {
   if (!id) {
     return;
   }
-  let projection = {
-    image: 1,
-    _id: 1,
-    name: 1,
-  };
+  let projection = 'image,_id,name';
   let res: any;
   if (arr[0].indexOf('2d.le5le') !== -1) {
     res = await getLe5le2d(id, projection);

+ 14 - 7
vite.config.ts

@@ -40,14 +40,21 @@ export default defineConfig({
   },
   server: {
     proxy: {
-      '/image': 'http://192.168.110.6:777',
-      '/file': 'http://192.168.110.6:777',
-      '/api': 'http://192.168.110.6:777',
-      '/v/material': 'http://192.168.110.6:777',
-      '/png': 'http://192.168.110.6:777',
-      '/svg': 'http://192.168.110.6:777',
+      // '/image': 'http://192.168.110.6:777',
+      // '/file': 'http://192.168.110.6:777',
+      // '/api': 'http://192.168.110.6:777',
+      // '/v/material': 'http://192.168.110.6:777',
+      // '/png': 'http://192.168.110.6:777',
+      // '/svg': 'http://192.168.110.6:777',
 
-      //java 后端 http://192.168.110.6:8083
+      // java 后端 http://192.168.110.6:8083
+      '/image': 'http://192.168.110.6:8083',
+      '/file': 'http://192.168.110.6:8083',
+      '/api': 'http://192.168.110.6:8083',
+      '/v/material': 'http://192.168.110.6:8083',
+      '/png': 'http://192.168.110.6:8083',
+      '/svg': 'http://192.168.110.6:8083',
+      
       // '/image': 'https://v.le5le.com/',
       // '/file': 'https://v.le5le.com/',
       // '/api': 'https://v.le5le.com/',