Commit ca17e1ec by zhangquan

吸顶

1 parent 6dc7edca
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.tab-box { .tab-box {
display: flex; display: flex;
width: 100%; width: 100%;
height: 92rpx; height: 46px;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1rpx solid #EAEBEF; border-bottom: 1rpx solid #EAEBEF;
} }
......
...@@ -130,6 +130,8 @@ Page({ ...@@ -130,6 +130,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
wx.$storage.rm('userInfo')
wx.$storage.rm('sessionId')
let data = JSON.parse(decodeURIComponent(options.data)) let data = JSON.parse(decodeURIComponent(options.data))
console.log(data) console.log(data)
let {staffName, fileUrl, merchantId, type} = data let {staffName, fileUrl, merchantId, type} = data
......
...@@ -48,6 +48,7 @@ Page({ ...@@ -48,6 +48,7 @@ Page({
this.setData({ this.setData({
navStyle: scrollTop == 0 ? navStyle : `background-color:${color};` navStyle: scrollTop == 0 ? navStyle : `background-color:${color};`
}) })
wx.$eventbus.emit('evt_page_scroll',{scrollTop})
}, },
// 分享按钮 // 分享按钮
sharehandle() { sharehandle() {
......
...@@ -27,6 +27,24 @@ Component({ ...@@ -27,6 +27,24 @@ Component({
lifetimes:{ lifetimes:{
ready: function (){ ready: function (){
this.getImgHeight() this.getImgHeight()
wx.$eventbus.on('evt_page_scroll',async (e)=>{
// console.log(e)
let heightTop = this.data.headerHeight// 90 场景高度,8 场景margin-bottom
let prodArr = await this.getHeight('.prod-wrap')
heightTop += prodArr[0].height
let imgArr = await this.getHeight('.img-item')
let imgHeightArr = []
imgArr.reduce((pre,cur,index)=>{
imgHeightArr.push(pre+cur.height)
return pre+cur.height
},heightTop)
let idx = imgHeightArr.findIndex(item => item > e.scrollTop)
if(idx>-1){
this.setData({
curTabIdx: idx
})
}
})
}, },
}, },
...@@ -69,11 +87,31 @@ Component({ ...@@ -69,11 +87,31 @@ Component({
}, },
methods: { methods: {
changeTab(e){ async changeTab(e){
let idx = e.detail let idx = e.detail
this.setData({ this.setData({
intoViewId: `to-${idx}` intoViewId: `to-${idx}`
}) })
let heightTop = this.data.headerHeight + 90 - 16 - 46 // 90 场景高度,16 可能是误差 , 46 tab高度
let prodArr = await this.getHeight('.prod-wrap')
heightTop += prodArr[0].height
let imgArr = await this.getHeight('.img-item')
for(let i=0;i<idx;i++){
heightTop += imgArr[i].height
}
wx.pageScrollTo({
scrollTop: heightTop,
duration: 0
})
},
getHeight(cla){
return new Promise((resolve,reject)=>{
let query = wx.createSelectorQuery().in(this)
query.selectAll(cla).boundingClientRect((rect) => {
resolve(rect)
}).exec()
})
}, },
changeNav(event){ changeNav(event){
this.setData({ this.setData({
...@@ -88,12 +126,10 @@ Component({ ...@@ -88,12 +126,10 @@ Component({
}, },
downVideo(e) { downVideo(e) {
let {url} = e.target.dataset let {url} = e.target.dataset
console.log(url)
wx.$api.showToast('正在下载视频...') wx.$api.showToast('正在下载视频...')
wx.downloadFile({ wx.downloadFile({
url:url, url:url,
success (res) { success (res) {
console.log(res,111)
if (res.statusCode === 200) { if (res.statusCode === 200) {
wx.saveVideoToPhotosAlbum({ wx.saveVideoToPhotosAlbum({
......
...@@ -115,6 +115,7 @@ Page({ ...@@ -115,6 +115,7 @@ Page({
this.setData({ this.setData({
navStyle: scrollTop == 0 ? navStyle : `background-color:${color};` navStyle: scrollTop == 0 ? navStyle : `background-color:${color};`
}) })
wx.$eventbus.emit('evt_page_scroll',{scrollTop})
}, },
changeSwiper(e){ changeSwiper(e){
......
...@@ -4,11 +4,12 @@ page{ ...@@ -4,11 +4,12 @@ page{
} }
.container{ .container{
position: relative; position: relative;
.header{
padding-bottom: 8px;
}
.scene-wrap { .scene-wrap {
white-space: nowrap; white-space: nowrap;
height: 180rpx; height: 90px;
margin-bottom: 16rpx;
.scene-img { .scene-img {
width: 100%; width: 100%;
} }
......
...@@ -66,6 +66,6 @@ ...@@ -66,6 +66,6 @@
</view> </view>
<!-- 在线客服 --> <!-- 在线客服 -->
<image wx:if="{{showPage}}" class="chat" src="{{IMGURL}}customer_service.png" bindtap="goConsult" /> <image mode="aspectFit" wx:if="{{showPage}}" class="chat" src="{{IMGURL}}kefu.png" bindtap="goConsult" />
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!