Procházet zdrojové kódy

fix: 修改默认标题

bill před 2 roky
rodič
revize
5720386aaf

+ 1 - 1
src/version.json

@@ -2,5 +2,5 @@
   "env": "dev",
   "main": 1.2,
   "append": "alpha",
-  "version": 7
+  "version": 8
 }

+ 45 - 0
src/views/draw-file/default.json

@@ -0,0 +1,45 @@
+{
+  "id": -1,
+  "version": "v4.0",
+  "floors": [
+    {
+      "points": {},
+      "walls": {},
+      "tags": {},
+      "rectangles": {},
+      "circles": {},
+      "arrows": {},
+      "icons": {},
+      "signs": {},
+      "title": {
+        "len": null,
+        "value": "某某案发现场",
+        "height": 50,
+        "floor": 0,
+        "geoType": "Title",
+        "vectorId": "Title6"
+      },
+      "image": {
+        "len": null,
+        "image": null,
+        "floor": 0,
+        "geoType": "BgImage",
+        "vectorId": "BgImage8"
+      },
+      "compass": {
+        "len": null,
+        "angle": 0,
+        "floor": 0,
+        "center": {
+          "x": 800,
+          "y": 70
+        },
+        "radius": 52,
+        "geoType": "Compass",
+        "vectorId": "Compass7"
+      }
+    }
+  ],
+  "currentId": 20,
+  "shapes": []
+}

+ 7 - 5
src/views/draw-file/index.tsx

@@ -6,8 +6,9 @@ import boardFactory from './board'
 import DfSlider from './slider'
 import DfHeader from './header'
 import EShape from './eshape'
-import { getBoardById, BoardType, BoardData } from 'api'
+import { getBoardById, BoardType, BoardData, getExample, BoardTypeDesc } from 'api'
 import { useRefersh } from 'hook'
+import fileDefault from './default.json'
 
 import type { Board } from './board'
 
@@ -17,6 +18,7 @@ const DfBoard = memo(forwardRef(({ data: boardData }: { data: BoardData }, ref)
   const board = useRef<Board>()
   const createBoard = useCallback((dom: HTMLCanvasElement | null) => {
     if (dom) {
+      console.log(boardData)
       const boardRef = boardFactory(boardData, dom)
       board.current = boardRef
     } else if (board.current) {
@@ -57,13 +59,13 @@ export const DrawFile = () => {
       if (pathId !== -1) {
         getBoardById({ id: pathId }).then((data) => setBoardData({ ...data.content, id: data.filesId! }))
       } else {
-        setBoardData({
-          id: -1,
-          shapes: []
+        getExample({ caseId }).then((data) => {
+          fileDefault.floors[0].title.value = data.caseTitle + "案发" + BoardTypeDesc[pathType];
+          setBoardData(fileDefault)
         })
       }
     }
-  }, [pathId, boardData?.id, boardData])
+  }, [pathId, boardData?.id, boardData, caseId])
 
   useEffect(() => {
     if (JSON.stringify(path) !== JSON.stringify(pathRef.current)) {