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

feat: 新增四维看看特供封面

bill 1 місяць тому
батько
коміт
c89eca5244

+ 3 - 6
public/icons/chuang.svg

@@ -1,7 +1,4 @@
-<svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M0.5 13.5H6.5V18.5H0.5L0.5 13.5Z" stroke="black"/>
-<path d="M26 13.5H32V18.5H26L26 13.5Z" stroke="black"/>
-<path d="M6.5 14.5L26 14.5" stroke="black"/>
-<path d="M6.63379 16.5L26.1338 16.5" stroke="black"/>
-<path d="M6.63379 18.5L26.1338 18.5" stroke="black"/>
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M0.5 12.5H31.5V19.5H0.5V12.5Z" stroke="black"/>
+<path d="M0.5 16H31.5" stroke="black"/>
 </svg>

+ 21 - 17
public/icons/luodichuang.svg

@@ -1,19 +1,23 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M0.5 13.5H5.5V18.5H0.5L0.5 13.5Z" stroke="black"/>
-<path d="M26.5 13.5H31.5V18.5H26.5L26.5 13.5Z" stroke="black"/>
-<path d="M5.5 16.5H26.5" stroke="black"/>
-<path d="M5.5 18.5H7" stroke="black"/>
-<path d="M8 18.5H10" stroke="black"/>
-<path d="M11 18.5H13" stroke="black"/>
-<path d="M14 18.5H16" stroke="black"/>
-<path d="M17 18.5H19" stroke="black"/>
-<path d="M20 18.5H22" stroke="black"/>
-<path d="M23 18.5H25" stroke="black"/>
-<path d="M5.5 14.5H7" stroke="black"/>
-<path d="M8 14.5H10" stroke="black"/>
-<path d="M11 14.5H13" stroke="black"/>
-<path d="M14 14.5H16" stroke="black"/>
-<path d="M17 14.5H19" stroke="black"/>
-<path d="M20 14.5H22" stroke="black"/>
-<path d="M23 14.5H25" stroke="black"/>
+<path d="M0.5 16H31.5" stroke="black"/>
+<path d="M6 19H8" stroke="black"/>
+<path d="M3 19H5" stroke="black"/>
+<path d="M2 13H0.5V19H2" stroke="black"/>
+<path d="M30 13H31.5V19H30" stroke="black"/>
+<path d="M9 19H11" stroke="black"/>
+<path d="M12 19H14" stroke="black"/>
+<path d="M15 19H17" stroke="black"/>
+<path d="M18 19H20" stroke="black"/>
+<path d="M21 19H23" stroke="black"/>
+<path d="M24 19H26" stroke="black"/>
+<path d="M27 19H29" stroke="black"/>
+<path d="M6 13H8" stroke="black"/>
+<path d="M3 13H5" stroke="black"/>
+<path d="M9 13H11" stroke="black"/>
+<path d="M12 13H14" stroke="black"/>
+<path d="M15 13H17" stroke="black"/>
+<path d="M18 13H20" stroke="black"/>
+<path d="M21 13H23" stroke="black"/>
+<path d="M24 13H26" stroke="black"/>
+<path d="M27 13H29" stroke="black"/>
 </svg>

+ 2 - 4
public/icons/men_l.svg

@@ -1,6 +1,4 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M26.5 19.5C26.5 19.5 24.2143 12 19.5 9C14.7857 5.99996 7.5 6.5 7.5 6.5" stroke="black"/>
-<path d="M31.5 19.5H26.5V24.5H31.5L31.5 19.5Z" stroke="black"/>
-<path d="M5.5 19.5H0.5V24.5H5.5L5.5 19.5Z" stroke="black"/>
-<path d="M7.5 6.5H5.5V20.5H7.5L7.5 6.5Z" stroke="black"/>
+<path d="M27.5 25.5C27.5 24.5 26 16 19.9999 11.5C13.9999 7.00005 8.00007 7 6.5 7" stroke="black"/>
+<path d="M6.5 7.00003H4.5V25H6.5L6.5 7.00003Z" stroke="black"/>
 </svg>

+ 2 - 5
public/icons/piaochuang.svg

@@ -1,7 +1,4 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M4.5 18.5V8.5H27.5V18.5" stroke="black"/>
-<path d="M6.5 18.5V10.5H25.5V18.5" stroke="black"/>
-<path d="M1.5 18.5H6.5V23.5H1.5L1.5 18.5Z" stroke="black"/>
-<path d="M25.5 18.5H30.5V23.5H25.5L25.5 18.5Z" stroke="black"/>
-<path d="M6.5 23.5H25.5" stroke="black"/>
+<path d="M0.5 8V23.5H31.5V8H0.5Z" stroke="black"/>
+<path d="M2.5 23.5V10H29.5V23.5" stroke="black"/>
 </svg>

