Commit 04bdf83d0770666da51c6c1e832f5afae88d99fe

Authored by 前端开发-罗建龙
1 parent 3c428e9e

大图模式

components/diy_seckill/diy_seckill.js
... ... @@ -125,7 +125,17 @@ Component({
125 125 th.no_gid_set();
126 126 }
127 127 },
  128 + imageLoad(e){
  129 + var width=e.detail.width, //获取图片真实宽度
  130 + height=e.detail.height,
  131 + ratio=width/height; //图片的真实宽高比例
  132 + let object=this.data.object
  133 + let picture_scale=object.picture_scale
  134 + if (condition) {
  135 +
  136 + }
128 137  
  138 + },
129 139 //当是默认的情况
130 140 no_gid_set() {
131 141 var user_id=getApp().globalData.user_id;
... ...
components/diy_seckill/diy_seckill.wxml
1 1 <block wx:if="{{goods_array.length>0}}">
  2 + <!--新版秒杀组件-->
2 3 <block wx:if="{{object.column_action_name}}">
3   - <!--秒杀-->
4 4 <view class='top' bindtap="go_to_skill" wx:if="{{object.column_title}}" style="{{'background-image:url('+object.column_diy_title+')'}}">
5 5 <view class="flex">
6 6 <view class='t_left'></view>
... ... @@ -10,14 +10,19 @@
10 10 <image src="{{imghost}}/miniapp/images/icon-arrowdown.png" lazy-load="true"></image>
11 11 </view>
12 12 </view>
  13 + <!-- 大图模式 -->
13 14 <block wx:if="{{object.style==1}}">
14   - <view style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'}}" class="new_item1_box">
  15 + <view style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'}}" class="{{'new_item1_box '+ ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}">
15 16 <block wx:for="{{goods_array}}">
16   - <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}" style="{{'margin-bottom:'+object.page_margins+'px;'}}">
  17 + <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}" style="{{'margin-bottom:'+object.product_spacing+'px;'}}">
17 18 <navigator url="{{aitem.goods_type == 1 ? ('/packageA/pages/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id ) : ('/pages/goods/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id)}}" class="s1_gk_a1">
18   - <view class="imgBox">
  19 + <view class="imgBox">
19 20 <!-- <image mode="{{object.picture_fill==1 ? 'aspectFill' : 'scaleToFill'}}" class="{{'new_item1_image '+ 'aspect_ratio'+object.picture_scale}}" style="{{'width:'+img_width+';height:'+img_height}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> -->
20   - <image mode="scaleToFill" class="{{'new_item1_image '+ 'aspect_ratio'+object.picture_scale}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image>
  21 + <view class="{{'container'+object.picture_scale}}" style="{{object.picture_fill==1 ? 'background-color: #fff;' : ''}}">
  22 + <!-- <image mode="{{object.picture_fill==1 ? 'aspectFit' : 'aspectFill'}}" class="{{'new_item1_image images1'}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> -->
  23 + <image mode="{{object.picture_fill==1 ? 'aspectFit' : 'aspectFill'}}" class="{{'new_item1_image images1'}}" src="./t1.png" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image>
  24 + </view>
  25 +
21 26 <image class="imgBox_img" wx:if="{{object.subscript_style==5}}" src="{{object.subscript_diy_style}}"></image>
22 27 <image class="imgBox_img" wx:if="{{object.subscript_style<=4}}" src="{{imghost+'/miniapp/images/component/j0'+object.subscript_style +'.png'}}"></image>
23 28 </view>
... ... @@ -28,10 +33,10 @@
28 33 <view>{{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}}</view>
29 34 </view>
30 35 </view>
31   - <view class="ellipsis-2 new_item1_goods_name" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view>
32   - <view class="new_item1_price">
33   - <view>
34   - <view class="flex" style="font-size: 28rpx;">
  36 + <view class="ellipsis-2 new_item1_goods_name" style="{{(object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view>
  37 + <view class="new_item1_price" style="{{(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}">
  38 + <view style="{{(object.text_style==2 ? 'font-weight: bold;':'')}}">
  39 + <view class="flex" style="{{'font-size: 28rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}">
