From 7ac30532d9523063a84ef6c899ab36eb1a3c35ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 19 Sep 2024 15:31:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=AD=94=E6=96=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/common/common.js | 14 +- components/diy/data-magic.vue | 338 ++++++++++++++++++ components/diy/diy.vue | 100 ++---- components/diy/float-window.vue | 4 +- .../diy/modules/data-magic/magic-carousel.vue | 59 +++ .../modules/data-magic/product-list-show.vue | 179 ++++++++++ components/diy/modules/image-empty.vue | 10 +- components/diy/nav-group.vue | 28 +- 8 files changed, 650 insertions(+), 82 deletions(-) create mode 100644 components/diy/data-magic.vue create mode 100644 components/diy/modules/data-magic/magic-carousel.vue create mode 100644 components/diy/modules/data-magic/product-list-show.vue diff --git a/common/js/common/common.js b/common/js/common/common.js index 349c750f..6cd2a9fb 100644 --- a/common/js/common/common.js +++ b/common/js/common/common.js @@ -181,4 +181,16 @@ export function get_math () { randomString = randomString.length >= 6 ? randomString : randomString.padStart(6, '0'); // 截取掉随机字符串开头的'0.'部分,获得最终的6位随机字符串。 return randomString.substring(2); -} \ No newline at end of file +} + +/** + * 将大小计算成百分比 + * + * @param num 当前的大小或位置。 + * @param size 容器的大小。 + * @returns 计算后的百分比值,含4位小数 + */ +export const percentage_count = (num, container_size) => { + const marks = (num / container_size) * 100; + return marks.toFixed(4) + '%'; +}; \ No newline at end of file diff --git a/components/diy/data-magic.vue b/components/diy/data-magic.vue new file mode 100644 index 00000000..5bdb7a07 --- /dev/null +++ b/components/diy/data-magic.vue @@ -0,0 +1,338 @@ + + + + + + + + + + + {{ item.data_content.heading_title || '' }} + {{ item.data_content.subtitle || '' }} + + + + + + + + + + + + + {{ item.actived_index + 1 }}/{{ item.data_content.list.length }} + + + + + + + + + + + + + + + {{ item.data_content.heading_title || '' }} + {{ item.data_content.subtitle || '' }} + + + + + + + + + + + + + {{ item.actived_index + 1 }}/{{ item.data_content.list.length }} + + + + + + + + + + + + + + + diff --git a/components/diy/diy.vue b/components/diy/diy.vue index a69ad597..46cebdfa 100644 --- a/components/diy/diy.vue +++ b/components/diy/diy.vue @@ -2,34 +2,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -37,32 +29,25 @@ + + \ No newline at end of file diff --git a/components/diy/modules/data-magic/product-list-show.vue b/components/diy/modules/data-magic/product-list-show.vue new file mode 100644 index 00000000..9ee1ceb4 --- /dev/null +++ b/components/diy/modules/data-magic/product-list-show.vue @@ -0,0 +1,179 @@ + + + + + + + + + + + + + {{ item.title }} + + {{ item.show_price_symbol }}{{ item.min_price }} + + {{ item.show_price_unit }} + + + + + + + + + + + + + + + + {{ item.show_price_symbol }}{{ item.min_price }} + + {{ item.show_price_unit }} + + + + {{ item.title }} + + + + + + + + + + + + {{ item.title }} + + {{ item.show_price_symbol }}{{ item.min_price }} + + {{ item.show_price_unit }} + + + + + + + + + + + + + + + + + + + {{ item.title }} + + {{ item.show_price_symbol }}{{ item.min_price }} + + {{ item.show_price_unit }} + + + + + + + + + + + + \ No newline at end of file diff --git a/components/diy/modules/image-empty.vue b/components/diy/modules/image-empty.vue index 7355d8ac..3663cef9 100644 --- a/components/diy/modules/image-empty.vue +++ b/components/diy/modules/image-empty.vue @@ -1,5 +1,5 @@ - + @@ -19,6 +19,14 @@ img_fit: { type: String, default: () => 'aspectFill', + }, + type_style: { + type: String, + default: () => '', + }, + type_class: { + type: String, + default: () => '', } }, data() { diff --git a/components/diy/nav-group.vue b/components/diy/nav-group.vue index 0bf8abfe..d0865159 100644 --- a/components/diy/nav-group.vue +++ b/components/diy/nav-group.vue @@ -2,7 +2,7 @@ - + @@ -50,7 +50,7 @@ img_style: '', text_style: '', indicator_style: '', - newHeight: '200rpx', + newHeight: '300rpx', actived_index: 0, group_width: '', nav_content_list: [], @@ -61,15 +61,9 @@ form: this.value.content, new_style: this.value.style, }); - this.init(); }, mounted() { - this.$nextTick(() => { - this.newHeight = this.$refs.bannerImg[0].$el.clientHeight * 2 + 'rpx'; - }); - window.onresize = () => { - this.newHeight = this.$refs.bannerImg[0].$el.clientHeight * 2 + 'rpx'; - }; + this.init(); }, methods: { init() { @@ -83,6 +77,21 @@ nav_style: this.form.nav_style || 'image_with_text', // 是否显示文字和图片 nav_content_list: this.get_nav_content_list(), }); + setTimeout(() => { + const query = uni.createSelectorQuery().in(this); + // 选择我们想要的元素 + query + .select('.bannerImg') + .boundingClientRect((res) => { + if ((res || null) != null) { + // data包含元素的宽度、高度等信息 + this.setData({ + newHeight: res.height * 2 + 'rpx', + }); + } + }) + .exec(); // 执行查询 + }, 0) }, get_nav_content_list() { // 深拷贝一下,确保不会出现问题 @@ -148,6 +157,7 @@ height: 100rpx; width: 100rpx; border-radius: 8rpx; + background-color: #f4fcff; } .dot { From d5434fd92e0b0a81e9164f5e7640a7de9093e8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 19 Sep 2024 15:54:30 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/diy/diy.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/diy/diy.vue b/components/diy/diy.vue index 67d049e6..b016abf5 100644 --- a/components/diy/diy.vue +++ b/components/diy/diy.vue @@ -100,8 +100,6 @@ }, }, methods: { -<<<<<<< HEAD -======= init() { // tabs选项卡数据过滤 const filter_tabs_list = this.value.tabs_data; @@ -112,7 +110,6 @@ }); } }, ->>>>>>> dev-sws footer_height_computer(number) { this.padding_footer_computer = number * 2; }, From cfffb723f188166106924b9616755f5571b8c06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 19 Sep 2024 16:46:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/diy/custom.vue | 78 ++++++++++++++ components/diy/data-magic.vue | 18 ---- components/diy/diy.vue | 14 ++- components/diy/modules/custom/model-image.vue | 81 ++++++++++++++ components/diy/modules/custom/model-lines.vue | 44 ++++++++ components/diy/modules/custom/model-text.vue | 101 ++++++++++++++++++ 6 files changed, 316 insertions(+), 20 deletions(-) create mode 100644 components/diy/custom.vue create mode 100644 components/diy/modules/custom/model-image.vue create mode 100644 components/diy/modules/custom/model-lines.vue create mode 100644 components/diy/modules/custom/model-text.vue diff --git a/components/diy/custom.vue b/components/diy/custom.vue new file mode 100644 index 00000000..d923f0e1 --- /dev/null +++ b/components/diy/custom.vue @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/components/diy/data-magic.vue b/components/diy/data-magic.vue index 5bdb7a07..f4496cdb 100644 --- a/components/diy/data-magic.vue +++ b/components/diy/data-magic.vue @@ -317,22 +317,4 @@ .gap-20 { gap: 40rpx; } -// 轮播高度自适应 -:deep(.el-carousel) { - height: 100%; - .el-carousel__container { - height: 100%; - } -} - -:deep(.el-image) { - height: 100%; - width: 100%; - .el-image__inner { - object-fit: cover; - } - .image-slot img { - width: 6rem; - } -} diff --git a/components/diy/diy.vue b/components/diy/diy.vue index b016abf5..cd4f398b 100644 --- a/components/diy/diy.vue +++ b/components/diy/diy.vue @@ -6,6 +6,7 @@ + {{ item.key }} @@ -18,6 +19,7 @@ + @@ -57,7 +59,8 @@ import componentNavGroup from '@/components/diy/nav-group.vue'; import componentGoodsList from '@/components/diy/goods-list.vue'; import componentGoodsTabs from '@/components/diy/goods-tabs.vue'; - import componentDataMagic from '@/components/diy/data-magic.vue' + import componentDataMagic from '@/components/diy/data-magic.vue'; + import componentCustom from '@/components/diy/custom.vue' export default { name: 'diy', props: { @@ -85,12 +88,19 @@ componentNavGroup, componentGoodsList, componentGoodsTabs, - componentDataMagic + componentDataMagic, + componentCustom }, data() { return { // 底部菜单导航高度计算 padding_footer_computer: 140, + // 是否有选项卡 + is_tabs: false, + // 选项卡数据 + tabs_data: {}, + // 是否是模块数据或者是九宫格商品分类样式数据, 默认模块数据 + is_tabs_type: true, }; }, diff --git a/components/diy/modules/custom/model-image.vue b/components/diy/modules/custom/model-image.vue new file mode 100644 index 00000000..095d85e9 --- /dev/null +++ b/components/diy/modules/custom/model-image.vue @@ -0,0 +1,81 @@ + + + + + + + diff --git a/components/diy/modules/custom/model-lines.vue b/components/diy/modules/custom/model-lines.vue new file mode 100644 index 00000000..3408f319 --- /dev/null +++ b/components/diy/modules/custom/model-lines.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/components/diy/modules/custom/model-text.vue b/components/diy/modules/custom/model-text.vue new file mode 100644 index 00000000..ab10418e --- /dev/null +++ b/components/diy/modules/custom/model-text.vue @@ -0,0 +1,101 @@ + + + + + + + + {{ text_title }} + + + + + + From 3420d8dd1be83358075acea4fb62f6b01d0878c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 19 Sep 2024 16:57:10 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=BB=84=E4=BB=B6=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/diy/custom.vue | 10 +++++- components/diy/diy.vue | 5 +-- components/diy/modules/custom/model-image.vue | 16 +++++----- components/diy/modules/custom/model-lines.vue | 4 +-- components/diy/modules/custom/model-text.vue | 4 +-- .../diy/modules/data-magic/magic-carousel.vue | 13 ++++---- .../modules/data-magic/product-list-show.vue | 31 ++++++++++--------- 7 files changed, 47 insertions(+), 36 deletions(-) diff --git a/components/diy/custom.vue b/components/diy/custom.vue index d923f0e1..baa772e6 100644 --- a/components/diy/custom.vue +++ b/components/diy/custom.vue @@ -1,7 +1,7 @@ - + @@ -47,6 +47,13 @@ custom_height: 0, }; }, + computed: { + get_percentage_count() { + return (num, container_size) => { + return this.percentage_count(num, container_size); + } + } + }, created() { this.setData({ form: this.value.content, @@ -55,6 +62,7 @@ this.init(); }, methods: { + percentage_count, init() { this.setData({ style_container: common_styles_computer(this.new_style.common_style) + 'box-sizing: border-box;', // 用于样式显示 diff --git a/components/diy/diy.vue b/components/diy/diy.vue index cd4f398b..d66fe945 100644 --- a/components/diy/diy.vue +++ b/components/diy/diy.vue @@ -6,7 +6,6 @@ - {{ item.key }} @@ -103,12 +102,14 @@ is_tabs_type: true, }; }, - computed: { diy_content_style() { return `padding-bottom:${this.padding_footer_computer}rpx`; }, }, + mounted() { + this.init(); + }, methods: { init() { // tabs选项卡数据过滤 diff --git a/components/diy/modules/custom/model-image.vue b/components/diy/modules/custom/model-image.vue index 095d85e9..aa7b37da 100644 --- a/components/diy/modules/custom/model-image.vue +++ b/components/diy/modules/custom/model-image.vue @@ -1,12 +1,15 @@ - + - \ No newline at end of file + diff --git a/components/diy/modules/data-magic/product-list-show.vue b/components/diy/modules/data-magic/product-list-show.vue index 9ee1ceb4..888f30ff 100644 --- a/components/diy/modules/data-magic/product-list-show.vue +++ b/components/diy/modules/data-magic/product-list-show.vue @@ -12,7 +12,8 @@ {{ item.title }} - {{ item.show_price_symbol }}{{ item.min_price }} + {{ item.show_price_symbol }}{{ item.min_price }} {{ item.show_price_unit }} @@ -36,7 +37,7 @@ - {{ item.title }} + {{ item.title }} @@ -50,7 +51,8 @@ {{ item.title }} - {{ item.show_price_symbol }}{{ item.min_price }} + {{ item.show_price_symbol }}{{ item.min_price }} {{ item.show_price_unit }} @@ -73,7 +75,8 @@ {{ item.title }} - {{ item.show_price_symbol }}{{ item.min_price }} + {{ item.show_price_symbol }}{{ item.min_price }} {{ item.show_price_unit }} @@ -87,7 +90,7 @@ \ No newline at end of file + From c6337499b268c340615aa6b976efffaa39382fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 19 Sep 2024 17:11:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/diy/goods-list.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/diy/goods-list.vue b/components/diy/goods-list.vue index bf11c4bf..05205a04 100644 --- a/components/diy/goods-list.vue +++ b/components/diy/goods-list.vue @@ -469,10 +469,15 @@ width: 100%; height: 228rpx; } - .flex-img4 { min-width: 140rpx; min-height: 140rpx; + height: 100%; + } + .flex-img5 { + width: 100%; + min-height: 208rpx; + height: 100%; } .plr-11 { padding-left: 22rpx; @@ -490,10 +495,6 @@ padding-top: 10rpx; padding-bottom: 10rpx; } - .flex-img5 { - width: 100%; - min-height: 208rpx; - } .ptb-15 { padding-top: 30rpx; padding-bottom: 30rpx;
{{ item.data_content.heading_title || '' }}
{{ item.data_content.subtitle || '' }}