+ 3 - 5
public/icons/shuangkaimen.svg

@@ -1,7 +1,5 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M0.5 19.5H5.5V24.5H0.5L0.5 19.5Z" stroke="black"/>
-<path d="M26.5 19.5H31.5V24.5H26.5L26.5 19.5Z" stroke="black"/>
-<path d="M24.5 6.5H26.5V20.5H24.5L24.5 6.5Z" stroke="black"/>
-<path d="M5.5 6.5H7.5V20.5H5.5L5.5 6.5Z" stroke="black"/>
-<path d="M7.5 6.50176C7.5 6.50176 10.6667 6.50176 13.5 9.50176C16.3333 12.5018 16 15.5018 16 15.5018C16 15.5018 15.5 12.6782 18.5 9.50176C21.5 6.3253 24.5 6.50176 24.5 6.50176" stroke="black"/>
+<path d="M29.5 7H31.5V25H29.5L29.5 7Z" stroke="black"/>
+<path d="M0.5 7H2.5V25H0.5L0.5 7Z" stroke="black"/>
+<path d="M2.5 7C6 7 10 8.78571 12.5 12C15 15.2143 16 19.5 16 19.5C16 19.5 17 15 19.5 12C22 9 26 7 29.5 7" stroke="black"/>
 </svg>

+ 5 - 4
public/icons/yakou.svg

@@ -1,14 +1,15 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M0.5 13.5H6.5V18.5H0.5L0.5 13.5Z" stroke="black"/>
-<path d="M25.5 13.5L31.5 13.5V18.5L25.5 18.5L25.5 13.5Z" stroke="black"/>
-<path d="M27.5 13.5L27.4999 11.5L4.5 11.5002L4.50007 13.5002" stroke="black"/>
-<path d="M4.49982 18.5L4.49989 20.5L27.4998 20.4997L27.4998 18.4997" stroke="black"/>
+<path d="M31.5 11.5L0.5 11.5002V20.5L31.5 20.5V11.5Z" stroke="black"/>
 <path d="M9 14.5H11" stroke="black"/>
+<path d="M5 14.5H7" stroke="black"/>
 <path d="M13 14.5H15" stroke="black"/>
 <path d="M17 14.5H19" stroke="black"/>
 <path d="M21 14.5H23" stroke="black"/>
+<path d="M25 14.5H27" stroke="black"/>
 <path d="M9 17.5H11" stroke="black"/>
+<path d="M5 17.5H7" stroke="black"/>
 <path d="M13 17.5H15" stroke="black"/>
 <path d="M17 17.5H19" stroke="black"/>
 <path d="M21 17.5H23" stroke="black"/>
+<path d="M25 17.5H27" stroke="black"/>
 </svg>

+ 2 - 4
public/icons/yimen.svg

@@ -1,6 +1,4 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M0.5 13.5H5.5V18.5H0.5L0.5 13.5Z" stroke="black"/>
-<path d="M26.5 13.5H31.5V18.5H26.5L26.5 13.5Z" stroke="black"/>
-<path d="M13.4999 16.5H26.5L26.5001 18.5H13.5L13.4999 16.5Z" stroke="black"/>
-<path d="M5.5 13.5H18.5001L18.5002 15.5H5.50007L5.5 13.5Z" stroke="black"/>
+<path d="M13.5 16H31.5L31.5001 18H13.5001L13.5 16Z" stroke="black"/>
+<path d="M0.5 14H18.5L18.5001 16H0.500068L0.5 14Z" stroke="black"/>
 </svg>

+ 1 - 0
src/core/helper/split-line.vue

@@ -7,6 +7,7 @@
           ...config.labelLineConfig,
           strokeWidth: 0,
           ...textConfig,
+          fill: config.labelLineConfig.stroke,
           fontSize: config.labelLineConfig.fontSize,
           align: 'center',
         }"

+ 2 - 2
src/core/hook/use-component.ts

