Browse Source

Merge branch 'local' of https://github.com/le5le-com/visualization-design into local

Wind-Breaker1 1 năm trước cách đây
mục cha
commit
2116d1db4f

+ 46 - 24
src/services/defaults.ts

@@ -2079,14 +2079,14 @@ export const formComponents = [
           textColor: '#0052d9',
           events: [
             {
-              where: {
-                type: null,
-              },
               name: 'click',
-              action: 0,
-              params: '_blank',
-              value: 'https://2d.le5le.com/',
-              fn: null,
+              actions: [
+                {
+                  action: 0,
+                  params: '_blank',
+                  value: 'https://2d.le5le.com/',
+                },
+              ],
             },
           ],
         },
@@ -2102,10 +2102,13 @@ export const formComponents = [
           iconFamily: 'l-icon',
           events: [
             {
-              action: 5,
               name: 'click',
-              value: 'window.history.go(-1);',
-              where: { type: null },
+              actions: [
+                {
+                  action: 5,
+                  value: 'window.history.go(-1);',
+                },
+              ],
             },
           ],
         },
@@ -2120,13 +2123,22 @@ export const formComponents = [
           icon: '\uea7b',
           iconFamily: 'l-icon',
           events: [
+            // {
+            //   action: 5,
+            //   name: 'click',
+            //   params: 'pen.id/tag',
+            //   value:
+            //     'let pens = context.meta2d.find(params);\r\nif (!pens.length) {\r\n    pens = [pen]\r\n}\r\ncontext.meta2d.active(pens, true);\r\ncontext.meta2d.gotoView(pens[0]);\r\ncontext.meta2d.resize();\r\ncontext.meta2d.render();',
+            //   where: { type: null },
+            // },
             {
-              action: 5,
               name: 'click',
-              params: 'pen.id/tag',
-              value:
-                'let pens = context.meta2d.find(params);\r\nif (!pens.length) {\r\n    pens = [pen]\r\n}\r\ncontext.meta2d.active(pens, true);\r\ncontext.meta2d.gotoView(pens[0]);\r\ncontext.meta2d.resize();\r\ncontext.meta2d.render();',
-              where: { type: null },
+              actions: {
+                action: 5,
+                params: 'pen.id/tag',
+                value:
+                  'let pens = context.meta2d.find(params);\r\nif (!pens.length) {\r\n    pens = [pen]\r\n}\r\ncontext.meta2d.active(pens, true);\r\ncontext.meta2d.gotoView(pens[0]);\r\ncontext.meta2d.resize();\r\ncontext.meta2d.render();',
+              },
             },
           ],
         },
@@ -2157,17 +2169,27 @@ export const formComponents = [
           icon: '\uec57',
           iconFamily: 'l-icon',
           events: [
+            // {
+            //   action: 5,
+            //   name: 'click',
+            //   // params: 'pen.id/tag',
+            //   value: `
+            //   const { scale, origin, y: dataY } = context.meta2d.store.data;
+            //   context.meta2d.translate(
+            //     0,
+            //     ((parseInt(params)||32) * context.meta2d.store.data.scale - origin.y) / scale - dataY / scale
+            //   );`,
+            //   where: { type: null },
+            // },
             {
-              action: 5,
               name: 'click',
-              // params: 'pen.id/tag',
-              value: `
-              const { scale, origin, y: dataY } = context.meta2d.store.data;
-              context.meta2d.translate(
-                0,
-                ((parseInt(params)||32) * context.meta2d.store.data.scale - origin.y) / scale - dataY / scale
-              );`,
-              where: { type: null },
+              actions: [
+                {
+                  action: 0,
+                  params: '_blank',
+                  value: 'https://2d.le5le.com/',
+                },
+              ],
             },
           ],
         },

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

@@ -349,7 +349,7 @@ onBeforeMount(async () => {
 const logout = () => {
   signout();
   meta2d.emit('logout');
-}
+};
 const onInputName = () => {
   (meta2d.store.data as Meta2dBackData).name = data.name;
   setDot();
@@ -842,6 +842,10 @@ const downloadImageTips =
   '无法下载,宽度不合法,画布可能没有画笔/画布大小超出浏览器最大限制';
 
 const downloadPng = () => {
+  if (!meta2d.store.data.pens.length) {
+    MessagePlugin.warning(downloadImageTips);
+    return;
+  }
   try {
     meta2d.downloadPng();
   } catch (e) {

+ 9 - 0
src/views/components/PenDatas.vue

@@ -243,6 +243,15 @@
           <label>模拟值:</label>
           <t-input v-model="dataBindDialog.data.mock" />
         </div>
+        <div class="form-item mt-20">
+          <label>类型:</label>
+          <t-select
+            class="w-full"
+            :options="typeOptions"
+            v-model="dataBindDialog.data.type"
+            placeholder="字符串"
+          />
+        </div>
         <div class="form-item mt-12">
           <label>开启:</label>
           <t-switch

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

@@ -28,7 +28,7 @@
             :count="dot ? 1 : 0"
           >
             <t-icon
-              name="view-module"
+              name="root-list"
               @click="
                 !route.query.c && save(SaveType.Save, 'le5leV-template', true)
               "
@@ -39,7 +39,7 @@
       <t-tooltip content="保存为我的组件" placement="bottom">
         <a :class="{ gray: route.query.id && !route.query.c }">
           <t-icon
-            name="layers"
+            name="app"
             @click="
               (!route.query.id || route.query.c) &&
                 save(SaveType.Save, 'le5leV-components', true)