35 40 <view class="clor" style="margin-right: 5rpx;" wx:if="{{object.commodity_price}}">¥<text style="font-size:42rpx;">{{aitem.price}}</text></view>
36 41 <view wx:if="{{object.wholesale_price}}">¥{{aitem.market_price}}</view>
37 42 </view>
... ... @@ -50,6 +55,51 @@
50 55 </block>
51 56 </view>
52 57 </block>
  58 + <!-- 一行两个 -->
  59 + <block wx:if="{{object.style==2}}">
  60 + <view style="{{'padding-left:'+object.page_margins+'px;padding-right:'+object.page_margins+'px;'}}" class="{{'flex2 new_item1_box '+ ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}">
  61 + <block wx:for="{{goods_array}}">
  62 + <view wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind" class="{{'new_item1 ' + (object.product_style==2 ? ' boxsha ':'') + (object.product_style==3 ? ' aborder ':'') + (object.chamfer_of_main_drawing==2 ? ' but_radius5 ':'') + ((object.product_style==1 || object.product_style==3 )? ' bgf ':'')}}" style="{{'margin-bottom:'+object.product_spacing+'px; '+('width:calc(100%/2 - ' + object.product_spacing/2+'px)')}}">
  63 + <navigator url="{{aitem.goods_type == 1 ? ('/packageA/pages/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id ) : ('/pages/goods/goodsInfo/goodsInfo?goods_id=' + aitem.goods_id + '&title=' + aitem.goods_name + '&prom_type=1&prom_id=' + aitem.id)}}" class="s1_gk_a1">
  64 + <view class="imgBox">
  65 + <!-- <image mode="{{object.picture_fill==1 ? 'aspectFill' : 'scaleToFill'}}" class="{{'new_item1_image '+ 'aspect_ratio'+object.picture_scale}}" style="{{'width:'+img_width+';height:'+img_height}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> -->
  66 + <view class="{{'container'+object.picture_scale}}" style="{{object.picture_fill==1 ? 'background-color: #fff;' : ''}}">
  67 + <!-- <image mode="{{object.picture_fill==1 ? 'aspectFit' : 'aspectFill'}}" class="{{'new_item1_image images1'}}" src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image> -->
  68 + <image mode="{{object.picture_fill==1 ? 'aspectFit' : 'aspectFill'}}" class="{{'new_item1_image images1'}}" src="./t1.png" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image>
  69 + </view>
  70 +
  71 + <image class="imgBox_img" wx:if="{{object.subscript_style==5}}" src="{{object.subscript_diy_style}}"></image>
  72 + <image class="imgBox_img" wx:if="{{object.subscript_style<=4}}" src="{{imghost+'/miniapp/images/component/j0'+object.subscript_style +'.png'}}"></image>
  73 + </view>
  74 + <view class="new_item1_time" wx:if="{{object.count_down}}" style="justify-content: center;">
  75 + <!-- <image src="{{imghost+'/miniapp/images/component/seckill.png'}}"></image> -->
  76 + <!-- <view style="text-align: center;">
  77 + <view>距结束时间</view> -->
  78 + <view>{{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}}</view>
  79 + <!-- </view> -->
  80 + </view>
  81 + <view class="ellipsis-2 new_item1_goods_name" style="{{(object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view>
  82 + <view class="new_item1_price" style="color: rgb(56, 56, 56);">
  83 + <text wx:if="{{object.seconds_num}}">已秒 <text class="clor">10</text>件,</text>
  84 + <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">20</text>件</text>
  85 + </view>
  86 + <view class="new_item1_price" style="{{(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}">
  87 + <view style="{{(object.text_style==2 ? 'font-weight: bold;':'')}}">
  88 + <view style="{{'font-size: 28rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}">
  89 + <view class="clor" style="margin-right: 5rpx;" wx:if="{{object.commodity_price}}">¥<text style="font-size:42rpx;">{{aitem.price}}</text></view>
  90 + <view wx:if="{{object.wholesale_price}}">¥{{aitem.market_price}}</view>
  91 + </view>
  92 + </view>
  93 + <view>
  94 + <image wx:if="{{object.purchase_button<=4}}" src="{{imghost+'/miniapp/images/component/0'+object.purchase_button+'.png'}}" style="width: 122rpx;height: 122rpx;"></image>
  95 + <view wx:if="{{ 5<=object.purchase_button && object.purchase_button<=8 }}" class="{{'new_item1_but ' + (object.purchase_button==5 ? 'new_item1_but1':'' )+ (object.purchase_button==7 ? 'new_item1_but2':'' )+ (object.purchase_button==8 ? 'new_item1_but3':'' ) }}">{{object.button_content}}</view>
  96 + </view>
  97 + </view>
  98 + </navigator>
  99 + </view>
  100 + </block>
  101 + </view>
  102 + </block>
53 103 </block>
54 104 <block wx:else>
55 105 <!--秒杀-->
... ...
components/diy_seckill/diy_seckill.wxss
... ... @@ -304,6 +304,7 @@ swiper {
304 304 width: 100%;
305 305 overflow: hidden;
306 306 }
  307 +
307 308 .new_item1_image{
308 309 width: 100%;
309 310 /* max-width: 100%;
... ... @@ -396,7 +397,7 @@ swiper {
396 397 left: 0;
397 398 top: 22rpx;
398 399 width: 74rpx;
399   - height: 60rpx;
  400 + height: 70rpx;
400 401 }
401 402  
402 403 .aspect_ratio1{
... ... @@ -411,3 +412,49 @@ swiper {
411 412 .aspect_ratio4{
412 413 aspect-ratio:3/4;
413 414 }
  415 +.container1 {
  416 + position: relative;
  417 + width:100%;
  418 + padding-top: 100%;
  419 + overflow: hidden;
  420 +}
  421 +.container2 {
  422 + position: relative;
  423 + width:100%;
  424 + padding-top: 56.25%;
  425 + overflow: hidden;
  426 +}
  427 +.container3 {
  428 + position: relative;
  429 + width:100%;
  430 + padding-top: 66.67%;
  431 + overflow: hidden;
  432 +}
  433 +.container4 {
  434 + position: relative;
  435 + width:100%;
  436 + padding-top: 133.33%;
  437 + overflow: hidden;
  438 +
  439 +}
  440 +
  441 +.images1 {
  442 + display: block;
  443 + position: absolute;
  444 + width: 100%;
  445 + height: 100%;
  446 + top: 0;
  447 + bottom: 0;
  448 + left: 0;
  449 + right: 0;
  450 + object-fit: cover;
  451 +
  452 +}
  453 +
  454 +.flex2{
  455 + display: flex;
  456 + /* align-items: center; */
  457 + justify-content: space-between;
  458 + flex-wrap: wrap;
  459 + box-sizing: border-box;
  460 +}
414 461 \ No newline at end of file
... ...