Browse Source

feat:domain

ananzhusen 1 year ago
parent
commit
e262fc67e8

+ 11 - 17
src/services/common.ts

@@ -13,47 +13,41 @@ import { baseVer } from '@/services/upgrade';
 import { debounce } from './debouce';
 import { deepClone, isDomShapes } from '@meta2d/core';
 import { useSelection } from '@/services/selections';
+import { rootDomain } from './defaults';
 
 const { select } = useSelection();
 
-export const getRootDomain = ()=>{ 
-  const a =location.host.split('.');
-  return `.${a[a.length-2]}.${a[a.length-1]}`
-};
-
-const rootDomin = getRootDomain();
-
 const assets = reactive({
-  home: `https://${rootDomin.slice(1)}`,
-  account: `https://account${rootDomin}',`,
-  '3d': `https://3d${rootDomin}`,
-  '2d': `https://2d${rootDomin}`,
+  home: `https://${rootDomain.slice(1)}`,
+  account: `https://account${rootDomain}',`,
+  '3d': `https://3d${rootDomain}`,
+  '2d': `https://2d${rootDomain}`,
   helps: [
     {
       name: '产品介绍',
-      url: `https://doc${rootDomin}/document/118756411`,
+      url: `https://doc${rootDomain}/document/118756411`,
     },
     {
       name: '快速上手',
-      url: `https://doc${rootDomin}/document/119363000`,
+      url: `https://doc${rootDomain}/document/119363000`,
     },
     {
       name: '使用手册',
-      url: `https://doc${rootDomin}/document/118764244`,
+      url: `https://doc${rootDomain}/document/118764244`,
     },
     {
       name: '快捷键',
-      url: `https://doc${rootDomin}/document/119620214`,
+      url: `https://doc${rootDomain}/document/119620214`,
       divider: true,
     },
     {
       name: '企业服务与支持',
-      url: `https://doc${rootDomin}/document/119296274`,
+      url: `https://doc${rootDomain}/document/119296274`,
       divider: true,
     },
     {
       name: '关于我们',
-      url: `https://${rootDomin.slice(1)}/about.html`,
+      url: `https://${rootDomain.slice(1)}/about.html`,
     },
   ],
 });

+ 17 - 12
src/services/defaults.ts

@@ -1,8 +1,13 @@
 import { Pen, FormItem } from '@meta2d/core';
 import { cdn } from './api';
-import { getRootDomain } from './common';
 
