Commit 8482e202 by jscat

nyx weapp: bug fix

1. 分享按钮里, note_image字段写错
2. 调整scroll-view的格式
parent 00c8e83c
// pages/activity/activity-info/activity-info.js
// pages/activity/activity-info/activity-info.js
......@@ -34,6 +34,9 @@ Page({
likeStatus: 0, // 判断like图标的状态
likeUrl: "../../../icon/activity/like.png", // like图标的url
//swiper的高度
swiperViewHeight: 0
},
/**
......@@ -217,7 +220,7 @@ Page({
var _this = this;
var url_activity = "/pages/activity/activity-info/activity-info?"
+"activity_id="+_this.data.activityInfo["activity_id"]
+"&note_image="+_this.data.activityInfo['noteImage'].join("::")
+"&note_image="+_this.data.activityInfo['note_image'].join("::")
+"&title="+_this.data.activityInfo["title"]
+"&content="+_this.data.activityInfo["content"]
+"&num_like="+_this.data.activityInfo['num_like']
......@@ -294,12 +297,17 @@ Page({
},
//滑动获取选中商品
//滑动获取选中商品 jscat 20201012, obsolete; 不在需要去选中商品
getSelectItem: function (e) {
var that = this;
var preCurImage = that.data.curImage;
var itemWidth = e.detail.scrollWidth / that.data.activityInfo.note_image.length;//每个商品的宽度
var scrollLeft = e.detail.scrollLeft;//滚动宽度
if(scrollLeft <= 0 )
{
scrollLeft = 0;
}
console.log("===scrollLeft_", scrollLeft)
var curImage = Math.round(scrollLeft / itemWidth);//通过Math.round方法对滚动大于一半的位置进行进位
var newScrollLeft = 0
// 目标: 始终让图片居中显示
......@@ -308,11 +316,12 @@ Page({
)
{
newScrollLeft = that.data.windowWidth * curImage
scrollLeft = newScrollLeft
}
that.setData({
scrollLeft : newScrollLeft,
scrollLeft : scrollLeft,
curImage : curImage, //图片轮循的时候, 不同步更新价格 jscat 20200921
});
}
},
//跳转到结算页 order.wxml
......@@ -440,5 +449,35 @@ Page({
},
//动态设置swiper的高度; jscat 20201012, obsolete
setSwiperHeight: function () {
let that = this
wx.getSystemInfo({
success: function(res) {
that.setData({
windowHeight: res.windowHeight,
});
}
});
// 根据文档中的介绍,先创建一个SelectorQuery对象实例
let query = wx.createSelectorQuery().in(this);
query.select('.image_view').boundingClientRect();
// 执行上面所指定的请求,结果会按照顺序存放于一个数组中,在callback的第一个参数中返回
query.exec((res) => {
//取出表头高度
let headerHeight = res[0].height;
// 计算出去除表头剩余的高度
let swiperViewHeight = headerHeight;
this.setData({
swiperViewHeight: swiperViewHeight
});
});
},
})
\ No newline at end of file
<wxs module="tutil" src="./../../../utils/date.wxs"></wxs>
<wxs module="tutil" src="./../../../utils/date.wxs"></wxs>
......@@ -3,9 +3,9 @@
<view class="page">
<!-- 图片 -->
<scroll-view class="scroll-view_H" scroll-x scroll-with-animation style="width: 100%;height: 90%;" bindscroll="getSelectItem" scroll-left="{{scrollLeft}}">
<scroll-view class="scroll-view_H" scroll-x scroll-with-animation style="width: 100%;height: 100%;">
<block wx:for="{{activityInfo.note_image}}" wx:key="unique" wx:for-index="id" wx:for-item="item">
<view class="scroll_item {{item.selected ? 'selected' : ''}}" data-index='{{item.index}}' bindtap='selectProItem'>
<view class="scroll_item">
<image src="{{item}}" mode="widthFix"/>
</view>
</block>
......
.scroll-view_H{
.scroll-view_H{
......@@ -2,13 +2,13 @@
position: relative;
width: 100%;
text-align: center;
transform: scale(0.9);
transform: scale(1);
white-space: nowrap;
}
.scroll_item {
position: relative;
width: 100%;
height: 90%;
height: 100%;
margin: 0;
transform-origin: 50% 0;
left: 0%;
......@@ -22,23 +22,21 @@
background-color: #fff;
}
.scroll_item:first-child{
margin-left: 0%;
margin: 0%;
left: 0;
}
.scroll_item:last-child{
margin-right: 10%;
margin: 0;
left: 0;
}
.scroll_item.selected{
/* transform: scale(0.9); */
border: solid 1px #ffcd54;
border: solid 0px #ffcd54;
}
.scroll_item image {
width: 100%;
float: left;
margin-top: 0;
/* border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx; */
}
.note{
width: 100%;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论