From 1bae42ea2ce1358817cbdd338515b2f374d8585e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Mon, 19 Aug 2024 18:19:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model-custom/model-custom-content.vue | 3 +++ src/components/model-shop-list/index.vue | 26 +++++++++---------- .../model-shop-list-content.vue | 22 ++++++++-------- src/store/index.ts | 1 + 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/components/model-custom/model-custom-content.vue b/src/components/model-custom/model-custom-content.vue index be341d15..0905ad95 100644 --- a/src/components/model-custom/model-custom-content.vue +++ b/src/components/model-custom/model-custom-content.vue @@ -39,6 +39,9 @@ import Dialog from './components/dialog.vue'; import DragIndex from './components/index.vue'; import { cloneDeep } from 'lodash'; +import { DataSourceStore } from '@/store'; +const data_source = DataSourceStore(); + const props = defineProps({ value: { type: Object, diff --git a/src/components/model-shop-list/index.vue b/src/components/model-shop-list/index.vue index f77eb42b..80f2044d 100644 --- a/src/components/model-shop-list/index.vue +++ b/src/components/model-shop-list/index.vue @@ -58,7 +58,7 @@
-
+
{{ item.show_price_symbol }}{{ item.min_price }}{{ item.show_price_unit }}
{{ item.show_original_price_symbol }}{{ item.min_original_price }}{{ item.show_original_price_unit }}
@@ -133,17 +133,6 @@ const default_list = { new_src: [] } const list = ref([]); -watchEffect(() => { - if (form.value.product_check == '0') { - if (!isEmpty(form.value.product_list)) { - list.value = form.value.product_list; - } else { - list.value = Array(4).fill(default_list); - } - } else { - get_products(); - } -}); const get_products = () => { const { goods_category_ids, goods_brand_ids, number, sort, sort_rules } = form.value; const params = { @@ -163,6 +152,17 @@ const get_products = () => { } }); }; +watchEffect(() => { + if (form.value.product_check == '0') { + if (!isEmpty(form.value.product_list)) { + list.value = form.value.product_list; + } else { + list.value = Array(4).fill(default_list); + } + } else { + get_products(); + } +}); // 圆角设置 const content_radius = computed(() => radius_computer(new_style.value.shop_radius)); @@ -376,7 +376,7 @@ const style_container = computed(() => { height: 11.4rem; } .flex-img4 { - width: 100%; + width: 7rem; height: 7rem; } .flex-img5 { diff --git a/src/components/model-shop-list/model-shop-list-content.vue b/src/components/model-shop-list/model-shop-list-content.vue index 800e7be0..1f28acef 100644 --- a/src/components/model-shop-list/model-shop-list-content.vue +++ b/src/components/model-shop-list/model-shop-list-content.vue @@ -91,7 +91,7 @@ const state = reactive({ // 如果需要解构,确保使用toRefs const { form } = toRefs(state); -const base_list = { +const base_list = reactive({ product_style_list: [ { name: '单列展示', value: '0' }, { name: '大图展示', value: '2' }, @@ -117,16 +117,6 @@ const base_list = { { name: '降序(desc)', value: '0' }, { name: '升序(asc)', value: '1' }, ] -}; - -onBeforeMount(() => { - if (!shop_store.is_shop_api) { - shop_store.set_is_shop_api(true); - init(); - } else { - base_list.product_category_list = shop_store.category_list; - base_list.product_brand_list = shop_store.brand_list; - } }); const init = () => { @@ -138,6 +128,16 @@ const init = () => { }); }; +onMounted(() => { + if (!shop_store.is_shop_api) { + shop_store.set_is_shop_api(true); + init(); + } else { + base_list.product_category_list = shop_store.category_list; + base_list.product_brand_list = shop_store.brand_list; + } +}); + const product_list_remove = (index: number) => { form.value.product_list.splice(index, 1); }; diff --git a/src/store/index.ts b/src/store/index.ts index f34bf617..9b0b1f55 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -11,4 +11,5 @@ export * from './modules/footer-nav-content'; export * from './modules/upload'; export * from './modules/shop'; export * from './modules/url-value'; +export * from './modules/custom'; export { store };