ananzhusen 1 жил өмнө
parent
commit
f50966ff0a

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

@@ -1056,7 +1056,7 @@ const dragStart = async (event: DragEvent | MouseEvent|TouchEvent, item: any) =>
   dropped = false;
 
   let data = null;
-  const id = item._id || item.id;
+  const id = item.id || item._id;
   let isAsync: boolean;
   if (
     activeAssets.value === 'user' &&
@@ -1071,7 +1071,7 @@ const dragStart = async (event: DragEvent | MouseEvent|TouchEvent, item: any) =>
     //方案
     data = item.data || item;
   } else if (item['3d']) {
-    const res: any = await getLe5le3d(item._id || item.id, {
+    const res: any = await getLe5le3d(item.id || item._id, {
       image: 1,
       _id: 1,
       name: 1,
@@ -1095,7 +1095,7 @@ const dragStart = async (event: DragEvent | MouseEvent|TouchEvent, item: any) =>
       height: meta2d.store.data.height || meta2d.store.options.height,
       externElement: true,
       thumbImg: res.image,
-      iframe: 'https://view3d.le5le.com/?id=' + (item._id || item.id),
+      iframe: 'https://view3d.le5le.com/?id=' + (item.id || item._id),
     };
   } else if (item.component) {
     // 默认
@@ -1180,7 +1180,7 @@ const open = async (item: any) => {
       path: '/',
       query: {
         r: Date.now() + '',
-        id: item._id,
+        id:item.id || item._id,
       },
     });
   } else {
@@ -1390,7 +1390,7 @@ const _createFoder = async () => {
       });
       if (ret) {
         editedFolder.value.name = editedFolder.value.label;
-        editedFolder.value._id = ret._id || ret.id;
+        editedFolder.value._id = ret.id || ret._id;
         editedFolder.value.edited = false;
       }
     }
@@ -1496,7 +1496,7 @@ const delDialog = reactive<any>({
 });
 // TODO 右键菜单移动图纸
 const onMenu = async (val: string) => {
-  const id = contextmenu.component._id || contextmenu.component.id;
+  const id = contextmenu.component.id || contextmenu.component._id;
   setTimeout(() => {
     contextmenu.group = '';
     contextmenu.component = {};
@@ -1531,7 +1531,7 @@ const onMenu = async (val: string) => {
         }
         window.open(url + id, '_blank');
       } else {
-        if (contextmenu.group._id && contextmenu.group.name !== '默认') {
+        if ((contextmenu.group.id||contextmenu.group._id) && contextmenu.group.name !== '默认') {
           setFolder(contextmenu.group);
         }
         autoSave();
@@ -1750,7 +1750,7 @@ const delComponent = async () => {
       delDialog.contextmenuObj.component.id;
     delDialog.contextmenuObj.group.list.forEach(
       (item: any, index: number, arr: any[]) => {
-        if (id && (id === item._id || id === item.id)) {
+        if (id && (id === item.id || id === item._id)) {
           arr.splice(index, 1);
         }
         if (!id) {
@@ -1793,7 +1793,7 @@ const drop = (obj: any) => {
 const onSubmitOrder = async () => {
   const result: any = await axios.post('/api/order/datas/submit', {
     collection: 'v',
-    id: chargeDialog.data._id,
+    id: chargeDialog.data.id||chargeDialog.data._id,
   });
   if (result) {
     wechatPayDialog.order = result;
@@ -1960,7 +1960,7 @@ const delFolder = async (item: any) => {
     return;
   }
 
-  const id = item._id || item.id;
+  const id = item.id || item._id;
   let ret: any;
   if (activeAssets.value !== 'user') {
     return;

+ 2 - 0
src/views/components/Header.vue

@@ -596,6 +596,7 @@ const openZip = async (file: File) => {
 const downloadJson = () => {
   const data: Meta2dBackData = meta2d.data();
   if (data._id) delete data._id;
+  if (data.id) delete data.id;
   checkData(data);
   import('file-saver').then(({ saveAs }) => {
     saveAs(
@@ -638,6 +639,7 @@ const downloadZip = async () => {
     'le5le.meta2d';
   const _zip = zip.folder(`${_fileName}`);
   if (data._id) delete data._id;
+  if (data.id) delete data.id;
   checkData(data);
   _zip.file(
     `${_fileName}.json`,

+ 4 - 4
src/views/components/View.vue

@@ -1197,11 +1197,11 @@ const preview = async () => {
   // @ts-ignore
   const data: Meta2dBackData = meta2d.data();
   checkData(data);
-  if (dot && user && data._id) {
+  if (dot && user && data.id) {
     // 有 id ,是修改后保存
     await save(SaveType.Save);
   }
-  if (!data._id) {
+  if (!data.id) {
     await localforage.setItem(localStorageName, JSON.stringify(data));
   }
   // router.push({
@@ -1214,8 +1214,8 @@ const preview = async () => {
   let screenWidth = window.screen.width;
   let screenHeight = window.screen.height;
   let url = `/preview?r=${Date.now() + ''}`;
-  if (data._id) {
-    url += `&id=${data._id}`;
+  if (data.id) {
+    url += `&id=${data.id}`;
   }
   window.open(
     url,