From caf93782885a7b270b0465f86dee6ec970b3dd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=B0=91=E5=8D=AB?= Date: Sat, 11 May 2024 19:16:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B0=BA=E5=AF=B8):=20=E5=B0=81=E8=A3=85?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/modalSzie.vue | 100 ++++++++++++++++++++++++++++ src/components/importJSON.vue | 77 +++++---------------- src/components/setSize.vue | 88 ++++-------------------- src/language/zh.json | 2 +- 4 files changed, 128 insertions(+), 139 deletions(-) create mode 100644 src/components/common/modalSzie.vue diff --git a/src/components/common/modalSzie.vue b/src/components/common/modalSzie.vue new file mode 100644 index 00000000..1754e16a --- /dev/null +++ b/src/components/common/modalSzie.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/components/importJSON.vue b/src/components/importJSON.vue index 7e590126..d19770e9 100644 --- a/src/components/importJSON.vue +++ b/src/components/importJSON.vue @@ -2,7 +2,7 @@ * @Author: 秦少卫 * @Date: 2022-09-03 19:16:55 * @LastEditors: 秦少卫 - * @LastEditTime: 2024-05-11 13:34:51 + * @LastEditTime: 2024-05-11 19:15:19 * @Description: 导入JSON文件 --> @@ -24,42 +24,12 @@ - -

- {{ $t('importFiles.createDesign.customSize') }} -

-
- - - - - - - - - -
- -

- {{ $t('importFiles.createDesign.systemSize') }} -

- - - - - -
+ + @@ -67,8 +37,11 @@ import useSelect from '@/hooks/select'; import useMaterial from '@/hooks/useMaterial'; import { Message } from 'view-ui-plus'; +import modalSzie from '@/components/common/modalSzie'; + const { canvasEditor } = useSelect(); const { createTmpl, routerToId } = useMaterial(); +const modalSizeRef = ref(null); const clickHandler = (type) => { const handleMap = { @@ -80,34 +53,14 @@ const clickHandler = (type) => { handleMap[type]?.(); }; -const modal = ref(false); -const width = ref(null); -const height = ref(null); -const sizeList = ref([]); const createDesign = () => { - width.value = null; - height.value = null; - // 获取素材 - canvasEditor.getSizeList().then((res) => { - sizeList.value = res; - }); - modal.value = true; -}; -const setSize = (itemString) => { - const [w, h] = itemString.split('x'); - width.value = Number(w); - height.value = Number(h); + modalSizeRef.value.showSetSize(); }; -const customSizeCreate = async () => { - if (width.value && height.value) { - const res = await createTmpl(width.value, height.value); - routerToId(res.data.data.id); - modal.value = false; - Message.success('创建成功'); - } else { - Message.warning('请检查尺寸'); - } +const customSizeCreate = async (w, h) => { + const res = await createTmpl(w, h); + routerToId(res.data.data.id); + Message.success('创建成功'); };