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