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

+ 13 - 8
package-lock.json

@@ -19,9 +19,10 @@
         "dxf-writer": "^1.18.4",
         "element-plus": "^2.8.6",
         "html2canvas": "^1.4.1",
+        "js-base64": "^3.7.8",
         "jspdf": "^3.0.1",
         "jszip": "^3.10.1",
-        "konva": "^9.3.18",
+        "konva": "9.3.20",
         "leaflet": "^1.9.4",
         "localforage": "^1.10.0",
         "martinez-polygon-clipping": "^0.7.4",
@@ -4030,10 +4031,9 @@
       }
     },
     "node_modules/js-base64": {
-      "version": "2.6.4",
-      "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-2.6.4.tgz",
-      "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==",
-      "license": "BSD-3-Clause"
+      "version": "3.7.8",
+      "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.8.tgz",
+      "integrity": "sha512-hNngCeKxIUQiEUN3GPJOkz4wF/YvdUdbNL9hsBcMQTkKzboD7T/q3OYOuuPZLUE6dBxSGpwhk5mwuDud7JVAow=="
     },
     "node_modules/json5": {
       "version": "1.0.2",
@@ -4104,9 +4104,9 @@
       }
     },
     "node_modules/konva": {
-      "version": "9.3.22",
-      "resolved": "https://registry.npmmirror.com/konva/-/konva-9.3.22.tgz",
-      "integrity": "sha512-yQI5d1bmELlD/fowuyfOp9ff+oamg26WOCkyqUyc+nczD/lhRa3EvD2MZOoc4c1293TAubW9n34fSQLgSeEgSw==",
+      "version": "9.3.20",
+      "resolved": "https://registry.npmjs.org/konva/-/konva-9.3.20.tgz",
+      "integrity": "sha512-7XPD/YtgfzC8b1c7z0hhY5TF1IO/pBYNa29zMTA2PeBaqI0n5YplUeo4JRuRcljeAF8lWtW65jePZZF7064c8w==",
       "funding": [
         {
           "type": "patreon",
@@ -6231,6 +6231,11 @@
         "node": ">=0.10.0"
       }
     },
+    "node_modules/svg-baker/node_modules/js-base64": {
+      "version": "2.6.4",
+      "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
+      "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
+    },
     "node_modules/svg-baker/node_modules/micromatch": {
       "version": "3.1.0",
       "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-3.1.0.tgz",

+ 2 - 1
package.json

@@ -26,9 +26,10 @@
     "dxf-writer": "^1.18.4",
     "element-plus": "^2.8.6",
     "html2canvas": "^1.4.1",
+    "js-base64": "^3.7.8",
     "jspdf": "^3.0.1",
     "jszip": "^3.10.1",
-    "konva": "^9.3.18",
+    "konva": "9.3.20",
     "leaflet": "^1.9.4",
     "localforage": "^1.10.0",
     "martinez-polygon-clipping": "^0.7.4",

Різницю між файлами не показано, бо вона завелика
+ 0 - 4574
pnpm-lock.yaml


+ 8 - 3
src/example/fuse/enter-case.ts

@@ -3,6 +3,7 @@ import type { Scene } from "../../example/platform/platform-resource";
 import { token, params, overviewId } from "../env";
 import { genLoading } from "../loadding";
 import * as shadred from "./enter-shared";
+import { encodePwd } from "@/utils/encode";
 
 window.platform = { ...shadred };
 
@@ -21,9 +22,13 @@ window.platform.login = (isBack = true) => {
     if (params.value.caseId) {
       shadred
         .post("/service/manage/login", {
-          password: "JwiuK95dExMjM0NTY=7nHGf5ySQWSuC4G1An",
-          username: "super-admin",
-          userName: "super-admin",
+          // password: "JwiuK95dExMjM0NTY=7nHGf5ySQWSuC4G1An",
+          // username: "super-admin",
+          // userName: "super-admin",
+
+          password: encodePwd('Aa123456'),
+          username: "liliy",
+          userName: "liliy",
         })
         .then((res) => {
           params.value.token = res.token;

+ 8 - 3
src/example/fuse/enter.ts

@@ -8,6 +8,7 @@ import { tableTitleKey } from "../constant";
 import { getBaseItem } from "@/core/components/util";
 import { getRealPixel } from "./views/tabulation/gen-tab";
 import { getPaperConfig, paperConfigs } from "../components/slide/actions";
+import { encodePwd } from "@/utils/encode";
 
 window.platform = { ...platform };
 
@@ -20,9 +21,13 @@ window.platform.login = (isBack = true) => {
   if (import.meta.env.DEV) {
     platform
       .post("/service/manage/login", {
-        password: "Di8r5tFpExMjM0NTY=F39Vd0znQWfBY7W9iG",
-        username: "W测试2",
-        userName: "W测试2",
+        // password: "Di8r5tFpExMjM0NTY=F39Vd0znQWfBY7W9iG",
+        // username: "W测试2",
+        // userName: "W测试2",
+
+        password: encodePwd("Aa123456"),
+        username: "liliy",
+        userName: "liliy",
       })
       .then((res) => {
         params.value.token = res.token;

+ 1 - 1
src/example/platform/platform-draw.ts

@@ -223,6 +223,7 @@ const getTaggingShapes = async (taggings: SceneResource["taggings"]) => {
         .catch(() => {})
     );
   }
+
   await Promise.all(reqs);
   return {
     texts,
@@ -377,7 +378,6 @@ const drawSceneResource = async (resource: SceneResource, draw: Draw) => {
   const { icons, images, texts } = await getTaggingShapes(resource.taggings);
 
   // 这版本的icons先不用 用border
-  icons.length = 0
   const border = getBorderTaggingShapes(resource.borderTaggings)
   texts.push(...border.texts)
   const rects = border.rects

+ 4 - 2
src/example/platform/resource-swkk.ts

@@ -262,6 +262,8 @@ export const getTraceTaggingInfos = async (
     )
       continue;
 
+    
+
     const isSys = trace.icon.indexOf("/") > -1;
     const icon = isSys
       ? trace.icon.substring(trace.icon.lastIndexOf("/") + 1)
@@ -695,9 +697,9 @@ export const getResource = async ({
   }
   if (syncs.includes("traces")) {
     reqs.push(
-      getTraceTaggingInfos(scene, scale, floorIndex).then((ts) =>
+      getTraceTaggingInfos(scene, scale, floorIndex).then((ts) => {
         taggings.push(...ts)
-      )
+      })
     );
   }
 

+ 101 - 0
src/utils/encode.ts

@@ -0,0 +1,101 @@
+import { Base64 } from "js-base64";
+
+function randomWord(randomFlag: boolean, min: number, max?: number) {
+  let str = "";
+  let range = min;
+  const arr = [
+    "0",
+    "1",
+    "2",
+    "3",
+    "4",
+    "5",
+    "6",
+    "7",
+    "8",
+    "9",
+    "a",
+    "b",
+    "c",
+    "d",
+    "e",
+    "f",
+    "g",
+    "h",
+    "i",
+    "j",
+    "k",
+    "l",
+    "m",
+    "n",
+    "o",
+    "p",
+    "q",
+    "r",
+    "s",
+    "t",
+    "u",
+    "v",
+    "w",
+    "x",
+    "y",
+    "z",
+    "A",
+    "B",
+    "C",
+    "D",
+    "E",
+    "F",
+    "G",
+    "H",
+    "I",
+    "J",
+    "K",
+    "L",
+    "M",
+    "N",
+    "O",
+    "P",
+    "Q",
+    "R",
+    "S",
+    "T",
+    "U",
+    "V",
+    "W",
+    "X",
+    "Y",
+    "Z",
+  ];
+  // 随机产生
+  if (randomFlag && max) {
+    range = Math.round(Math.random() * (max - min)) + min;
+  }
+  for (let i = 0; i < range; i++) {
+    const pos = Math.round(Math.random() * (arr.length - 1));
+    str += arr[pos];
+  }
+  return str;
+}
+
+export function encodePwd(str: string, strv = "") {
+  str = Base64.encode(str);
+  const NUM = 2;
+  const front = randomWord(false, 8);
+  const middle = randomWord(false, 8);
+  const end = randomWord(false, 8);
+
+  const str1 = str.substring(0, NUM);
+  const str2 = str.substring(NUM);
+
+  if (strv) {
+    const strv1 = strv.substring(0, NUM);
+    const strv2 = strv.substring(NUM);
+    return [
+      front + str2 + middle + str1 + end,
+      front + strv2 + middle + strv1 + end,
+    ];
+  }
+
+  return front + str2 + middle + str1 + end;
+}