Commit e5978020 by 张立顺

合并代码

2 parents 98f45ea4 dc017aff
...@@ -66,12 +66,12 @@ Page({ ...@@ -66,12 +66,12 @@ Page({
}, },
init() { init() {
wx.nextTick(() => {
const sessionId = getSessionId(), const sessionId = getSessionId(),
{ {
url, url,
targetPath = url ? decodeURIComponent(url) : '' targetPath = url ? decodeURIComponent(url) : ''
} = this.options } = this.options
wx.nextTick(() => {
let path = 'pages.index', let path = 'pages.index',
obj = {} obj = {}
if (targetPath) obj.targetPath = targetPath if (targetPath) obj.targetPath = targetPath
...@@ -84,7 +84,7 @@ Page({ ...@@ -84,7 +84,7 @@ Page({
path = setRouteData(targetPath).url path = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj obj = setRouteData(targetPath).obj
} }
wx.$router.reLaunch(path, obj) wx.$router.redirectTo(path, obj)
} else this.autoLogin(obj) } else this.autoLogin(obj)
}) })
} else this.autoLogin(obj) } else this.autoLogin(obj)
......
...@@ -8,7 +8,10 @@ Component({ ...@@ -8,7 +8,10 @@ Component({
properties: { properties: {
orderObj: { orderObj: {
type: Object, type: Object,
value: () => { } value: () => { },
observer(n) {
this.dealStaffList()
}
}, },
}, },
...@@ -68,12 +71,6 @@ Component({ ...@@ -68,12 +71,6 @@ Component({
}] }]
}, },
lifetimes: {
attached() {
this.dealStaffList()
},
},
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
...@@ -81,8 +78,10 @@ Component({ ...@@ -81,8 +78,10 @@ Component({
dealStaffList() { dealStaffList() {
var list = this.data.orderObj var list = this.data.orderObj
list && list.activityList.forEach(item => { list && list.activityList.forEach(item => {
item.showStaffList = item.staffList.length > 10 ? item.staffList.slice(0, 10) : item.staffList // 0-未开始;1-活动中;2-已结束
item.staffList = item.staffList.length > 10 ? item.staffList.slice(10) : [] let sliceNum = item.actStatus == 2 ? 3 : 10
item.showStaffList = item.staffList.length > sliceNum ? item.staffList.slice(0, sliceNum) : item.staffList
item.staffList = item.staffList.length > sliceNum ? item.staffList.slice(sliceNum) : []
}) })
this.setData({ this.setData({
orderObj: list orderObj: list
......
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
.th, .th,
.td { .td {
width: calc((100% - 116rpx) / 4); width: calc((100% - 116rpx) / 4);
.icon-rank { .icon-rank {
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
...@@ -137,6 +138,13 @@ ...@@ -137,6 +138,13 @@
} }
} }
.tr-no-data {
text-align: center;
height: 32rpx;
line-height: 32rpx;
padding-bottom: 16rpx;
}
.btn-more { .btn-more {
height: 56rpx; height: 56rpx;
line-height: 56rpx; line-height: 56rpx;
......
...@@ -48,9 +48,7 @@ ...@@ -48,9 +48,7 @@
</block> </block>
<view wx:if="{{item.staffList.length}}" class="btn-more" bindtap="handleMore" data-idx="{{index}}">查看更多</view> <view wx:if="{{item.staffList.length}}" class="btn-more" bindtap="handleMore" data-idx="{{index}}">查看更多</view>
</view> </view>
<view class="tr" wx:else> <view class="tr-no-data" wx:else>暂无数据</view>
<view>暂无数据</view>
</view>
</view> </view>
</view> </view>
<!-- 诊断 --> <!-- 诊断 -->
...@@ -65,10 +63,6 @@ ...@@ -65,10 +63,6 @@
<view class="step-label">建议{{idx + 1}}</view> <view class="step-label">建议{{idx + 1}}</view>
<view class="step-txt">{{subItem}}</view> <view class="step-txt">{{subItem}}</view>
</view> </view>
<!-- <view class="suggest-step">
<view class="step-label">建议2</view>
<view class="step-txt">触达车主人数太少,建议与4S店关键人沟通注册员工的转发执行情况。</view>
</view> -->
</view> </view>
</view> </view>
</view> </view>
......
...@@ -228,7 +228,6 @@ Page({ ...@@ -228,7 +228,6 @@ Page({
actList.forEach((item, idx) => { actList.forEach((item, idx) => {
var curItem = res.find(k => k.goodsCategoryCode == item.productCode) var curItem = res.find(k => k.goodsCategoryCode == item.productCode)
if (curItem) { if (curItem) {
console.log(curItem)
curItem.totalNum = curItem.activityList.length curItem.totalNum = curItem.activityList.length
curItem.activityList.forEach(k => { curItem.activityList.forEach(k => {
// 删--- // 删---
...@@ -241,14 +240,14 @@ Page({ ...@@ -241,14 +240,14 @@ Page({
// 0-未开始;1-活动中;2-已结束 // 0-未开始;1-活动中;2-已结束
if (new Date(k.startTime) > new Date()) { if (new Date(k.startTime) > new Date()) {
k.actStatus = 0 k.actStatus = 0
k.interDays = parseInt((new Date().getTime(k.startTime) - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1 k.interDays = parseInt((new Date(k.startTime).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1
} else if (new Date(k.startTime) < new Date() < new Date(k.endTime)) { } else if (new Date(k.startTime) < new Date() < new Date(k.endTime)) {
k.actStatus = 1 k.actStatus = 1
k.interDays = parseInt((new Date().getTime() - new Date(k.startTime).getTime()) / (1000 * 60 * 60 * 24)) + 1 k.interDays = parseInt((new Date().getTime() - new Date(k.startTime).getTime()) / (1000 * 60 * 60 * 24)) + 1
k.toEndDays = parseInt((new Date(k.endTime).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1 k.toEndDays = parseInt((new Date(k.endTime).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1
} else if (new Date(k.endTime) < new Date()) { } else if (new Date(k.endTime) < new Date()) {
k.actStatus = 2 k.actStatus = 2
k.interDays = parseInt((new Date().getTime(k.endTime) - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1 k.interDays = parseInt((new Date(k.endTime).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1
} }
k.suggestTxtList = [] k.suggestTxtList = []
k.suggestList = [] k.suggestList = []
...@@ -299,7 +298,6 @@ Page({ ...@@ -299,7 +298,6 @@ Page({
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1])
wx.$router.getData(obj => { wx.$router.getData(obj => {
console.log(obj)
var scene = {} var scene = {}
Object.keys(this.data.sceneObj).forEach(item => { Object.keys(this.data.sceneObj).forEach(item => {
scene[item] = obj[item] scene[item] = obj[item]
...@@ -311,8 +309,6 @@ Page({ ...@@ -311,8 +309,6 @@ Page({
}) })
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1])
// this.getCustomerDetail()
// this.setCurActivity()
}) })
}, },
...@@ -323,47 +319,5 @@ Page({ ...@@ -323,47 +319,5 @@ Page({
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: this.data.merchantInfo.merchantName, title: this.data.merchantInfo.merchantName,
}) })
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -36,10 +36,12 @@ ...@@ -36,10 +36,12 @@
</view> </view>
</view> </view>
</view> </view>
<view class="isFullSucreen btn" wx:if="{{sceneActive != 1}}"> <view wx:if="{{sceneActive != 1}}">
<view wx:if="{{ activityList[activityActive].productStatus != 2 && !merchantInfo.isSuper}}" class="btn-blue" bindtap="handleJump">点击开通</view> <view class="isFullSucreen btn" wx:if="{{ activityList[activityActive].productStatus != 2 && !merchantInfo.isSuper}}">
<view class="btn-blue" bindtap="handleJump">点击开通</view>
</view> </view>
<view class="isFullSucreen btn" wx:else> </view>
<view class="isFullSucreen btn" wx:if="{{sceneActive == 1}}">
<view class="btn-disabled">点击开通</view> <view class="btn-disabled">点击开通</view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -22,17 +22,18 @@ Page({ ...@@ -22,17 +22,18 @@ Page({
// IMG_URL: `${IMG_URL}index`, // IMG_URL: `${IMG_URL}index`,
btnList: [ btnList: [
{ {
src: `${IMG_URL}index/down.png`,
name: "下载海报",
},
{
src: `${IMG_URL}index/wechat.png`, src: `${IMG_URL}index/wechat.png`,
name: "微信转发", name: "转发给好友",
}, },
// { // {
// src: `${IMG_URL}index/moments.png`, // src: `${IMG_URL}index/moments.png`,
// name: "朋友圈分享", // name: "朋友圈分享",
// }, // },
{
src: `${IMG_URL}index/down.png`,
name: "下载为海报",
},
], ],
// 4种场景下图片所有的高 (单位 rpx) // 4种场景下图片所有的高 (单位 rpx)
imgHeightArr: [ imgHeightArr: [
...@@ -151,7 +152,19 @@ Page({ ...@@ -151,7 +152,19 @@ Page({
// if(actNum&&activeNavIdx)return // if(actNum&&activeNavIdx)return
// 设置标题 // 设置标题
this.shareTitle = `给你分享一个${senceData[actNum]?.productList[activeNavIdx].proName}~`; let userInfoObj = wx.$storage.get('userInfo')
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name
if (userInfoObj.name) {
name = userInfoObj.name
}else if(userInfoObj.merchantName){
name = userInfoObj.merchantName
}else if(userInfoObj.merchantName){
//全称
name = userInfoObj.merchantName
}
this.shareTitle = `${name}给你分享一个活动${senceData[actNum]?.productList[activeNavIdx].proName},戳我参与~`;
this.getImgInfo(actNum) this.getImgInfo(actNum)
this.setData({ this.setData({
...@@ -185,10 +198,10 @@ Page({ ...@@ -185,10 +198,10 @@ Page({
let { index } = e.currentTarget.dataset; let { index } = e.currentTarget.dataset;
switch (index) { switch (index) {
case 0: case 0:
this.wechatFn(); this.download();
break; break;
case 1: case 1:
this.download(); this.wechatFn();
break; break;
} }
}, },
...@@ -204,7 +217,7 @@ Page({ ...@@ -204,7 +217,7 @@ Page({
// let wx_user_info = wx.$storage.get("wx_user_info"); // let wx_user_info = wx.$storage.get("wx_user_info");
// console.log('wx_user_info: ', wx_user_info.appId); // console.log('wx_user_info: ', wx_user_info.appId);
wx.showLoading({ wx.showLoading({
title: "下载中", title: "海报生成中...",
}); });
let params = { let params = {
actNum, actNum,
...@@ -412,6 +425,7 @@ Page({ ...@@ -412,6 +425,7 @@ Page({
this.setData({ this.setData({
hasUserInfo: true, hasUserInfo: true,
}); });
let _this = this;
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 // 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({ wx.getUserProfile({
...@@ -431,10 +445,23 @@ Page({ ...@@ -431,10 +445,23 @@ Page({
}; };
// console.log('obj',obj) // console.log('obj',obj)
wx.$storage.set("wx_user_info", obj); wx.$storage.set("wx_user_info", obj);
// this.onLoad(null);
_this.onLoad(null);
}, },
}); });
}, },
onPageScroll: (function () {
let timer = null;
return function (e) {
// console.log("在滚动");
// 监听页面的滚动开始和结束
clearTimeout(timer);
timer = setTimeout(() => {
// console.log("滚动结束");
wx.$eventbus.emit('evt_page_scroll',{scrollTop:e.scrollTop})
}, 500);
};
})(),
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
......
...@@ -15,14 +15,15 @@ ...@@ -15,14 +15,15 @@
z-index: 2; z-index: 2;
.img-wrap { .img-wrap {
position: absolute; position: absolute;
top: 20%; top: 15%;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
// width: 225px; // width: 225px;
width: 60%; width: 60%;
height: 311px; height: 54%;
// background-color: red; // background-color: red;
overflow: auto; overflow: auto;
border-radius: 16rpx;
.prod-item { .prod-item {
background-color: #f5f7fb; background-color: #f5f7fb;
.prod-item { .prod-item {
...@@ -105,14 +106,17 @@ ...@@ -105,14 +106,17 @@
background-color: #fff; background-color: #fff;
} }
} }
.btns { }
position: absolute; .btns-wrap {
padding-bottom: 84rpx;
position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
height: 154px; height: 120rpx;
background: #ffffff; background: #ffffff;
border-radius: 8px 8px 0 0; z-index: 1;
// border-radius: 8px 8px 0 0;
.top { .top {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
...@@ -125,10 +129,29 @@ ...@@ -125,10 +129,29 @@
width: 40px; width: 40px;
height: 40px; height: 40px;
} }
.name { // .name {
font-size: 12px; // font-size: 12px;
color: #323436; // color: #323436;
// text-align: center;
// }
.name0{
width: 256rpx;
height: 88rpx;
border: 1px solid #EEEEEE;
border-radius: 8rpx;
font-size: 28rpx;
color: #8A8C90;
text-align: center; text-align: center;
line-height:88rpx;
}
.name1{
width: 414rpx;
height: 88rpx;
background: #3666FE;
border-radius: 8rpx;
font-size: 28rpx;
color: #FFFFFF;
line-height:88rpx;
} }
.btn-wechat { .btn-wechat {
width: auto; width: auto;
...@@ -146,7 +169,6 @@ ...@@ -146,7 +169,6 @@
border-radius: 4px; border-radius: 4px;
text-align: center; text-align: center;
} }
}
} }
/* 用户授权 */ /* 用户授权 */
...@@ -156,6 +178,6 @@ ...@@ -156,6 +178,6 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index: 2; z-index: 3;
background-color: transparent; background-color: transparent;
} }
<!--pages/checkProduct/checkProduct.wxml--> <!-- pages/checkProduct/checkProduct.wxml -->
<navigation-bar showBack="{{true}}" bindnavbarReady="navbarReady" navStyle="{{navStyle}}">{{senceData[actNum].productList[activeNavIdx].proName}}</navigation-bar> <navigation-bar showBack="{{true}}" bindnavbarReady="navbarReady" navStyle="{{navStyle}}">
{{senceData[actNum].productList[activeNavIdx].proName}}
</navigation-bar>
<!-- <view style="height:{{headerHeight}}px"> <!-- <view style="height:{{headerHeight}}px">
</view> --> </view> -->
<!-- style="padding-top:{{headerHeight}}px" -->
<product stickyTop="{{headerHeight}}" class="productCon" style="padding-top:{{headerHeight}}px" isAuthphone="{{isAuthphone}}" actNum="{{actNum}}" wrapactiveNavIdx="{{activeNavIdx}}" senceData="{{senceData}}" outshowVideo="{{outshowVideo}}" isShare="{{isShare}}" bindauthorized="authorizedFn" /> <product stickyTop="{{headerHeight}}" class="productCon" isAuthphone="{{isAuthphone}}" actNum="{{actNum}}" wrapactiveNavIdx="{{activeNavIdx}}" senceData="{{senceData}}" outshowVideo="{{outshowVideo}}" isShare="{{isShare}}" bindauthorized="authorizedFn" />
<!-- 分享弹框 --> <!-- 分享弹框 -->
<!-- <shareModel actNum="{{actNum}}" isShow="{{isShow}}" bindmodelclose="modelcloseFn" /> --> <!-- <view class="share-wrap" wx:if="{{isShow}}">
<view class="share-wrap" wx:if="{{isShow}}">
{{IMG_URL}}
<view class="img-wrap"> <view class="img-wrap">
<view class="prod-item"> <view class="prod-item">
<view class="prod-card"> <view class="prod-card">
<view class="card-img"> <view class="card-img">
<!-- <text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png" /> -->
<image src="{{IMG_URL}}index/prod/{{senceData[actNum].productList[activeNavIdx].img}}.png" /> <image src="{{IMG_URL}}index/prod/{{senceData[actNum].productList[activeNavIdx].img}}.png" />
</view> </view>
<view class="prod-info"> <view class="prod-info">
<text class="title">{{senceData[actNum].productList[activeNavIdx].proName}}</text> <text class="title">{{senceData[actNum].productList[activeNavIdx].proName}}</text>
<!-- senceData[actNum]['productList'][activeNavIdx].changeSale || --> <text class="sale" decode="{{true}}">
<text class="sale" decode="{{true}}">{{senceData[actNum]['productList'][activeNavIdx].varType == 1 ? '三年售后存量数':'新车销量'}}&nbsp;<text class="sale-num">{{senceData[actNum]['productList'][activeNavIdx].varType == 1? senceData[actNum]['productList'][activeNavIdx].flow : senceData[actNum]['productList'][activeNavIdx].sale}}</text> {{senceData[actNum]['productList'][activeNavIdx].varType == 1 ? '三年售后存量数':'新车销量'}}&nbsp;
<text class="sale-num">
{{senceData[actNum]['productList'][activeNavIdx].varType == 1? senceData[actNum]['productList'][activeNavIdx].flow : senceData[actNum]['productList'][activeNavIdx].sale}}
</text>
</text>
<text class="earnings" decode="{{true}}">
预估收益&nbsp;
<text class="earnings-num">
{{senceData[actNum]['productList'][activeNavIdx].profit}}
</text> </text>
<text class="earnings" decode="{{true}}">预估收益&nbsp;<text class="earnings-num">{{senceData[actNum]['productList'][activeNavIdx].profit}}</text>
</text> </text>
</view> </view>
<!-- <view class="" bindtap="downVideo" data-src="https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/video/360_AR.mp4?v=" hover-class="none" hover-stop-propagation="false">
视频下载
</view> -->
</view> </view>
</view> </view>
<image class="img" style="height:{{imgHeight}}px" src="{{IMG_URL}}index/longpic{{actNum+1}}.png" bindload="onloadFn" />
<!-- <block wx:for="{{imgList}}" wx:key="*this">
<image mode="widthFix" class="img" src="{{item}}"/>
</block> -->
</view> </view>
<button></button> <button></button>
<view class="btns"> </view> -->
<!-- 用于图片加载事件 -->
<image class="img" src="{{IMG_URL}}index/longpic{{actNum+1}}.png" bindload="onloadFn" />
<view class="btns-wrap" wx:if="{{isShow}}">
<view class="top"> <view class="top">
<view class="btn" wx:for="{{btnList}}" wx:key="name" bindtap="handleClick" data-index="{{index}}"> <view class="btn" wx:for="{{btnList}}" wx:key="name" bindtap="handleClick" data-index="{{index}}">
<block wx:if="{{index == 0}}"> <block wx:if="{{index == 1}}">
<button open-type="share" class="btn-wechat"> <button open-type="share" class="btn-wechat">
<image class="img" src="{{item.src}}" /> <view class="name{{index}}">{{item.name}}</view>
<view class="name">{{item.name}}</view>
</button> </button>
</block> </block>
<block wx:else> <block wx:else>
<image class="img" src="{{item.src}}" /> <view class="name{{index}}">{{item.name}}</view>
<view class="name">{{item.name}}</view>
</block> </block>
</view> </view>
</view> </view>
<view class="btom" bindtap="modelcloseFn">取消</view> <!-- <view class="btom" bindtap="modelcloseFn">取消</view> -->
</view>
</view> </view>
<!-- 授权昵称 --> <!-- 授权昵称 -->
<!-- !hasUserInfo && !isShow --> <!-- !hasUserInfo && !isShow -->
......
...@@ -49,25 +49,64 @@ Component({ ...@@ -49,25 +49,64 @@ Component({
IMGURL: `${IMG_URL}index/`, IMGURL: `${IMG_URL}index/`,
videoBaseUrl, videoBaseUrl,
getMoreBtn:false, getMoreBtn:false,
showVideo:true //显示视频列表 showVideo:true, //显示视频列表
imgTopArr:[]
}, },
lifetimes: { lifetimes: {
ready: function () { ready: function () {
if(!this.data.outshowVideo){ this.init();
this.getImgHeight();
console.log('ready')
//获取当前路径
let currentUrl = this.getCurrentPageUrl()
// console.log('currentUrl: ', currentUrl);
if(currentUrl == '/pages/tab/index/index'){
this.setData({
currentUrl:false
})
}
//监听页面滚动的距离
wx.$eventbus.on('evt_page_scroll',async (e)=>{
console.log(e)
// let heightTop = this.data.stickyTop// 90 场景高度,8 场景margin-bottom
// let prodArr = await this.getHeight('.prod-wrap')
// // console.log('prodArr: ', prodArr);
// heightTop += prodArr[0].height
// let imgArr = await this.getHeight('.img-item')
// // console.log('imgArr: ', imgArr);
// let imgHeightArr = []
// imgArr.reduce((pre,cur,index)=>{
// imgHeightArr.push(pre+cur.height)
// return pre+cur.height
// },heightTop)
let imgTopArr = this.data.imgTopArr
console.log('imgTopArr: ', imgTopArr);
if(imgTopArr.length == 0)return
wx.nextTick(()=>{
let idx = imgTopArr.findIndex(item => item > e.scrollTop)
if(idx>-1){
this.setData({
curTabIdx: idx
})
}
})
})
if(!this.data.outshowVideo){
this.setData({ this.setData({
showVideo:false showVideo:false
}) })
} }
this.init();
this.getImgHeight();
//如果不是分享,初始化的时候调用函数 //如果不是分享,初始化的时候调用函数
if (!this.data.isShare) { if (!this.data.isShare) {
// console.log(131546) // console.log(131546)
this.getMoreFn(); this.getMoreFn();
} }
}, },
}, },
observers: { observers: {
actNum: function (newval, oldval) { actNum: function (newval, oldval) {
...@@ -112,7 +151,7 @@ Component({ ...@@ -112,7 +151,7 @@ Component({
activeNavIdx: 0, activeNavIdx: 0,
}); });
// 每次切换场景,重新获取流程图高度 // 每次切换场景,重新获取流程图高度
this.getImgHeight(); // this.getImgHeight();
this.getMoreFn(); this.getMoreFn();
// this // this
if(this.data.wrapactiveNavIdx){ if(this.data.wrapactiveNavIdx){
...@@ -122,11 +161,16 @@ Component({ ...@@ -122,11 +161,16 @@ Component({
} }
}, },
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
getCurrentPageUrl() {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const url = `/${currentPage.route}`
return url
},
async init() { async init() {
try { try {
const { data, code, message } = await USERAPI.wxCodeLogin(); const { data, code, message } = await USERAPI.wxCodeLogin();
...@@ -175,58 +219,98 @@ Component({ ...@@ -175,58 +219,98 @@ Component({
saleTextChange(e) {}, saleTextChange(e) {},
changeTab(e) { changeTab(e) {
let idx = e.detail; let idx = e.detail;
this.setData({ let {imgTopArr,stickyTop} = this.data
intoViewId: `to-${idx}`, console.log('idx: ', imgTopArr[idx],stickyTop);
}); // this.setData({
// intoViewId: `to-${idx}`,
// });
// wx.$eventbus.emit('evt_page_index',idx)
//判断当前路径
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
// this.setData({
// 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({
activeNavIdx: event.target.dataset.index, activeNavIdx: event.target.dataset.index,
}); });
}, },
scrolltoupper(event) { // scrolltoupper(event) {
console.log(event.detail.scrollHeight,event.detail.scrollTop) // console.log(event.detail.scrollHeight,event.detail.scrollTop)
const idx = this.data.heightArr.findIndex( // const idx = this.data.heightArr.findIndex(
(item) => item > event.detail.scrollHeight // (item) => item > event.detail.scrollHeight
); // );
console.log('idx',idx) // console.log('idx',idx)
this.setData({ // this.setData({
curTabIdx: idx, // curTabIdx: idx,
}); // });
// console.log(this.data.curTabIdx1) // // console.log(this.data.curTabIdx1)
}, // },
getImgHeight() { getImgHeight() {
let query = wx.createSelectorQuery().in(this); let query = wx.createSelectorQuery().in(this);
let heightArr = []; let heightArr = [];
let imgTopArr = []
let s = 0; let s = 0;
let top
let _this = this
query query
.selectAll(".img-item") .selectAll(".img-item")
.boundingClientRect((react) => { .boundingClientRect((react) => {
react.forEach((item) => { react.forEach((item,index) => {
s += item.height; console.log('item: ', item);
heightArr.push(s);
// if(index == 0){
// console.log('item top: ', item);
// top = item.top
// }
// s = s +item.height;
s = item.top
// heightArr.push(s);
imgTopArr.push(s)
}); });
this.data.heightArr = heightArr;
// console.log(heightArr[heightArr.length-1]) // heightArr = heightArr.map((item)=>{
this.data.allHeight = heightArr[heightArr.length - 1]; // item += top
}) // return item
.exec(); // })
// 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; // this.data.heightArr = heightArr;
// // console.log(heightArr[heightArr.length-1]) // // console.log(heightArr[heightArr.length-1])
// this.data.allHeight = heightArr[heightArr.length - 1]; // this.data.allHeight = heightArr[heightArr.length - 1];
// }) // console.log('imgTopArr',imgTopArr)
// .exec(); _this.setData({
imgTopArr
})
})
.exec();
}, },
// 获取用户信息 // 获取用户信息
getUserInfo({ detail }) { getUserInfo({ detail }) {
......
...@@ -395,10 +395,13 @@ ...@@ -395,10 +395,13 @@
.video-list { .video-list {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0 32rpx; padding: 0rpx 32rpx;
font-size: 0; font-size: 0;
} }
.check-prod .video-list{
padding-bottom: 140rpx;
}
.video-item { .video-item {
position: relative; position: relative;
width: calc(50% - 12rpx); width: calc(50% - 12rpx);
......
<!-- pages/tab/discovery/components/product/product.wxml --> <!-- pages/tab/discovery/components/product/product.wxml -->
<view class="prod-wrap"> <view class="prod-wrap" >
<view class="big-title">特色产品</view> <view class="big-title">特色产品</view>
<scroll-view class="nav-wrap" scroll-x="{{true}}" wx:if="{{!isShare && origin =='home'}}"> <scroll-view class="nav-wrap" scroll-x="{{true}}" wx:if="{{!isShare && origin =='home'}}">
<block wx:for="{{navList}}" wx:key="index"> <block wx:for="{{navList}}" wx:key="index">
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="project-wrap"> <view class="project-wrap {{currentUrl == ''? '':'check-prod'}}">
<!-- --> <!-- -->
<view class="stickyTab" style="top:{{isShare ? stickyTop+88 : stickyTop}}rpx"> <view class="stickyTab" style="top:{{isShare ? stickyTop+88 : stickyTop}}rpx">
<tab <tab
...@@ -40,12 +40,11 @@ ...@@ -40,12 +40,11 @@
productHeight productHeight
/> />
</view> </view>
<!-- style="{height:{{allHeight}}px}" -->
<!-- style="{height:{{allHeight}}px}" scroll-y="{{true}}" bindscroll="scrolltoupper"-->
<scroll-view <scroll-view
class="project-img" class="project-img"
scroll-into-view="{{intoViewId}}" scroll-into-view="{{intoViewId}}"
bindscroll="scrolltoupper"
scroll-y="{{true}}"
> >
<block wx:for="{{tab}}" wx:key="index"> <block wx:for="{{tab}}" wx:key="index">
<!-- wx:if="{{showVideo && index==5 && tab.length < 5}}" --> <!-- wx:if="{{showVideo && index==5 && tab.length < 5}}" -->
......
...@@ -247,7 +247,7 @@ var senceData = [ ...@@ -247,7 +247,7 @@ var senceData = [
"sceneCode":"SC001", "sceneCode":"SC001",
productList: [ productList: [
{ {
img: 'product-img1', img: 'product-img9',
proName: '新能源0元换购', proName: '新能源0元换购',
price: '100', price: '100',
// profit: '92.4万', // profit: '92.4万',
......
...@@ -311,17 +311,17 @@ Page({ ...@@ -311,17 +311,17 @@ Page({
visible: false visible: false
}) })
// this.showCase(); // this.showCase();
if (!this.data.isFirst) { // if (!this.data.isFirst) {
wx.showToast({ wx.showToast({
title: '测算结果已在页面内同步展示', title: '测算结果已在页面内同步展示',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
} else { // } else {
this.setData({ // this.setData({
isFirst: false // isFirst: false
}) // })
} // }
}, },
// // 获取场景下的产品类型 // // 获取场景下的产品类型
// getProductType(sceneIndex, tabIndex) { // getProductType(sceneIndex, tabIndex) {
...@@ -635,7 +635,18 @@ Page({ ...@@ -635,7 +635,18 @@ Page({
// console.log('this.data.tabBarStyle',this.data.tabBarStyle,this.data.headerHeight) // console.log('this.data.tabBarStyle',this.data.tabBarStyle,this.data.headerHeight)
// }) // })
}, },
onPageScroll: (function () {
let timer = null;
return function (e) {
// console.log("在滚动");
// 监听页面的滚动开始和结束
clearTimeout(timer);
timer = setTimeout(() => {
// console.log("滚动结束");
wx.$eventbus.emit('evt_page_scroll',{scrollTop:e.scrollTop})
}, 500);
};
})(),
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
......
...@@ -386,18 +386,18 @@ page { ...@@ -386,18 +386,18 @@ page {
position: fixed; position: fixed;
right: -4px; right: -4px;
top: 60%; top: 60%;
width: 60px; width: 64px;
height: 60px; height: 64px;
border-radius: 50%; border-radius: 50%;
z-index: 2; z-index: 2;
} }
.output-value { .output-value {
position: fixed; position: fixed;
right: 5px; right: -2px;
top: 70%; top: 70%;
width: 40px; width: 64px;
height: 50px; height: 64px;
// border-radius: 50%; // border-radius: 50%;
z-index: 1; z-index: 1;
} }
......
...@@ -21,9 +21,25 @@ class NetWork { ...@@ -21,9 +21,25 @@ class NetWork {
}) })
} else { } else {
if (this[ISCOMMECTED]) { if (this[ISCOMMECTED]) {
const thisPage = wx.$router.getPageInstance(),
options = Object.keys(thisPage.options)
this[ISCOMMECTED] = false this[ISCOMMECTED] = false
if (thisPage.noPageAuth) {
wx.showLoading() wx.showLoading()
this.refreshPage() this.refreshPage()
} else {
let url = `/${thisPage.route}`
if (options.length) {
let query = []
options.map(key => {
query.push(`${key}=${thisPage.options[key]}`)
})
url += `?${query.join('&')}`
}
wx.$router.redirectTo('login.loading', {
url
})
}
} }
} }
}) })
......
...@@ -115,7 +115,7 @@ class Share { ...@@ -115,7 +115,7 @@ class Share {
WXUSERINFO, WXUSERINFO,
USERINFO USERINFO
} = this.getCommonData(), } = this.getCommonData(),
thisPage = wx.$router.getPageInstance() thisPage = wx.$router.getPageInstance().options
query = `${query? `?${query}&`:'?'}merchantId=${thisPage.merchantId ||USERINFO.merchantId || ''}&shareOpenId=${thisPage.shareOpenId || WXUSERINFO.openId || ''}&sharePhone=${thisPage.sharePhone || USERINFO.phone || ''}` query = `${query? `?${query}&`:'?'}merchantId=${thisPage.merchantId ||USERINFO.merchantId || ''}&shareOpenId=${thisPage.shareOpenId || WXUSERINFO.openId || ''}&sharePhone=${thisPage.sharePhone || USERINFO.phone || ''}`
return query return query
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!