Commit dc017aff by luyt

feat:滚动添加

1 parent 956b351a
......@@ -5,7 +5,8 @@
<!-- <view style="height:{{headerHeight}}px">
</view> -->
<product stickyTop="{{headerHeight}}" class="productCon" style="padding-top:{{headerHeight}}px" isAuthphone="{{isAuthphone}}" actNum="{{actNum}}" wrapactiveNavIdx="{{activeNavIdx}}" senceData="{{senceData}}" outshowVideo="{{outshowVideo}}" isShare="{{isShare}}" bindauthorized="authorizedFn" />
<!-- style="padding-top:{{headerHeight}}px" -->
<product stickyTop="{{headerHeight}}" class="productCon" isAuthphone="{{isAuthphone}}" actNum="{{actNum}}" wrapactiveNavIdx="{{activeNavIdx}}" senceData="{{senceData}}" outshowVideo="{{outshowVideo}}" isShare="{{isShare}}" bindauthorized="authorizedFn" />
<!-- 分享弹框 -->
<!-- <view class="share-wrap" wx:if="{{isShow}}">
<view class="img-wrap">
......
......@@ -54,10 +54,13 @@ Component({
},
lifetimes: {
ready: function () {
this.init();
this.getImgHeight();
console.log('ready')
//获取当前路径
let currentUrl = this.getCurrentPageUrl()
// console.log('currentUrl: ', currentUrl);
if(currentUrl == '/pages/tab/index/index'){
if(currentUrl == '/pages/tab/index/index'){
this.setData({
currentUrl:false
})
......@@ -77,6 +80,7 @@ Component({
// return pre+cur.height
// },heightTop)
let imgTopArr = this.data.imgTopArr
console.log('imgTopArr: ', imgTopArr);
if(imgTopArr.length == 0)return
wx.nextTick(()=>{
......@@ -96,8 +100,6 @@ Component({
})
}
this.init();
this.getImgHeight();
//如果不是分享,初始化的时候调用函数
if (!this.data.isShare) {
// console.log(131546)
......@@ -149,7 +151,7 @@ Component({
activeNavIdx: 0,
});
// 每次切换场景,重新获取流程图高度
this.getImgHeight();
// this.getImgHeight();
this.getMoreFn();
// this
if(this.data.wrapactiveNavIdx){
......@@ -159,7 +161,6 @@ Component({
}
},
},
/**
* 组件的方法列表
*/
......@@ -219,12 +220,18 @@ Component({
changeTab(e) {
let idx = e.detail;
let {imgTopArr,stickyTop} = this.data
console.log('idx: ', imgTopArr[idx]);
console.log('idx: ', imgTopArr[idx],stickyTop);
// this.setData({
// intoViewId: `to-${idx}`,
// });
// wx.$eventbus.emit('evt_page_index',idx)
wx.pageScrollTo({ scrollTop: imgTopArr[idx]-stickyTop+88+34})
//判断当前路径
let currentUrl = this.getCurrentPageUrl()
if(currentUrl == '/pages/tab/index/index'){
wx.pageScrollTo({ scrollTop: imgTopArr[idx]-stickyTop+88+34})
}else{
wx.pageScrollTo({ scrollTop: (imgTopArr[idx]-stickyTop)})
}
},
// async changeTab(e){
// let idx = e.detail
......@@ -274,10 +281,12 @@ Component({
let imgTopArr = []
let s = 0;
let top
let _this = this
query
.selectAll(".img-item")
.boundingClientRect((react) => {
react.forEach((item,index) => {
console.log('item: ', item);
// if(index == 0){
// console.log('item top: ', item);
......@@ -288,7 +297,6 @@ Component({
// heightArr.push(s);
imgTopArr.push(s)
});
console.log('没有处理过的heightArr',heightArr)
// heightArr = heightArr.map((item)=>{
// item += top
......@@ -297,29 +305,12 @@ Component({
// this.data.heightArr = heightArr;
// // console.log(heightArr[heightArr.length-1])
// this.data.allHeight = heightArr[heightArr.length - 1];
// console.log('imgTopArr',imgTopArr)
_this.setData({
imgTopArr
})
})
.exec();
this.setData({
imgTopArr
// heightArr,
// allHeight:heightArr[heightArr.length - 1]
})
// let query = wx.createSelectorQuery().in(this);
// let heightArr = [];
// let s = 0;
// query
// .selectAll(".img-item")
// .boundingClientRect((react) => {
// react.forEach((item) => {
// // s += item.height;
// heightArr.push(item.top);
// });
// this.data.heightArr = heightArr;
// // console.log(heightArr[heightArr.length-1])
// this.data.allHeight = heightArr[heightArr.length - 1];
// })
// .exec();
},
// 获取用户信息
getUserInfo({ detail }) {
......
<!-- pages/tab/discovery/components/product/product.wxml -->
<view class="prod-wrap" >
<view class="big-title">特色产品 {{origin}}</view>
<view class="big-title">特色产品</view>
<scroll-view class="nav-wrap" scroll-x="{{true}}" wx:if="{{!isShare && origin =='home'}}">
<block wx:for="{{navList}}" wx:key="index">
<text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text>
......@@ -40,12 +40,11 @@
productHeight
/>
</view>
<!-- style="{height:{{allHeight}}px}" -->
<!-- style="{height:{{allHeight}}px}" scroll-y="{{true}}" bindscroll="scrolltoupper"-->
<scroll-view
class="project-img"
scroll-into-view="{{intoViewId}}"
bindscroll="scrolltoupper"
scroll-y="{{true}}"
>
<block wx:for="{{tab}}" wx:key="index">
<!-- wx:if="{{showVideo && index==5 && tab.length < 5}}" -->
......
......@@ -311,17 +311,17 @@ Page({
visible: false
})
// this.showCase();
if (!this.data.isFirst) {
// if (!this.data.isFirst) {
wx.showToast({
title: '测算结果已在页面内同步展示',
icon: 'none',
duration: 2000
})
} else {
this.setData({
isFirst: false
})
}
// } else {
// this.setData({
// isFirst: false
// })
// }
},
// // 获取场景下的产品类型
// getProductType(sceneIndex, tabIndex) {
......
......@@ -386,18 +386,18 @@ page {
position: fixed;
right: -4px;
top: 60%;
width: 60px;
height: 60px;
width: 64px;
height: 64px;
border-radius: 50%;
z-index: 2;
}
.output-value {
position: fixed;
right: 5px;
right: -2px;
top: 70%;
width: 40px;
height: 50px;
width: 64px;
height: 64px;
// border-radius: 50%;
z-index: 1;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!