Commit 01af041e3b6416c9a2f9a73cf2baaf489eb3323a
1 parent
cb2e462f
助力活动轮播图高度修改
Showing
3 changed files
with
41 additions
and
14 deletions
pages/user/assistance/task_assistance.js
| @@ -64,7 +64,8 @@ Page({ | @@ -64,7 +64,8 @@ Page({ | ||
| 64 | djs: "", //定时器的显示 | 64 | djs: "", //定时器的显示 |
| 65 | //*********************************************end | 65 | //*********************************************end |
| 66 | 66 | ||
| 67 | - Hei: 0, | 67 | + // Hei: 0, |
| 68 | + max_sw_height: 0, | ||
| 68 | }, | 69 | }, |
| 69 | 70 | ||
| 70 | /** | 71 | /** |
| @@ -1076,16 +1077,34 @@ Page({ | @@ -1076,16 +1077,34 @@ Page({ | ||
| 1076 | }, | 1077 | }, |
| 1077 | 1078 | ||
| 1078 | 1079 | ||
| 1079 | - imgH:function(e){ | 1080 | + // imgH:function(e){ |
| 1080 | 1081 | ||
| 1081 | - var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度 | ||
| 1082 | - var imgh = e.detail.height; //图片高度 | ||
| 1083 | - var imgw = e.detail.width; | ||
| 1084 | - var swiperH = winWid*0.827*imgh/imgw + "px" //等比设置swiper的高度。 即 屏幕宽度 / swiper高度 = 图片宽度 / 图片高度 ==》swiper高度 = 屏幕宽度 * 图片高度 / 图片宽度 | ||
| 1085 | - console.log('imgload',winWid, imgh, imgw, swiperH); | 1082 | + // var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度 |
| 1083 | + // var imgh = e.detail.height; //图片高度 | ||
| 1084 | + // var imgw = e.detail.width; | ||
| 1085 | + // var swiperH = winWid*0.827*imgh/imgw + "px" //等比设置swiper的高度。 即 屏幕宽度 / swiper高度 = 图片宽度 / 图片高度 ==》swiper高度 = 屏幕宽度 * 图片高度 / 图片宽度 | ||
| 1086 | + // console.log('imgload',winWid, imgh, imgw, swiperH); | ||
| 1087 | + // this.setData({ | ||
| 1088 | + // Hei:swiperH //设置高度 | ||
| 1089 | + // }) | ||
| 1090 | + | ||
| 1091 | + // imgs | ||
| 1092 | + // }, | ||
| 1093 | + | ||
| 1094 | + | ||
| 1095 | + imageLoad: function(e) { | ||
| 1096 | + var winWid = wx.getSystemInfoSync().windowWidth; | ||
| 1097 | + var imgwidth = e.detail.width; | ||
| 1098 | + var imgheight = e.detail.height; | ||
| 1099 | + //宽高比 | ||
| 1100 | + var ratio = imgwidth / imgheight; | ||
| 1101 | + //计算的高度值 | ||
| 1102 | + var viewHeight = winWid / ratio * 0.8; | ||
| 1103 | + if (this.data.max_sw_height < viewHeight) { | ||
| 1086 | this.setData({ | 1104 | this.setData({ |
| 1087 | - Hei:swiperH //设置高度 | ||
| 1088 | - }) | 1105 | + max_sw_height: viewHeight |
| 1106 | + }); | ||
| 1107 | + }; | ||
| 1089 | }, | 1108 | }, |
| 1090 | 1109 | ||
| 1091 | }) | 1110 | }) |
pages/user/assistance/task_assistance.wxml
| 1 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> | 1 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> |
| 2 | -<view class="top-back" style="padding-bottom:{{is_user_task!=null&&is_user_task.status==0?50:0}}rpx;background-image: url({{iurl}}/miniapp/images/friendhelp/lumi.png)" bindtap="close"> | 2 | +<view class="top-back" style="padding-bottom:80rpx;background-image: url({{iurl}}/miniapp/images/friendhelp/lumi.png)" bindtap="close"> |
| 3 | +<!-- <view class="top-back" style="padding-bottom:{{is_user_task!=null&&is_user_task.status==0?50:0}}rpx;background-image: url({{iurl}}/miniapp/images/friendhelp/lumi.png)" bindtap="close"> --> | ||
| 3 | <!-- 助力活动头部 --> | 4 | <!-- 助力活动头部 --> |
| 4 | <view class="top-frame"> | 5 | <view class="top-frame"> |
| 5 | <view class="flex-center"> | 6 | <view class="flex-center"> |
| @@ -16,15 +17,15 @@ | @@ -16,15 +17,15 @@ | ||
| 16 | </view> | 17 | </view> |
| 17 | </view> | 18 | </view> |
| 18 | <!-- 图片的轮播图 --> | 19 | <!-- 图片的轮播图 --> |
| 19 | - <view class="xc-specific-more-frame flex-center" style="height:{{Hei}};"> | 20 | + <view class="xc-specific-more-frame flex-center" style="height:{{max_sw_height}}px;"> |
| 20 | <view bindtap="click_pre"> | 21 | <view bindtap="click_pre"> |
| 21 | <view class="bg_left xc-left bcolor"></view> | 22 | <view class="bg_left xc-left bcolor"></view> |
| 22 | </view> | 23 | </view> |
| 23 | <!-- <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> --> | 24 | <!-- <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> --> |
| 24 | - <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}" style='width:82.7%;height: 100%;'> | 25 | + <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}" style='width:80%;height:100%;'> |
| 25 | <swiper-item class="rel" wx:for="{{aitem}}" wx:for-item="aitem" wx:for-index="pidx"> | 26 | <swiper-item class="rel" wx:for="{{aitem}}" wx:for-item="aitem" wx:for-index="pidx"> |
| 26 | 27 | ||
| 27 | - <image class="xc-center-img" bindtap="libao_details" data-taskid="{{aitem.id}}" src="{{aitem.giftBagUrl!=null&&aitem.giftBagUrl!=''?iurl+aitem.giftBagUrl:swpie_img}}" mode="widthFix" bindload='imgH' style="width: 100%;display: block;"></image> | 28 | + <image class="xc-center-img" bindtap="libao_details" data-taskid="{{aitem.id}}" src="{{aitem.giftBagUrl!=null&&aitem.giftBagUrl!=''?iurl+aitem.giftBagUrl:swpie_img}}" mode="widthFix" bindload='imageLoad' style="width: 100%;display: block;"></image> |
| 28 | <view bindtap="libao_details" data-taskid="{{aitem.id}}" class="abs select_details fs26 white">礼包详情</view> | 29 | <view bindtap="libao_details" data-taskid="{{aitem.id}}" class="abs select_details fs26 white">礼包详情</view> |
| 29 | 30 | ||
| 30 | </swiper-item> | 31 | </swiper-item> |
| @@ -65,7 +66,8 @@ | @@ -65,7 +66,8 @@ | ||
| 65 | 66 | ||
| 66 | </view> | 67 | </view> |
| 67 | <!-- 底部列表 --> | 68 | <!-- 底部列表 --> |
| 68 | -<view style="margin-top:{{is_user_task!=null?52:0}}rpx"> | 69 | +<view> |
| 70 | +<!-- <view style="margin-top:{{is_user_task!=null?52:0}}rpx"> --> | ||
| 69 | <!-- 标题 --> | 71 | <!-- 标题 --> |
| 70 | 72 | ||
| 71 | <view class="flex-vertical-between fs28 padding head"> | 73 | <view class="flex-vertical-between fs28 padding head"> |
pages/user/assistance/task_assistance.wxss
| @@ -16,6 +16,7 @@ page { | @@ -16,6 +16,7 @@ page { | ||
| 16 | /* height:65%; */ | 16 | /* height:65%; */ |
| 17 | background-repead: no-repead; | 17 | background-repead: no-repead; |
| 18 | background-size: 100% 100%; | 18 | background-size: 100% 100%; |
| 19 | + padding-bottom: 50rpx; | ||
| 19 | } | 20 | } |
| 20 | 21 | ||
| 21 | .top-frame { | 22 | .top-frame { |
| @@ -236,4 +237,9 @@ line-height: 48rpx; | @@ -236,4 +237,9 @@ line-height: 48rpx; | ||
| 236 | .bottom{ | 237 | .bottom{ |
| 237 | margin-bottom: 50rpx; | 238 | margin-bottom: 50rpx; |
| 238 | margin-top: 20rpx; | 239 | margin-top: 20rpx; |
| 240 | +} | ||
| 241 | + | ||
| 242 | +.rel { | ||
| 243 | + display: flex; | ||
| 244 | + align-items: center; | ||
| 239 | } | 245 | } |
| 240 | \ No newline at end of file | 246 | \ No newline at end of file |