-const rootDomin = getRootDomain();
+const getRootDomain = ()=>{ 
+  const a =location.host.split('.');
+  return `.${a[a.length-2]}.${a[a.length-1]}`
+};
+
+export let rootDomain = getRootDomain().indexOf('localhost')!==-1?'.le5le.com':getRootDomain();
+
 export const fromArrows = [
   { icon: '#l-line', value: '' },
   { icon: '#l-from-triangle', value: 'triangle' },
@@ -2182,7 +2187,7 @@ export const formComponents = [
           width: 500,
           height: 400,
           externElement: true,
-          iframe: `https://${rootDomin.slice(1)}`,
+          iframe: `https://${rootDomain?.slice(1)}`,
           props: {
             custom: iframeCustom,
           },
@@ -2418,13 +2423,13 @@ export const formComponents = [
           height: 300,
           data: [
             {
-              src: `https://2ds${rootDomin}/img/banner1.bc890350.png`,
+              src: `https://2ds${rootDomain}/img/banner1.bc890350.png`,
             },
             {
-              src: `https://2ds${rootDomin}/img/banner2.adab6a6e.png`,
+              src: `https://2ds${rootDomain}/img/banner2.adab6a6e.png`,
             },
             {
-              src: `https://2ds${rootDomin}/img/banner3.86b53aed.png`,
+              src: `https://2ds${rootDomain}/img/banner3.86b53aed.png`,
             },
           ],
           hiddenText: true,
@@ -2449,13 +2454,13 @@ export const formComponents = [
           swiperType: 'iframe',
           data: [
             {
-              src: `https://2d${rootDomin}/preview?id=6357a9e2d44b9402de84d2e8`,
+              src: `https://2d${rootDomain}/preview?id=6357a9e2d44b9402de84d2e8`,
             },
             {
-              src: `https://2d${rootDomin}/preview?id=6357aec8d44b9402de84d2f1`,
+              src: `https://2d${rootDomain}/preview?id=6357aec8d44b9402de84d2f1`,
             },
             {
-              src: `https://2d${rootDomin}/preview?id=641d524a8df2c654ea652d7e`,
+              src: `https://2d${rootDomain}/preview?id=641d524a8df2c654ea652d7e`,
             },
           ],
           hiddenText: true,
@@ -2492,7 +2497,7 @@ export const formComponents = [
                 {
                   action: 0,
                   params: '_blank',
-                  value: `https://2d${rootDomin}`,
+                  value: `https://2d${rootDomain}`,
                 },
               ],
             },
@@ -2623,13 +2628,13 @@ context.meta2d.translate(
             {
               key: '2',
               text: '页面2',
-              to: `https://2d${rootDomin}/?id=641d524a8df2c654ea652d7e`,
+              to: `https://2d${rootDomain}/?id=641d524a8df2c654ea652d7e`,
               target: '_blank',
             },
             {
               key: '3',
               text: '页面3',
-              to: `https://2d${rootDomin}/?id=6357a9e2d44b9402de84d2e8`,
+              to: `https://2d${rootDomain}/?id=6357a9e2d44b9402de84d2e8`,
               target: '_self',
             },
           ],

+ 8 - 9
src/services/enterprise.ts

@@ -1,11 +1,10 @@
 import { reactive } from 'vue';
 import axios from 'axios';
-import { getRootDomain } from './common';
+import { rootDomain } from './defaults';
 
-const rootDomin = getRootDomain();
 const enterprise = reactive({
   name: '乐吾乐',
-  home: `https://${rootDomin.slice(1)}`,
+  home: `https://${rootDomain.slice(1)}`,
   account: location.protocol + '//' + location.host + '/account',
   v: location.protocol + '//' + location.host + '/v',
   '3d': location.protocol + '//' + location.host + '/3d',
@@ -14,29 +13,29 @@ const enterprise = reactive({
   helps: [
     {
       name: '产品介绍',
-      url: `https://doc${rootDomin}/document/118756411`,
+      url: `https://doc${rootDomain}/document/118756411`,
     },
     {
       name: '快速上手',
-      url: `https://doc${rootDomin}/document/119363000`,
+      url: `https://doc${rootDomain}/document/119363000`,
     },
     {
       name: '使用手册',
-      url: `https://doc${rootDomin}/document/118764244`,
+      url: `https://doc${rootDomain}/document/118764244`,
     },
     {
       name: '快捷键',
-      url: `https://doc${rootDomin}/document/119620214`,
+      url: `https://doc${rootDomain}/document/119620214`,
       divider: true,
     },
     {
       name: '企业服务与支持',
-      url: `https://doc${rootDomin}/document/119296274`,
+      url: `https://doc${rootDomain}/document/119296274`,
       divider: true,
     },
     {
       name: '关于我们',
-      url: `https://${rootDomin.slice(1)}/about.html`,
+      url: `https://${rootDomain.slice(1)}/about.html`,
     },
   ],
 });

+ 2 - 3
src/views/components/Graphics.vue

@@ -393,7 +393,7 @@ import {
 } from '@/services/api';
 import { convertPen } from '@/services/upgrade';
 import { isGif } from '@/services/utils';
-import { autoSave, delAttrs, blank, useFolder, chargeDialogShow, getRootDomain } from '@/services/common';
+import { autoSave, delAttrs, blank, useFolder, chargeDialogShow } from '@/services/common';
 import { debounce, throttle } from '@/services/debouce';
 import { searchObjectPinyin } from '@/services/pinyin';
 import { getCookie } from '@/services/cookie';
@@ -401,7 +401,7 @@ import { parseSvg } from '@meta2d/svg';
 import Pay from './Pay.vue';
 import { filename } from '@/services/file';
 import { useUser } from '@/services/user';
-import { iframeCustom } from '@/services/defaults';
+import { iframeCustom, rootDomain } from '@/services/defaults';
 import { getLe5le3d } from '@/services/api';
 import { useSelection } from '@/services/selections';
 import localforage from 'localforage';
@@ -412,7 +412,6 @@ const { user } = useUser();
 const { setFolder, getFolder } = useFolder();
 const router = useRouter();
 const { select } = useSelection();
-const rootDomain = getRootDomain();
 const activedGroup = ref('');
 const activeAssets = ref('system');
 let groups = reactive([]);

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

@@ -524,8 +524,7 @@ import {
   useDot,
   delAttrs,
   // useAssets,
-  autoSaveAS,
-  getRootDomain
+  autoSaveAS
 } from '@/services/common';
 import { useEnterprise } from '@/services/enterprise';
 import {
@@ -554,7 +553,7 @@ import {
   getDeployGoods,
   getFrameDownloadList
 } from '@/services/download';
-import { formComponents } from '@/services/defaults';
+import { formComponents, rootDomain } from '@/services/defaults';
 import Pay from './Pay.vue';
 import {getNetJsDiagram} from '@/services/material';
 
@@ -563,7 +562,6 @@ const router = useRouter();
 const route = useRoute();
 
 const baseUrl = import.meta.env.BASE_URL || '/';
-const rootDomain = getRootDomain();
 // const { assets, getAssets } = useAssets();
 
 const { user, signout } = useUser();

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

@@ -822,10 +822,10 @@ import {
   onScaleWindow,
   useDot,
   autoSaveAS,
-  getRootDomain
+  
 } from '@/services/common';
 import { useSelection } from '@/services/selections';
-import { defaultFormat, fromArrows, toArrows } from '@/services/defaults';
+import { defaultFormat, fromArrows, toArrows, rootDomain } from '@/services/defaults';
 import { checkData, localStorageName, Meta2dBackData } from '@/services/utils';
 import { debounce } from '@/services/debouce';
 import { s8 } from '@/services/random';
@@ -843,7 +843,7 @@ const route = useRoute();
 const { user, getUser } = useUser();
 const { dot, setDot } = useDot();
 const { select } = useSelection();
-const rootDomain = getRootDomain();
+
 const meta2dOptions: Options = {
   cdn,
   rule: true,