diff --git a/components/diy/article-list.vue b/components/diy/article-list.vue index e61837b9..9e8ecc44 100644 --- a/components/diy/article-list.vue +++ b/components/diy/article-list.vue @@ -4,13 +4,13 @@ - + @@ -33,13 +33,13 @@ - +
@@ -134,6 +134,8 @@ carousel_height_computer: '', // 文章内容高度 article_name_height_computer: '', + // 图片大小 + img_size: '', // 文章轮播数据 article_carousel_list: [], // 文章描述间距 @@ -145,9 +147,6 @@ // 初始化 this.init(); }, - propValue(new_value, old_value) { - this.init(); - }, }, created() { this.init(); @@ -189,20 +188,55 @@ // 描述间距 name_desc_space: parseInt(new_style.name_desc_space), }); + // 默认数据 + const product_style_list = [ + { name: '单列展示', value: '0', width:110, height: 83 }, + { name: '两列展示(纵向)', value: '1', width:180, height: 180 }, + { name: '大图展示', value: '2', width:0, height: 180 }, + { name: '无图模式', value: '3', width:0, height: 0 }, + { name: '左右滑动展示', value: '4', width:0, height: 0 }, + ]; + let img_style = ``; + if (['0'].includes(new_content.theme)) { + // 图片宽度 + if (typeof new_style.content_img_width == 'number') { + img_style += `width: ${ new_style.content_img_width * 2 }rpx;`; + } else { + const list = product_style_list.filter(item => item.value == new_content.theme); + if (list.length > 0) { + img_style += `width: ${ list[0].width * 2 }rpx;`; + } else { + img_style += 'width: auto;'; + } + } + } + if (!['3', '4'].includes(new_content.theme)) { + // 图片宽度 + if (typeof new_style.content_img_height == 'number') { + img_style += `height: ${ new_style.content_img_height * 2 }rpx;`; + } else { + const list = product_style_list.filter(item => item.value == new_content.theme); + if (list.length > 0) { + img_style += `height: ${ list[0].height * 2 }rpx;`; + } else { + img_style += 'height: auto;'; + } + } + } // 文章样式 if (this.article_theme == '0') { this.setData({ - article_item_height: `height: ${new_style.article_height * 2}rpx;`, + img_size: img_style, article_style: this.content_spacing + this.content_padding + this.content_radius, }); } else if (this.article_theme == '1') { this.setData({ - article_item_height: `height: ${new_style.article_height * 2}rpx;`, + img_size: img_style, article_style: `width: calc(50% - ${new_style.article_spacing / 2}px);` + this.content_radius, }); } else if (this.article_theme == '2') { this.setData({ - article_item_height: `height: ${new_style.article_height * 2}rpx;`, + img_size: img_style, article_style: this.content_radius, }); } else if (this.article_theme == '3') { @@ -221,10 +255,10 @@ interval_time: (new_style.interval_time || 2) * 1000, // 是否滚动修改 is_roll: new_style.is_roll, - article_item_height: `height: ${new_style.article_height * 2}rpx;`, + article_item_height: `height: ${new_style.article_height * 2}rpx`, article_style: this.article_style + this.content_radius + multicolumn_columns_width, // 轮播高度 - carousel_height_computer: new_style.article_height * 2 + 'rpx', + carousel_height_computer: (new_style.name_size * 2 + new_style.article_height) * 2 + 'rpx', // 文章内容高度 article_name_height_computer: `height:${new_style.name_size * 2.4 * 2}rpx;line-height:${new_style.name_size * 1.2 * 2}rpx;`, }); @@ -284,10 +318,6 @@ .style1 { .item { max-width: 100%; - .img { - height: 100%; - width: 220rpx; - } } } .style2 { @@ -295,7 +325,6 @@ width: calc(50% - 10rpx); .img { width: 100%; - height: 100%; } } } @@ -304,7 +333,6 @@ width: 100%; .img { width: 100%; - height: 100%; } } } diff --git a/components/diy/goods-list.vue b/components/diy/goods-list.vue index adc4dc81..20b310ba 100644 --- a/components/diy/goods-list.vue +++ b/components/diy/goods-list.vue @@ -16,10 +16,10 @@ - + - + @@ -232,6 +232,8 @@ simple_desc: '', // 按钮背景色 button_gradient: '', + // 图片大小 + img_size: '', }; }, watch: { @@ -268,7 +270,43 @@ const wrap = new_form.theme == '5' ? '' : 'flex-wrap '; const background = ['6'].includes(new_form.theme) ? 'bg-white ' : ''; const button_gradient = gradient_handle(new_style.shop_button_color, '180deg'); - + // 默认数据 + const product_style_list = [ + { name: '单列展示', value: '0', width: 110, height: 120 }, + { name: '大图展示', value: '2', width: 166, height: 166 }, + { name: '无图模式', value: '6', width: 0, height: 0 }, + { name: '两列展示(纵向)', value: '1', width: 180, height: 180 }, + { name: '两列展示(横向)', value: '4', width: 70, height: 70 }, + { name: '三列展示', value: '3', width: 116, height: 114 }, + { name: '左右滑动展示', value: '5', width: 0, height: 0 }, + ]; + let img_style = ``; + if (['0', '4'].includes(new_form.theme)) { + // 图片宽度 + if (typeof new_style.content_img_width == 'number') { + img_style += `width: ${ new_style.content_img_width * 2 }rpx;`; + } else { + const list = product_style_list.filter(item => item.value == new_form.theme); + if (list.length > 0) { + img_style += `width: ${ list[0].width * 2 }rpx;`; + } else { + img_style += 'width: auto;'; + } + } + } + if (!['5', '6'].includes(new_form.theme)) { + // 图片宽度 + if (typeof new_style.content_img_height == 'number') { + img_style += `height: ${ new_style.content_img_height * 2 }rpx;`; + } else { + const list = product_style_list.filter(item => item.value == new_form.theme); + if (list.length > 0) { + img_style += `height: ${ list[0].height * 2 }rpx;`; + } else { + img_style += 'height: auto;'; + } + } + } this.setData({ form: new_form, new_style: new_style, @@ -297,6 +335,7 @@ button_style: this.trends_config(new_style, 'button', 'buy_button') + button_gradient, simple_desc: this.trends_config(new_style, 'simple_desc', 'desc'), shop_content_list: this.get_shop_content_list(new_list, new_form), + img_size: img_style, }); } }, @@ -371,10 +410,7 @@ } else if (form.theme == '3') { size_style = `width: calc((100% - ${new_style.content_outer_spacing * 4 + 'rpx'}) / 3);`; } else if (form.theme == '5') { - size_style = `width: ${this.get_multicolumn_columns_width(new_style, form)};min-width: ${this.get_multicolumn_columns_width(new_style, form)};`; - } - if (form.theme != '6') { - size_style += `height: ${new_style.content_outer_height * 2 + 'rpx'};`; + size_style = `width: ${this.get_multicolumn_columns_width(new_style, form)};min-width: ${this.get_multicolumn_columns_width(new_style, form)};height: ${new_style.content_outer_height * 2 + 'rpx'};`; } return `${radius} ${padding} ${size_style}`; }, @@ -520,33 +556,8 @@ border-top-right-radius: 20rpx; padding: 0 20rpx 0 0; } - - .flex-img0 { - height: 100%; - width: 220rpx; - } - - .flex-img1 { - width: 100%; - height: 100%; - } - - .flex-img2 { - width: 100%; - height: 100%; - } - - .flex-img3 { - width: 100%; - height: 100%; - } - .flex-img4 { - width: 140rpx; - height: 100%; - } .flex-img5 { width: 100%; - // min-height: 208rpx; height: 100%; } .original-price-left {