From 7b0f4b080022411055e701f3ef2a36df1751edfe Mon Sep 17 00:00:00 2001 From: xxss0903 Date: Fri, 7 Feb 2025 17:52:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=90=E5=8F=96editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 +- src/DrawStampUtilsDemo.vue | 613 +--------------- src/EditorControls.vue | 1423 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1441 insertions(+), 599 deletions(-) create mode 100644 src/EditorControls.vue diff --git a/package-lock.json b/package-lock.json index 49d24b7..b6f1b32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "drawstamputils", - "version": "0.2.3", + "version": "0.2.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "drawstamputils", - "version": "0.2.3", + "version": "0.2.5", "license": "Apache-2.0", "dependencies": { "rollup": "^4.27.4", diff --git a/src/DrawStampUtilsDemo.vue b/src/DrawStampUtilsDemo.vue index 9e42a34..b5d395e 100644 --- a/src/DrawStampUtilsDemo.vue +++ b/src/DrawStampUtilsDemo.vue @@ -33,602 +33,12 @@ - -
- -
- - - - -
- - -
-
-

{{ t('stamp.basic.title') }}

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

{{ t('stamp.company.title') }}

- -
-
-
-
- {{ t('stamp.common.line', { index: index + 1 }) }} - -
- - - - - - - - - -
- -
-
- - -
-
-

{{ t('stamp.stampType.title') }}

- -
-
-
-
- {{ t('stamp.stampType.line', { index: index + 1 }) }} - -
- - - - - - - -
- -
-
- - -
-
-

{{ t('stamp.code.title') }}

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

{{ t('stamp.taxNumber.title') }}

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

{{ t('stamp.images.title') }}

- -
-
-
-
- {{ t('stamp.images.image', { index: index + 1 }) }} - -
-
- -
- - - - - - -
- -
-
- - -
-
-

{{ t('stamp.star.title') }}

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

{{ t('stamp.security.title') }}

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

{{ t('stamp.roughEdge.title') }}

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

{{ t('stamp.aging.title') }}

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

{{ t('stamp.innerCircle.title') }}

- -
-
- -
-
- 第 {{ index + 1 }} 行 - -
- - - -
-
-
-
- +
@@ -700,8 +110,11 @@ import { ICode, ICompany, IDrawImage, IDrawStampConfig, IDrawStar, IInnerCircle, import { useI18n } from 'vue-i18n' import stampTemplate1 from './assets/templates/stamp_template1.json' import stampTemplate2 from './assets/templates/stamp_template2.json' +import EditorControls from './EditorControls.vue' const { t } = useI18n() +// 添加一个标志来控制 EditorControls 的加载 +const isDrawStampUtilsReady = ref(false) const editorControls = ref(null) const stampCanvas = ref(null) @@ -1289,8 +702,8 @@ const loadSystemFonts = async () => { // 在组件挂载时加载字体 onMounted(async () => { - await loadSystemFonts() initDrawStampUtils() + await loadSystemFonts() restoreDrawConfigs() drawStamp() @@ -1300,6 +713,7 @@ onMounted(async () => { updateFontPreview({ target: element } as unknown as Event); } }); + isDrawStampUtilsReady.value = true }) // 监听所有响应式数据的变化 @@ -1601,6 +1015,11 @@ watch(showSecurityWarning, (newValue) => { localStorage.setItem('showSecurityWarning', String(newValue)) }) +// 更新印章绘制,从EditorControls组件中调用 +const updateDrawStamp = (newConfig: IDrawStampConfig, refreshSecurityPattern: boolean, refreshOld: boolean, refreshRoughEdge: boolean) => { + drawStampUtils.setDrawConfigs(newConfig) + drawStampUtils.refreshStamp(refreshSecurityPattern, refreshOld, refreshRoughEdge) +} diff --git a/src/EditorControls.vue b/src/EditorControls.vue new file mode 100644 index 0000000..c571e80 --- /dev/null +++ b/src/EditorControls.vue @@ -0,0 +1,1423 @@ + + + + \ No newline at end of file