From d68fc47aa841cb0c48d78021d524d0a08379447e Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Sat, 6 May 2023 18:29:47 +0800 Subject: [PATCH] 列表样式 --- components/diy_seckill/diy_seckill.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++++---------------------- components/diy_seckill/diy_seckill.wxml | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------- components/diy_seckill/diy_seckill.wxss | 25 +++++++++++++++++++------ 3 files changed, 132 insertions(+), 45 deletions(-) diff --git a/components/diy_seckill/diy_seckill.js b/components/diy_seckill/diy_seckill.js index 01bed56..761d6b7 100644 --- a/components/diy_seckill/diy_seckill.js +++ b/components/diy_seckill/diy_seckill.js @@ -37,7 +37,8 @@ Component({ timer: null, user_id:0, img_width:100, - img_height:100 + img_height:100, + swiperHeight:0 }, pageLifetimes: { @@ -69,7 +70,6 @@ Component({ ready: function () { var g_id = this.data.object; - this.init(g_id); this.data.user_id=getApp().globalData.user_id; }, @@ -125,17 +125,7 @@ Component({ th.no_gid_set(); } }, - imageLoad(e){ - var width=e.detail.width, //获取图片真实宽度 - height=e.detail.height, - ratio=width/height; //图片的真实宽高比例 - let object=this.data.object - let picture_scale=object.picture_scale - if (condition) { - - } - }, //当是默认的情况 no_gid_set() { var user_id=getApp().globalData.user_id; @@ -207,26 +197,37 @@ Component({ Promise.all(promisies).then(() => { - // 判断活动是否结束 for(let i in all_array){ let item=all_array[i]; if(newTime > item.end_time) { all_array[i].status = 3; - }; - + }; } - var arr = new Array(); - //--三个三个一组--- - for (var i = 0; i < all_array.length; i += 3) { - arr.push(all_array.slice(i, i + 3)); - } + var arr = new Array(); + if (th.data.object.style==6) { + //--三个三个一组--- + for (var i = 0; i < all_array.length; i += 2) { + arr.push(all_array.slice(i, i + 2)); + } + + }else{ + //--三个三个一组--- + for (var i = 0; i < all_array.length; i += 3) { + arr.push(all_array.slice(i, i + 3)); + } + } + /*--熏染到前台--*/ console.log('秒杀数据:'); console.log(arr); console.error('....................'); - th.setData({ goods_array: arr }); + th.setData({ goods_array: arr }); + if (th.data.object.style==6) { + th.setSwiper_h() + } + }); @@ -234,7 +235,32 @@ Component({ th.countDown2(th); }, 1000); }, - + setSwiper_h(){ + var th=this + wx.createSelectorQuery().in(this).select('.swiper_h').boundingClientRect(rect => { + console.error('组件高度'); + console.log(rect) + if (rect && rect.height) { + var sumHeigth=(rect.height+13)+'px' + th.setData({ + swiperHeight: sumHeigth + }) + } + }).exec(); + // const query = this.createSelectorQuery() + // query.select('.swiper_h').boundingClientRect() + // query.exec( (res)=> { + // console.log(res) + // console.log(res[0].height) + // console.log(res[0].height * data.t.length) + // let sumHeigth = res[0].height * data.t.length; + // console.error('组件高度'); + // console.log(sumHeigth); + // th.setData({ + // swiperHeight: sumHeigth + // }) + // }) + }, //---小于10的格式化函数---- diff --git a/components/diy_seckill/diy_seckill.wxml b/components/diy_seckill/diy_seckill.wxml index cc5860f..fb19cc1 100644 --- a/components/diy_seckill/diy_seckill.wxml +++ b/components/diy_seckill/diy_seckill.wxml @@ -26,15 +26,15 @@ - + 距结束时间 {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} - {{aitem.goods_name}} - + {{aitem.goods_name}} + {{aitem.price}} @@ -59,13 +59,13 @@ - + - + @@ -104,13 +104,13 @@ - + - + @@ -149,14 +149,14 @@ - + - + @@ -211,15 +211,15 @@ - + 距结束时间 {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} - {{aitem.goods_name}} - + {{aitem.goods_name}} + {{aitem.price}} @@ -237,13 +237,13 @@ - + - + @@ -275,13 +275,13 @@ - + - + @@ -317,7 +317,54 @@ + + + + + + + + + + + + + + + + + + + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + 已秒 10 + 还剩余20 + + + + + {{aitem.price}} + ¥{{aitem.market_price}} + + + + + {{object.button_content}} + + + + + + + + @@ -451,4 +498,5 @@ - \ No newline at end of file + + diff --git a/components/diy_seckill/diy_seckill.wxss b/components/diy_seckill/diy_seckill.wxss index 0aea913..1604b02 100644 --- a/components/diy_seckill/diy_seckill.wxss +++ b/components/diy_seckill/diy_seckill.wxss @@ -292,7 +292,7 @@ swiper { .ellipsis-2 { - height: 75rpx; + height: 97rpx; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; @@ -312,7 +312,7 @@ swiper { max-height: 100%; */ } .new_item1_time{ - height: 70rpx; + height: 60rpx; background: rgba(196, 24, 45, 1); color: #fff; font-size: 25rpx; @@ -327,13 +327,14 @@ swiper { height: 52rpx; } .new_item1_goods_name{ - padding: 10rpx; + padding: 10rpx 0rpx; font-size: 26rpx; width: 100%; + box-sizing: border-box; } .new_item1_price{ display: flex; - padding: 0 10rpx; + /* padding: 0 10rpx; */ align-items: center; justify-content: space-between; font-size: 26rpx; @@ -389,7 +390,7 @@ swiper { border-radius:289rpx; } .but_radius5{ - border-radius:17px; + border-radius:17px 17px 0 0; } .imgBox{ position: relative; @@ -400,6 +401,7 @@ swiper { top: 22rpx; width: 74rpx; height: 70rpx; + } .aspect_ratio1{ @@ -459,4 +461,15 @@ swiper { justify-content: space-between; flex-wrap: wrap; box-sizing: border-box; -} \ No newline at end of file +} +.flex2:after { + content: ""; + width: 30%; + height: 0px; + visibility: hidden; + } + + .boxpad{ + padding:11rpx 9rpx; + box-sizing: border-box; + } \ No newline at end of file -- libgit2 0.21.4