From e2270c5469a0aa6617babc547bb549e78e0507e6 Mon Sep 17 00:00:00 2001 From: Cmen <1176967590@qq.com> Date: Mon, 21 Feb 2022 20:23:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor/Catalog/index.tsx | 19 ++++++++++++++++++- src/editor/Catalog/style.less | 5 +++++ src/store/reducers.ts | 31 ++++++++++++------------------- 3 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 src/editor/Catalog/style.less diff --git a/src/editor/Catalog/index.tsx b/src/editor/Catalog/index.tsx index d4113cf..4673222 100644 --- a/src/editor/Catalog/index.tsx +++ b/src/editor/Catalog/index.tsx @@ -1,5 +1,22 @@ +import { Collapse } from "antd"; + +import "./style.less"; + +const { Panel } = Collapse; + const Catalog = () => { - return

属性区域

; + const callback = (key: string | string[]) => console.log(key); + return ( + + + + + + ); }; export default Catalog; diff --git a/src/editor/Catalog/style.less b/src/editor/Catalog/style.less new file mode 100644 index 0000000..7d9a586 --- /dev/null +++ b/src/editor/Catalog/style.less @@ -0,0 +1,5 @@ +.ant-collapse-icon-position-right > .ant-collapse-item > .ant-collapse-header{ + padding: 6px 8px; + font-size: 12px; + background-color: #f7fafc; +} \ No newline at end of file diff --git a/src/store/reducers.ts b/src/store/reducers.ts index 0a5f366..92ad219 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -1,4 +1,4 @@ -import { createStore } from "redux"; +import produce from "immer"; import { initState } from "./initState"; import { ActionTypes } from "./actions"; import { IEditorState, IOverlay } from "./type"; @@ -12,25 +12,18 @@ export function reducer(state = initState, action: Action): IEditorState { const { type, payload } = action; switch (type) { case ActionTypes.CreateOverlay: - return { - ...state, - map: { - ...state.map, - status: "createOverlay", - overlayType: payload as string, - }, - // - }; + return produce(state, (draft) => { + draft.map.status = "createOverlay"; + draft.map.overlayType = payload as string; + }); case ActionTypes.FinishCreateOverlay: - return { - ...state, - map: { - ...state.map, - status: "", - overlayType: "", - rectangles: [payload as IOverlay].concat(state.map.rectangles), - }, - }; + return produce(state, (draft) => { + const overlay = payload as IOverlay; + overlay.name = "测试矩形"; + draft.map.status = ""; + draft.map.overlayType = ""; + draft.map.rectangles = state.map.rectangles.concat([overlay]); + }); default: return state; }