Przeglądaj źródła

feat:右键菜单跳转3d可视化

ananzhusen 9 miesięcy temu
rodzic
commit
dc9de96d56
1 zmienionych plików z 18 dodań i 0 usunięć
  1. 18 0
      src/views/components/ContextMenu.vue

+ 18 - 0
src/views/components/ContextMenu.vue

@@ -14,6 +14,7 @@
     <template v-if="props.type === 'pen'">
     <template v-if="props.type === 'pen'">
       <t-menu-item v-if="!selections.mode&&hasC()" value="updateC"> 一键更新我的组件 </t-menu-item>
       <t-menu-item v-if="!selections.mode&&hasC()" value="updateC"> 一键更新我的组件 </t-menu-item>
       <t-menu-item v-if="isAppend()" value="appendChild"> 追加状态 </t-menu-item>
       <t-menu-item v-if="isAppend()" value="appendChild"> 追加状态 </t-menu-item>
+      <t-menu-item v-if="is3D()" value="goto3d"> 进入3D可视化编辑 </t-menu-item>
       <t-menu-item v-if="isTableNoFocus()" value="focus"> 
       <t-menu-item v-if="isTableNoFocus()" value="focus"> 
         <div class="flex">进入编辑模式<span class="flex-grow"></span>Enter</div>
         <div class="flex">进入编辑模式<span class="flex-grow"></span>Enter</div>
       </t-menu-item>
       </t-menu-item>
@@ -79,6 +80,7 @@ import { onMounted, ref } from 'vue';
 import { LockState, Pen, PenType } from '@meta2d/core';
 import { LockState, Pen, PenType } from '@meta2d/core';
 import { useSelection, SelectionMode } from '@/services/selections';
 import { useSelection, SelectionMode } from '@/services/selections';
 import { updateC } from '@/services/updateC';
 import { updateC } from '@/services/updateC';
+import { rootDomain, isDownload } from '@/services/defaults';
 
 
 const props = defineProps({
 const props = defineProps({
   type: String,
   type: String,
@@ -189,6 +191,18 @@ const onMenu = (val: string) => {
     case 'unFocus':
     case 'unFocus':
       meta2d.store.active[0].calculative.focus = false;
       meta2d.store.active[0].calculative.focus = false;
       break;
       break;
+    case 'goto3d':
+    let id = meta2d?.store.active[0].iframe.split("id=")[1];
+    let url = `https://3d${rootDomain}/?id=`;
+    if(isDownload){
+      //安装包
+      url = location.origin+ `/3d/?id=`;
+    }
+    if (window.url3D) {
+      url = window.url3D;
+    }
+    window.open(url + id, '_blank');
+    break;
   }
   }
 
 
   emit('changeVisible', false);
   emit('changeVisible', false);
@@ -210,6 +224,10 @@ const isTableFocus =() => {
   return meta2d?.store.active.length === 1 && meta2d?.store.active[0].name === "tablePlus" && meta2d?.store.active[0].calculative.focus;
   return meta2d?.store.active.length === 1 && meta2d?.store.active[0].name === "tablePlus" && meta2d?.store.active[0].calculative.focus;
 }
 }
 
 
+const is3D = ()=>{
+  return meta2d?.store.active.length === 1 && meta2d?.store.active[0].name === "iframe" && (meta2d?.store.active[0].iframe.indexOf("3d.") > -1||meta2d?.store.active[0].iframe.indexOf("/3d") > -1);
+}
+
 </script>
 </script>
 
 
 <style lang="postcss" scoped>
 <style lang="postcss" scoped>