From fde4b7852c9cb073987b87bf75375bb8a94a5ea9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 3 Nov 2025 23:53:31 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd=E3=80=91=E3=80=90mal?= =?UTF-8?q?l=E3=80=91diy-editor=20=E7=9A=84=E6=95=B4=E4=BD=93=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app-link-input/app-link-select-dialog.vue | 87 ++++++----- .../components/app-link-input/index.vue | 37 +++-- .../components/color-input/index.vue | 31 ++-- .../component-container-property.vue | 36 +++-- .../components/component-container.vue | 40 +---- .../components/component-library.vue | 4 +- .../components/mobile/search-bar/property.vue | 119 ++++++++++++++- .../promotion/components/diy-editor/index.vue | 141 +++++++----------- .../promotion/components/draggable/index.vue | 21 +-- .../components/input-with-color/index.vue | 30 ++-- .../components/magic-cube-editor/index.vue | 66 ++++---- .../components/magic-cube-editor/util.ts | 45 +++--- 12 files changed, 382 insertions(+), 275 deletions(-) diff --git a/apps/web-antd/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue b/apps/web-antd/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue index 2cbd8d12d..4851fca8e 100644 --- a/apps/web-antd/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue +++ b/apps/web-antd/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue @@ -37,9 +37,12 @@ const detailSelectDialog = ref<{ type: undefined, }); // 详情选择对话框 -/** 打开弹窗 */ const dialogVisible = ref(false); -const open = (link: string) => { + +defineExpose({ open }); + +/** 打开弹窗 */ +async function open(link: string) { activeAppLink.value.path = link; dialogVisible.value = true; // 滚动到当前的链接 @@ -54,19 +57,18 @@ const open = (link: string) => { ); if (group) { // 使用 nextTick 的原因:可能 Dom 还没生成,导致滚动失败 - nextTick(() => handleGroupSelected(group.name)); + await nextTick(); + handleGroupSelected(group.name); } -}; -defineExpose({ open }); +} /** 处理 APP 链接选中 */ -const handleAppLinkSelected = (appLink: AppLink) => { +function handleAppLinkSelected(appLink: AppLink) { if (!isSameLink(appLink.path, activeAppLink.value.path)) { activeAppLink.value = appLink; } switch (appLink.type) { case APP_LINK_TYPE_ENUM.PRODUCT_CATEGORY_LIST: { - detailSelectDialog.value.visible = true; detailSelectDialog.value.type = appLink.type; // 返显 detailSelectDialog.value.id = @@ -74,26 +76,30 @@ const handleAppLinkSelected = (appLink: AppLink) => { 'id', `http://127.0.0.1${activeAppLink.value.path}`, ) || undefined; + detailSelectDialog.value.visible = true; break; } default: { break; } } -}; +} +/** 处理确认提交 */ function handleSubmit() { - dialogVisible.value = false; emit('change', activeAppLink.value.path); emit('appLinkChange', activeAppLink.value); + dialogVisible.value = false; } /** * 处理右侧链接列表滚动 + * * @param {object} param0 滚动事件参数 * @param {number} param0.scrollTop 滚动条的位置 */ -function handleScroll({ scrollTop }: { scrollTop: number }) { +function handleScroll(event: Event) { + const scrollTop = (event.target as HTMLDivElement).scrollTop; const titleEl = groupTitleRefs.value.find((titleEl: HTMLInputElement) => { // 获取标题的位置信息 const { offsetHeight, offsetTop } = titleEl; @@ -137,47 +143,59 @@ function isSameLink(link1: string, link2: string) { /** 处理详情选择 */ function handleProductCategorySelected(id: number) { - // TODO @AI:这里有点问题;activeAppLink 地址; + // 生成 activeAppLink const url = new URL(activeAppLink.value.path, 'http://127.0.0.1'); - // 修改 id 参数 url.searchParams.set('id', `${id}`); - // 排除域名 activeAppLink.value.path = `${url.pathname}${url.search}`; - // 关闭对话框 + + // 关闭对话框,并重置 id detailSelectDialog.value.visible = false; - // 重置 id detailSelectDialog.value.id = undefined; } + diff --git a/apps/web-antd/src/views/mall/promotion/components/color-input/index.vue b/apps/web-antd/src/views/mall/promotion/components/color-input/index.vue index 1ce5abf52..d4745a0ed 100644 --- a/apps/web-antd/src/views/mall/promotion/components/color-input/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/color-input/index.vue @@ -1,9 +1,7 @@ - + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/component-container-property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/component-container-property.vue index 10cf7ae2e..4ac5f3b7a 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/component-container-property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/component-container-property.vue @@ -131,13 +131,9 @@ const handleSliderChange = (prop: string) => { - + -
+ 纯色 @@ -160,24 +156,22 @@ const handleSliderChange = (prop: string) => { - -