diff --git a/apps/web-antd/src/views/mall/product/category/components/index.ts b/apps/web-antd/src/views/mall/product/category/components/index.ts new file mode 100644 index 000000000..c3196cb27 --- /dev/null +++ b/apps/web-antd/src/views/mall/product/category/components/index.ts @@ -0,0 +1 @@ +export { default as ProductCategorySelect } from './select.vue'; diff --git a/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue b/apps/web-antd/src/views/mall/product/category/components/select.vue similarity index 94% rename from apps/web-antd/src/views/mall/product/category/components/product-category-select.vue rename to apps/web-antd/src/views/mall/product/category/components/select.vue index a55a66a43..cbaf3ec65 100644 --- a/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue +++ b/apps/web-antd/src/views/mall/product/category/components/select.vue @@ -11,26 +11,25 @@ import { getCategoryList } from '#/api/mall/product/category'; defineOptions({ name: 'ProductCategorySelect' }); const props = defineProps({ - // 选中的ID modelValue: { type: [Number, Array], default: undefined, - }, - // 是否多选 + }, // 选中的 ID multiple: { type: Boolean, default: false, - }, - // 上级品类的编号 + }, // 是否多选 parentId: { type: Number, default: undefined, - }, + }, // 上级品类的编号 }); /** 分类选择 */ const emit = defineEmits(['update:modelValue']); +const categoryList = ref([]); // 分类树 + /** 选中的分类 ID */ const selectCategoryId = computed({ get: () => { @@ -42,7 +41,6 @@ const selectCategoryId = computed({ }); /** 初始化 */ -const categoryList = ref([]); // 分类树 onMounted(async () => { const data = await getCategoryList({ parentId: props.parentId, diff --git a/apps/web-antd/src/views/mall/promotion/components/app-link-input/index.vue b/apps/web-antd/src/views/mall/promotion/components/app-link-input/index.vue index 3391a41cf..b4125104b 100644 --- a/apps/web-antd/src/views/mall/promotion/components/app-link-input/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/app-link-input/index.vue @@ -3,7 +3,7 @@ import { ref, watch } from 'vue'; import { Button, Input } from 'ant-design-vue'; -import AppLinkSelectDialog from './app-link-select-dialog.vue'; +import AppLinkSelectDialog from './select-dialog.vue'; /** APP 链接输入框 */ defineOptions({ name: 'AppLinkInput' }); @@ -56,5 +56,6 @@ watch( + 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/select-dialog.vue similarity index 87% rename from apps/web-antd/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue rename to apps/web-antd/src/views/mall/promotion/components/app-link-input/select-dialog.vue index 949087212..27405557b 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/select-dialog.vue @@ -3,11 +3,12 @@ import type { AppLink } from './data'; import { nextTick, ref } from 'vue'; +import { useVbenModal } from '@vben/common-ui'; import { getUrlNumberValue } from '@vben/utils'; -import { Button, Form, FormItem, Modal, Tooltip } from 'ant-design-vue'; +import { Button, Form, FormItem, Tooltip } from 'ant-design-vue'; -import ProductCategorySelect from '#/views/mall/product/category/components/product-category-select.vue'; +import { ProductCategorySelect } from '#/views/mall/product/category/components/'; import { APP_LINK_GROUP_LIST, APP_LINK_TYPE_ENUM } from './data'; @@ -30,21 +31,31 @@ const groupBtnRefs = ref([]); // 分组引用列表 const detailSelectDialog = ref<{ id?: number; type?: APP_LINK_TYPE_ENUM; - visible: boolean; }>({ - visible: false, id: undefined, type: undefined, }); // 详情选择对话框 -const dialogVisible = ref(false); +const [Modal, modalApi] = useVbenModal({ + onConfirm() { + emit('change', activeAppLink.value.path); + emit('appLinkChange', activeAppLink.value); + modalApi.close(); + }, +}); + +const [DetailSelectModal, detailSelectModalApi] = useVbenModal({ + onConfirm() { + detailSelectModalApi.close(); + }, +}); defineExpose({ open }); /** 打开弹窗 */ async function open(link: string) { activeAppLink.value.path = link; - dialogVisible.value = true; + modalApi.open(); // 滚动到当前的链接 const group = APP_LINK_GROUP_LIST.find((group) => group.links.some((linkItem) => { @@ -76,7 +87,7 @@ function handleAppLinkSelected(appLink: AppLink) { 'id', `http://127.0.0.1${activeAppLink.value.path}`, ) || undefined; - detailSelectDialog.value.visible = true; + detailSelectModalApi.open(); break; } default: { @@ -85,13 +96,6 @@ function handleAppLinkSelected(appLink: AppLink) { } } -/** 处理确认提交 */ -function handleSubmit() { - emit('change', activeAppLink.value.path); - emit('appLinkChange', activeAppLink.value); - dialogVisible.value = false; -} - /** * 处理右侧链接列表滚动 * @@ -138,7 +142,7 @@ function scrollToGroupBtn(group: string) { /** 是否为相同的链接(不比较参数,只比较链接) */ function isSameLink(link1: string, link2: string) { - return link2 ? link1.split('?')[0] === link2.split('?')[0] : false; + return link2 ? link1?.split('?')[0] === link2.split('?')[0] : false; } /** 处理详情选择 */ @@ -149,17 +153,12 @@ function handleProductCategorySelected(id: number) { activeAppLink.value.path = `${url.pathname}${url.search}`; // 关闭对话框,并重置 id - detailSelectDialog.value.visible = false; + detailSelectModalApi.close(); detailSelectDialog.value.id = undefined; } - - 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 38c475f75..0272acd0d 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 @@ -133,6 +133,7 @@ function handleSliderChange(prop: string) { +

组件样式:

@@ -159,6 +160,7 @@ function handleSliderChange(prop: string) { + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/index.vue deleted file mode 100644 index 9b4dd5c16..000000000 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/index.vue +++ /dev/null @@ -1,53 +0,0 @@ - - diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/config.ts b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/config.ts similarity index 100% rename from apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/config.ts rename to apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/config.ts diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/index.vue new file mode 100644 index 000000000..0b05db2e2 --- /dev/null +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/index.vue @@ -0,0 +1,53 @@ + + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/property.vue similarity index 99% rename from apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/property.vue rename to apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/property.vue index 9cace5f26..d7a90e806 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/property.vue @@ -21,11 +21,13 @@ import { AppLinkInput, Draggable } from '#/views/mall/promotion/components'; import ComponentContainerProperty from '../../component-container-property.vue'; -// 轮播图属性面板 +/** 轮播图属性面板 */ defineOptions({ name: 'CarouselProperty' }); const props = defineProps<{ modelValue: CarouselProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Divider/config.ts b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/divider/config.ts similarity index 100% rename from apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Divider/config.ts rename to apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/divider/config.ts diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Divider/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/divider/index.vue similarity index 100% rename from apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Divider/index.vue rename to apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/divider/index.vue diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Divider/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/divider/property.vue similarity index 100% rename from apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Divider/property.vue rename to apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/divider/property.vue diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/image-bar/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/image-bar/index.vue index b61ca641e..dcdbd45e9 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/image-bar/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/image-bar/index.vue @@ -11,7 +11,6 @@ defineOptions({ name: 'ImageBar' }); defineProps<{ property: ImageBarProperty }>(); - - diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue index 2b22f7646..74af60c87 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue @@ -15,10 +15,9 @@ import { getSeckillActivityListByIds } from '#/api/mall/promotion/seckill/seckil /** 秒杀卡片 */ defineOptions({ name: 'PromotionSeckill' }); -// 定义属性 const props = defineProps<{ property: PromotionSeckillProperty }>(); -// 商品列表 -const spuList = ref([]); + +const spuList = ref([]); // 商品列表 const spuIdList = ref([]); const seckillActivityList = ref([]); @@ -28,7 +27,7 @@ watch( try { // 新添加的秒杀组件,是没有活动ID的 const activityIds = props.property.activityIds; - // 检查活动ID的有效性 + // 检查活动 ID 的有效性 if (Array.isArray(activityIds) && activityIds.length > 0) { // 获取秒杀活动详情列表 seckillActivityList.value = @@ -66,32 +65,25 @@ watch( }, ); -/** - * 计算商品的间距 - * @param index 商品索引 - */ -const calculateSpace = (index: number) => { - // 商品的列数 - const columns = props.property.layoutType === 'twoCol' ? 2 : 1; - // 第一列没有左边距 - const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`; - // 第一行没有上边距 - const marginTop = index < columns ? '0' : `${props.property.space}px`; - +/** 计算商品的间距 */ +function calculateSpace(index: number) { + const columns = props.property.layoutType === 'twoCol' ? 2 : 1; // 商品的列数 + const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`; // 第一列没有左边距 + const marginTop = index < columns ? '0' : `${props.property.space}px`; // 第一行没有上边距 return { marginLeft, marginTop }; -}; +} -// 容器 -const containerRef = ref(); -// 计算商品的宽度 -const calculateWidth = () => { +const containerRef = ref(); // 容器 + +/** 计算商品的宽度 */ +function calculateWidth() { let width = '100%'; - // 双列时每列的宽度为:(总宽度 - 间距)/ 2 if (props.property.layoutType === 'twoCol') { + // 双列时每列的宽度为:(总宽度 - 间距)/ 2 width = `${(containerRef.value.offsetWidth - props.property.space) / 2}px`; } return { width }; -}; +}