Commit 08e68fc6 by luyt

feat:产品详情

1 parent 3af3dade
...@@ -11,6 +11,12 @@ var senceData = [ ...@@ -11,6 +11,12 @@ var senceData = [
"sceneCode":"SC001", "sceneCode":"SC001",
tabname:'车损升级', tabname:'车损升级',
banner:`${IMG_URL}index/banner/banner0.png`, banner:`${IMG_URL}index/banner/banner0.png`,
sceneImgs:[
`${IMG_URL}index/scene/scene00.png`,
`${IMG_URL}index/scene/scene01.png`,
`${IMG_URL}index/scene/scene02.png`,
`${IMG_URL}index/scene/scene03.png`,
],
productList: [ productList: [
{ {
img: 'product-img1', img: 'product-img1',
...@@ -67,6 +73,12 @@ var senceData = [ ...@@ -67,6 +73,12 @@ var senceData = [
"sceneCode":"SC002", "sceneCode":"SC002",
tabname:'精品升级', tabname:'精品升级',
banner:`${IMG_URL}index/banner/banner1.png`, banner:`${IMG_URL}index/banner/banner1.png`,
sceneImgs:[
`${IMG_URL}index/scene/scene10.png`,
`${IMG_URL}index/scene/scene11.png`,
`${IMG_URL}index/scene/scene12.png`,
`${IMG_URL}index/scene/scene13.png`,
],
productList: [ productList: [
{ {
img: 'product-img2', img: 'product-img2',
...@@ -104,6 +116,12 @@ var senceData = [ ...@@ -104,6 +116,12 @@ var senceData = [
"sceneCode":"SC003", "sceneCode":"SC003",
tabname:'膨胀金活动', tabname:'膨胀金活动',
banner:`${IMG_URL}index/banner/banner2.png`, banner:`${IMG_URL}index/banner/banner2.png`,
sceneImgs:[
`${IMG_URL}index/scene/scene20.png`,
`${IMG_URL}index/scene/scene21.png`,
`${IMG_URL}index/scene/scene22.png`,
`${IMG_URL}index/scene/scene23.png`,
],
productList: [ productList: [
{ {
img: 'product-img3', img: 'product-img3',
...@@ -148,6 +166,12 @@ var senceData = [ ...@@ -148,6 +166,12 @@ var senceData = [
"sceneCode":"SC004", "sceneCode":"SC004",
tabname:'众筹活动', tabname:'众筹活动',
banner:`${IMG_URL}index/banner/banner3.png`, banner:`${IMG_URL}index/banner/banner3.png`,
sceneImgs:[
`${IMG_URL}index/scene/scene30.png`,
`${IMG_URL}index/scene/scene31.png`,
`${IMG_URL}index/scene/scene32.png`,
`${IMG_URL}index/scene/scene33.png`,
],
productList: [ productList: [
{ {
img: 'product-img5', img: 'product-img5',
......
// pages/viewProd/index.js // pages/viewProd/index.js
import { IMG_URL } from '~/utils/constantData.js' import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed'
import { IMG_URL } from "~/utils/constantData.js";
import { senceData } from "~/pages/tab/index/constant/data";
import USERAPI from '~/api/usersApi/index'
import utils from '~/utils/util.js'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
noPageAuth: true,
behaviors: [computedBehavior],
data: { data: {
IMG_URL IMG_URL,
senceData,
actNum: 0,
tabAct: 0,
showLeft:false, //更多按钮显示的内容
scrollTop:0
},
// 计算属性
computed: {
showLeftFlag(data) {
return data.showLeft
}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) {}, onLoad(options) {
if (!options || utils.isEmptyObj(options)) return
let { actNum, activeNavIdx, isShare } = options
this.setData({
actNum,
activeNavIdx,
isShare
});
//分享数据
let senceItem = senceData[actNum]
let item = senceData[actNum]?.productList[activeNavIdx]
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&productCode=${item?.productCode}&isShare=${true}&productDesc=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}`
this.shareTrackData = {
sceneCode: senceItem?.sceneCode,
productCode: item?.productCode,
productName: item?.productName,
category: item?.category,
productDesc: item?.productName
// actNum,
// activeNavIdx,
}
},
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { onRoute(options) {
if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0 } = options;
this.setData({
actNum,
activeNavIdx,
});
// 设置标题
let userInfoObj = wx.$storage.get("userInfo");
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName;
this.shareTitle = `${name}给你分享一个活动${senceData[actNum]?.productList[activeNavIdx].proName},戳我参与~`;
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: "查看产品", title: "查看产品",
}); });
},
//分享数据
let item = senceData[actNum]?.productList[activeNavIdx]
this.shareQuery = `sceneCode=${senceData[actNum].sceneCode}&productCode=${item?.productCode}&isShare=${true}&productDesc=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}`
this.shareTrackData = {
sceneCode: senceData[actNum]?.sceneCode,
productCode: item?.productCode,
productName: item?.productName,
category: item?.category,
productDesc: item?.productName
// actNum,
// activeNavIdx,
// apiData,
}
},
onClickTab(event) {
// console.log('event: ', event);s
let { index } = event.detail;
// console.log('index: ', index);
this.setData({
tabAct: index,
});
let { imgTopArr } = this.data;
wx.pageScrollTo({
scrollTop: imgTopArr[index],
});
},
onPageScroll: (function () {
let timer = null;
return function (e) {
// console.log("在滚动");
// 监听页面的滚动开始和结束
clearTimeout(timer);
timer = setTimeout(() => {
let { imgTopArr } = this.data;
// console.log("滚动结束",imgTopArr,e.scrollTop);
// wx.$eventbus.emit('evt_page_scroll', { scrollTop: e.scrollTop })
wx.nextTick(() => {
let idx = imgTopArr.findIndex((item) => item >e.scrollTop) - 1;
// console.log('idx: ', idx);
if (idx > -1) {
this.setData({
tabAct: idx,
scrollTop:e.scrollTop
});
} else {
this.setData({
tabAct: 0,
scrollTop:e.scrollTop
});
}
});
}, 100);
};
})(),
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() {}, onReady() {
this.init()
this.getImgHeight();
},
getImgHeight() {
let query = wx.createSelectorQuery().in(this);
let heightArr = [];
let imgTopArr = [];
let s = 0;
let top;
let {scrollTop} = this.data
let _this = this;
query
.selectAll(".img-item")
.boundingClientRect((react) => {
react.forEach((item, index) => {
//44 tab的高度
// console.log('item',item)
s = item.top - 44 + scrollTop;
imgTopArr.push(s);
});
_this.setData({
imgTopArr,
});
})
.exec();
// setTimeout(() => {
// console.log('imgTopArr',this.data.imgTopArr)
// },500)
},
phoneCall(e) {
let { phone } = e.currentTarget.dataset;
wx.$api.phoneCall(phone);
},
async init() {
try {
const { data, code, message } = await USERAPI.wxCodeLogin()
if (code == '0') {
this.loginToken = data
} else this.reLogin(message)
wx.hideLoading()
} catch ({ errMsg }) {
console.error(errMsg)
this.reLogin()
}
},
/**获取loginToken */
reLogin(message) {
wx.showModal({
content: message || '获取loginToken失败',
confirmText: '重试',
confirmColor: '#3666FE'
}).then(({ confirm }) => {
if (confirm) this.init()
})
},
// 获取用户信息
getUserInfo({ detail }) {
// console.log(detail);
if (!detail.code) return;
// this.setBtnLoading()
USERAPI.getUserProfile(this.loginToken, detail)
.then((result) => {
// console.log(result)
let userInfo = wx.$storage.get("wx_user_info");
// console.log('userInfo: ', userInfo);
let { phone } = result;
// console.log('phone: ', phone);
wx.$storage.set("wx_user_info", {
...userInfo,
phone,
});
// }
// setTimeout(() => {
// this.triggerEvent("authorized", {
// phone,
// // isShare: false,
// });
// }, 1e3);
//隐藏更多按钮,显示视频列表
// this.setData({
// getMoreBtn: true,
// isShare: false,
// outshowVideo: true,
// });
// this.getMoreFn();
// 显示后面的内容
setTimeout(() => {
this.getImgHeight()
},300)
this.setData({
showLeft: true
})
})
.catch(({ errMsg }) => {
wx.$api.showToast(errMsg || "系统异常");
// this.setBtnLoading(false)
});
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
......
...@@ -36,6 +36,10 @@ page { ...@@ -36,6 +36,10 @@ page {
} }
} }
.tab-wrap { .tab-wrap {
position: sticky;
top: 0;
margin-bottom: 20rpx;
z-index: 1;
.van-tab { .van-tab {
font-size: 28rpx; font-size: 28rpx;
color: #5a6066; color: #5a6066;
...@@ -46,166 +50,136 @@ page { ...@@ -46,166 +50,136 @@ page {
color: #3666fe; color: #3666fe;
} }
.van-tabs__line { .van-tabs__line {
height: 4rpx; width: 112rpx !important;
height: 4rpx !important;
} }
} }
.prod-detail { .prod-detail {
.occupancy{
height: 120rpx;
}
.img-item{
position: relative;
}
.phone {
position: absolute;
top: 60rpx;
right: 32rpx;
font-weight: 400;
font-size: 24rpx;
color: #6C6C6C;
display: flex;
align-items: center;
.icon {
width: 40rpx;
height: 40rpx;
margin-right: 6rpx;
}
}
.check-act{
position: absolute;
top: 20px;
right: 60rpx;
}
.more-btn {
position: absolute;
left: 50%;
bottom: 50px;
transform: translateX(-50%);
width: 622rpx;
height: 96rpx;
background-image: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/btn.png");
background-size: 100% 100%;
font-weight: 500;
font-size: 16px;
color: #ffffff;
text-align: center;
line-height: 96rpx;
}
// 流程图一 // 流程图一
.img-item11 { .img-item00 {
width: 100%; width: 100%;
height: 1110rpx; height: 1110rpx;
} }
.img-item12 { .img-item01 {
width: 100%; width: 100%;
height: 1290rpx; height: 1290rpx;
} }
.img-item13 { .img-item02 {
width: 100%; width: 100%;
height: 596rpx; height: 596rpx;
} }
.img-item14 { .img-item03 {
width: 100%; width: 100%;
height: 744rpx; height: 744rpx;
} }
.img-item15 {
width: 100%;
height: 490rpx;
}
.img-item16 {
width: 100%;
height: 1532rpx;
}
// 流程图二 // 流程图二
.img-item21 { .img-item10 {
width: 100%; width: 100%;
height: 2168rpx; height: 1110rpx;
} }
.img-item22 { .img-item11 {
width: 100%; width: 100%;
height: 1290rpx; height: 1290rpx;
} }
.img-item23 { .img-item12 {
width: 100%; width: 100%;
height: 596rpx; height: 596rpx;
} }
.img-item24 { .img-item13 {
width: 100%;
height: 830rpx;
}
.img-item25 {
width: 100%; width: 100%;
height: 490rpx; height: 744rpx;
}
.img-item26 {
height: 752rpx;
.video-item {
width: 100%;
video {
border-radius: 16rpx;
height: 348rpx;
}
}
} }
// 流程图三 // 流程图三
.img-item31 { .img-item20 {
width: 100%; width: 100%;
height: 1110rpx; height: 1110rpx;
} }
.img-item32 { .img-item21 {
width: 100%; width: 100%;
height: 1290rpx; height: 1290rpx;
} }
.img-item33 { .img-item22 {
width: 100%; width: 100%;
height: 596rpx; height: 596rpx;
} }
.img-item34 { .img-item23 {
width: 100%;
height: 984rpx;
}
.img-item35 {
width: 100%; width: 100%;
height: 490rpx; height: 744rpx;
} }
// .img-item26 {
// width: 100%;
// height: 752rpx;
// }
// 流程图四 // 流程图四
.img-item41 { .img-item30 {
width: 100%;
height: 678rpx;
}
.img-item42 {
width: 100%; width: 100%;
height: 1266rpx; height: 1110rpx;
}
.img-item43 {
width: 100%;
height: 1398rpx;
}
.img-item44 {
width: 100%;
height: 830rpx;
}
.img-item45 {
width: 100%;
height: 490rpx;
}
.img-item46 {
width: 100%;
height: 1666rpx;
}
// 流程图5
.img-item51 {
width: 100%;
height: 814rpx;
} }
.img-item52 { .img-item31 {
width: 100%; width: 100%;
height: 998rpx; height: 1290rpx;
} }
.img-item53 { .img-item32 {
width: 100%; width: 100%;
height: 596rpx; height: 596rpx;
} }
.img-item54 { .img-item33 {
width: 100%;
height: 984rpx;
}
.img-item55 {
width: 100%; width: 100%;
height: 490rpx; height: 744rpx;
} }
} }
} }
...@@ -2,19 +2,50 @@ ...@@ -2,19 +2,50 @@
<video class="frame" src=""></video> <video class="frame" src=""></video>
<view class="title-wrap"> <view class="title-wrap">
<view class="title">单品AR导航-新增产值20w+</view> <view class="title">单品AR导航-新增产值20w+</view>
<!-- <glsx-image class="check" src="index/poster/check.png" /> -->
<image class="check" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" /> <image class="check" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num">3256</view> <view class="num">3256</view>
</view> </view>
<view class="tab-wrap"> <view class="tab-wrap">
<van-tabs sticky> <van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
<van-tab title="标签 1"></van-tab> <van-tab title="项目亮点"></van-tab>
<van-tab title="标签 2"></van-tab> <van-tab title="合作案例"></van-tab>
<van-tab title="标签 3"></van-tab> <van-tab title="合作方式"></van-tab>
<van-tab title="标签 4"></van-tab> <van-tab title="适配产品"></van-tab>
</van-tabs> </van-tabs>
</view> </view>
<view class="prod-detail"> <view class="prod-detail">
<block wx:for="{{senceData[actNum].sceneImgs}}" wx:key="index">
<image wx:if="{{ index < 3}}" webp class="img-item img-item{{actNum}}{{index}}" src="{{item}}?v={{img_version}}">
<block wx:if="{{ index == 0}}">
<!-- && phone -->
<view class="phone" bindtap="phoneCall" data-phone="{{phone}}">
<!-- <image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image> -->
<glsx-image webp src="index/phone.png" class="icon"></glsx-image>
请联系我
<view style="color:#3666fe">
<!-- {{phone}} -->
132456413
</view>
</view>
</block>
<!-- 查看活动那个详情 1.3才有 -->
<block wx:if="{{ index == 1 && actNum == 3}}">
<button class="check-act" type="default" plain="true">查看活动详情</button>
</block>
<!-- 获取更多详情 -->
<block wx:if="{{ index == 2 && !showLeftFlag}}">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
点击查看更多详情
</button>
</block>
</image>
<image wx:if="{{ index >= 3 && showLeftFlag}}" webp class="img-item img-item{{actNum}}{{index}}" src="{{item}}?v={{img_version}}">
</image>
</block>
<view class="occupancy">
<!-- padding底部 占位元素 -->
</view>
</view> </view>
</view> </view>
<!-- 申请按钮 --> <!-- 申请按钮 -->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!