From eacc8335f5e074876a4f02edac1cfe02428d9d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Sun, 3 Nov 2024 16:09:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81=E5=92=8C?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=9A=84=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/model-article-list/index.vue | 19 ++++------- .../model-article-list-content.vue | 23 ++++++++++--- .../model-article-list-setting.vue | 10 ++++-- .../model-article-list-styles.vue | 2 +- .../model-article-tabs-content.vue | 22 ++++++++++--- .../model-article-tabs-setting.vue | 10 ++++-- .../model-article-tabs-styles.vue | 2 +- src/components/model-goods-list/index.vue | 33 ++++++++++--------- .../model-goods-list-content.vue | 30 ++++++++++++----- .../model-goods-list-setting.vue | 10 ++++-- .../model-goods-list-styles.vue | 3 +- .../model-goods-tabs-content.vue | 27 ++++++++++----- .../model-goods-tabs-setting.vue | 10 ++++-- .../model-goods-tabs-styles.vue | 2 +- src/config/const/article-list.ts | 2 +- src/config/const/article-tabs.ts | 2 +- src/config/const/goods-list.ts | 2 +- src/config/const/goods-tabs.ts | 2 +- 18 files changed, 140 insertions(+), 71 deletions(-) diff --git a/src/components/model-article-list/index.vue b/src/components/model-article-list/index.vue index 5a79945b..c3c15d53 100644 --- a/src/components/model-article-list/index.vue +++ b/src/components/model-article-list/index.vue @@ -118,7 +118,7 @@ const content_padding = ref(''); const content_spacing = ref(''); // 文章间距 const article_spacing = ref(''); -const article_item_height = ref('155'); +const article_item_height = ref('183'); const article_style = ref({}); const default_data_list: ArticleList = { @@ -229,9 +229,7 @@ const article_name_line_height_computer = computed(() => { return new_style.value.name_size * 1.2 + 'px'; }); // 轮播高度 -const carousel_height_computer = computed(() => { - return new_style.value.name_size * 2 + new_style.value.article_height + 'px'; -}); +const carousel_height_computer = computed(() => new_style.value.article_height + 'px'); // 监听value数据变化 watch( () => props.value, @@ -327,8 +325,9 @@ const article_carousel_list = computed(() => { .style1 { .item { width: 100%; + height: v-bind(carousel_height_computer); .img { - height: 8.3rem; + height: 100%; width: 11rem; } } @@ -336,18 +335,13 @@ const article_carousel_list = computed(() => { .style2 { .item { width: calc(50% - 0.5rem); - .img { - height: 18rem; - } + height: v-bind(carousel_height_computer); } } .style3 { .item { width: 100%; - .img { - width: 100%; - height: 18rem; - } + height: v-bind(carousel_height_computer); } } .style4 { @@ -362,6 +356,7 @@ const article_carousel_list = computed(() => { .item { width: v-bind(multicolumn_columns_width); min-width: v-bind(multicolumn_columns_width); + height: v-bind(carousel_height_computer); .img { width: 100%; max-height: v-bind(article_item_height); diff --git a/src/components/model-article-list/model-article-list-content.vue b/src/components/model-article-list/model-article-list-content.vue index 92d7b762..e3be9326 100644 --- a/src/components/model-article-list/model-article-list-content.vue +++ b/src/components/model-article-list/model-article-list-content.vue @@ -102,11 +102,11 @@ const state = reactive({ const { form, data } = toRefs(state); const base_list = reactive({ theme_list: [ - { name: '单列展示', value: '0' }, - { name: '两列展示(纵向)', value: '1' }, - { name: '大图展示', value: '2' }, - { name: '无图模式', value: '3' }, - { name: '左右滑动展示', value: '4' }, + { name: '单列展示', value: '0', height: 103 }, + { name: '两列展示(纵向)', value: '1', height: 245 }, + { name: '大图展示', value: '2', height: 245 }, + { name: '无图模式', value: '3', height: 0 }, + { name: '左右滑动展示', value: '4', height: 183 }, ], carousel_col_list: [ { name: '单列展示', value: '0' }, @@ -134,6 +134,8 @@ const base_list = reactive({ { name: '描述', value: '2' }, ], }); + +const emits = defineEmits(['theme_change']); onMounted(() => { nextTick(() => { // 定时获取common_store.common.article_category的数据,直到拿到值或者关闭页面为止 @@ -141,6 +143,13 @@ onMounted(() => { base_list.article_category_list = common_store.common.article_category; } }); + // 如果历史数据没有操作,则修改默认值 + if (data.value.article_height == 155 && form.value.theme != '4') { + const list = base_list.theme_list.filter(item => item.value == form.value.theme); + if (list.length > 0) { + emits('theme_change', list[0].height); + } + } }); // 主题改变 const theme_change = (val: any) => { @@ -166,6 +175,10 @@ const theme_change = (val: any) => { data.value.img_radius.radius_top_right = props.defaultConfig.img_radius_1; } } + const list = base_list.theme_list.filter(item => item.value == val); + if (list.length > 0) { + emits('theme_change', list[0].height); + } }; // 移除 const data_list_remove = (index: number) => { diff --git a/src/components/model-article-list/model-article-list-setting.vue b/src/components/model-article-list/model-article-list-setting.vue index 29b6f8a6..dda1ff74 100644 --- a/src/components/model-article-list/model-article-list-setting.vue +++ b/src/components/model-article-list/model-article-list-setting.vue @@ -1,10 +1,10 @@ @@ -29,4 +29,10 @@ const data_config = reactive({ img_radius_0: 4, img_radius_1: 0, }); +const form = ref(props.value); +const theme_change = (val: number) => { + if (val) { + form.value.style.article_height = val; + } +}; diff --git a/src/components/model-article-list/model-article-list-styles.vue b/src/components/model-article-list/model-article-list-styles.vue index 928cb10c..b22ba3fa 100644 --- a/src/components/model-article-list/model-article-list-styles.vue +++ b/src/components/model-article-list/model-article-list-styles.vue @@ -40,7 +40,7 @@ -