@@ -232,8 +232,8 @@ export const useComponentDescribes = <T extends { id: string }>(
             getPredefine && (getPredefine as any)(key as keyof DrawItem);
           if (!predefine) return;
 
-          if (descs[key].props) {
-            descs[key].props = { initProps, ...predefine };
+          if (initProps) {
+            descs[key].props = { ...initProps, ...predefine };
           } else {
             descs[key].props = predefine;
           }

+ 18 - 11
src/core/hook/use-group.ts

@@ -1,7 +1,7 @@
-import { computed, reactive, Ref } from "vue";
+import { computed, reactive, ref, Ref, watchEffect } from "vue";
 import { PropertyDescribes } from "../html-mount/propertys";
 import { installGlobalVar } from "./use-global-vars";
-import { inRevise } from "@/utils/shared";
+import { inRevise, mergeFuns } from "@/utils/shared";
 
 export const useGlobalDescribes = installGlobalVar(() => {
   const shapesDescribes: Record<string, PropertyDescribes> = reactive({});
@@ -28,7 +28,6 @@ export const useComponentsDescribes = (ids: Ref<string[]>) => {
   const groups = computed(() => {
     return ids.value.map((id) => gdesc.get(id)).filter((item) => !!item);
   });
-
   const shareDescribes = computed(() => {
     if (groups.value.length === 0) {
       return {};
@@ -68,7 +67,10 @@ export const useComponentsDescribes = (ids: Ref<string[]>) => {
     return shareDescribes;
   });
 
+  const stopWatchs: (() => void)[] = []
   const mergeDesc = computed(() => {
+    mergeFuns(stopWatchs)()
+    stopWatchs.length = 0
     const mergeDesc: Record<
       string,
       PropertyDescribes[string] & { joins: { id: string }[] }
@@ -81,16 +83,21 @@ export const useComponentsDescribes = (ids: Ref<string[]>) => {
         ...descs[0],
         joins: data,
       };
+      let value = descs[0].value;
+      let i = 1;
+      for (; i < descs.length; i++) {
+        if (descs[i].value !== value) {
+          break;
+        }
+      }
+      if (i !== descs.length) {
+        mergeDesc[key].label = mergeDesc[key].label + '(多值)'
+        value = undefined
+      }
+
       Object.defineProperty(mergeDesc[key], "value", {
         get() {
-          const value = descs[0].value;
-          let i = 1;
-          for (; i < descs.length; i++) {
-            if (descs[i].value !== value) {
-              break;
-            }
-          }
-          return i === descs.length ? value : undefined;
+          return value
         },
         set(val) {
           for (const desc of descs) {

+ 0 - 1
src/core/hook/use-mouse-status.ts

@@ -302,7 +302,6 @@ export const useMouseShapesStatus = installGlobalVar(() => {
             const ndx = selects.value.findIndex(
               (item) => item.id() === target?.id()
             );
-            console.log(ndx, selects.value)
             if (~ndx) {
               selects.value.splice(ndx, 1);
             } else {

+ 1 - 1
src/core/hook/use-selection.ts

@@ -32,7 +32,7 @@ import {
   useViewerInvertTransform,
   useViewerInvertTransformConfig,
 } from "./use-viewer";
-import { copy, debounce, diffArrayChange, mergeFuns, onlyId } from "@/utils/shared";
+import { debounce, diffArrayChange, mergeFuns, onlyId } from "@/utils/shared";
 import { IRect } from "konva/lib/types";
 import { useMouseShapesStatus } from "./use-mouse-status";
 import Icon from "../components/icon/temp-icon.vue";

+ 1 - 1
src/core/store/store.ts

@@ -41,7 +41,7 @@ export const useStoreRaw = defineStore("draw-data", {
       if (layers.includes(layer)) {
         return layer
       } else {
-        return layers[0]
+        return layers[0] 
       }
     },
     layers() {

+ 7 - 7
src/example/constant.ts

@@ -25,15 +25,15 @@ export const iconGroups: IconGroup[] = [
           {
             wall: true,
             icon: "men_l",
-            name: "左开门",
-            parse: { type: "align-bottom" },
-          },
-          {
-            wall: true,
-            icon: "men",
-            name: "右开门",
+            name: "开门",
             parse: { type: "align-bottom" },
           },
+          // {
+          //   wall: true,
+          //   icon: "men",
+          //   name: "右开门",
+          //   parse: { type: "align-bottom" },
+          // },
           {
             wall: true,
             icon: "shuangkaimen",

+ 69 - 5
src/example/fuse/views/overview/header.vue

@@ -25,7 +25,7 @@ import {
   tableCoverHeight,
   overviewData,
 } from "../../store.ts";
-import { nextTick, onUnmounted, reactive } from "vue";
+import { nextTick, onUnmounted } from "vue";
 import { DataGroupId } from "@/constant/index.ts";
 import { Group } from "konva/lib/Group";
 import { Mode } from "@/constant/mode.ts";
@@ -34,7 +34,7 @@ import { repTabulationStore } from "../tabulation/gen-tab.ts";
 import { router } from "../../router.ts";
 import { overviewId, params, tabulationId } from "@/example/env.ts";
 import { listener } from "@/utils/event.ts";
-import { repeatedlyOnly } from "@/utils/shared.ts";
+import { mergeFuns, repeatedlyOnly } from "@/utils/shared.ts";
 import saveAs from "@/utils/file-serve.ts";
 
 const props = defineProps<{ title: string }>();
@@ -155,9 +155,69 @@ const setViewToTableCover = async () => {
   ] as const;
 };
 
+const setViewToKanKanCover = async () => {
+  const oldViewMat = draw.viewer.viewMat;
+  const oldBack = draw.config.back && { ...draw.config.back };
+  const oldShowGrid = draw.config.showGrid;
+  const oldLabelLineConfig = { ...draw.config.labelLineConfig };
+  draw.config.labelLineConfig.stroke = "#FFFFFF";
+  draw.config.labelLineConfig.shadowColor = "#000000";
+  draw.config.labelLineConfig.fontSize = 18;
+  const pop = draw.mode.push(Mode.readonly);
+  draw.config.showGrid = false;
+  draw.config.back = undefined;
+
+  const set: any = {
+    stroke: "#FFFFFF",
+    fill: undefined,
+    color: "#FFFFFF",
+    fontColor: "#FFFFFF",
+  };
+  const cSet: any = {
+    text: {
+      fill: "#FFFFFF",
+    },
+  };
+  const typeItems: any = Object.entries(draw.store.typeItems);
+  const lineData = draw.store.getTypeItems("line")[0];
+  if (lineData) {
+    typeItems.push(["lines", lineData.lines]);
+  }
+  const clearupItems = typeItems.map(([type, items]: any) => {
+    const cleanups: (() => void)[] = [];
+    items.forEach((item: any) => {
+      const itemSet = type in cSet ? cSet[type] : set;
+      const setKeys = Object.keys(itemSet);
+
+      for (const key of setKeys) {
+        if (key in item) {
+          const oldVal = item[key];
+          cleanups.push(() => (item[key] = oldVal));
+        } else {
+          cleanups.push(() => delete item[key]);
+        }
+        item[key] = itemSet[key];
+      }
+    });
+    return mergeFuns(cleanups);
+  });
+
+  draw.initViewport(70);
+  await nextTick();
+  const blob = await getImage(draw, "image/png");
+  mergeFuns(clearupItems)();
+  pop();
+  draw.config.back = oldBack;
+  draw.config.labelLineConfig = oldLabelLineConfig;
+  draw.config.showGrid = oldShowGrid;
+  draw.viewer.setViewMat(oldViewMat);
+  await nextTick();
+  return blob;
+};
+
 const saveHandler = repeatedlyOnly(async () => {
   const storeData = draw.getData();
-  const [tabBlob, listBlob, scale, rect] = await draw.enterTemp(async () => {
+  const [tabBlob, listBlob, kkBlob, scale, rect] = await draw.enterTemp(async () => {
     const back = draw.config.back;
     const [rect, recover] = await setViewToTableCover();
     await nextTick();
@@ -171,17 +231,21 @@ const saveHandler = repeatedlyOnly(async () => {
     const listBlob = await getImage(draw, "image/jpg");
     recover();
     await nextTick();
-    return [tabBlob, listBlob, scale, rect] as const;
+
+    const kkBlob = await setViewToKanKanCover();
+    return [tabBlob, listBlob, kkBlob, scale, rect] as const;
   });
 
-  const [tabUrl, listUrl] = await Promise.all([
+  const [tabUrl, listUrl, kankanUrl] = await Promise.all([
     window.platform.uploadResourse(new File([tabBlob], `tabulation-cover.png`)),
     window.platform.uploadResourse(new File([listBlob], `list-cover.png`)),
+    window.platform.uploadResourse(new File([kkBlob], `kankan-cover.png`)),
   ]);
 
   overviewId.value = await window.platform.saveOverviewData(overviewId.value, {
     ...overviewData.value,
     listCover: listUrl,
+    kankanCover: kankanUrl,
     store: storeData,
     viewport: draw!.viewer.transform.m,
   });