Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 08e68fc6
authored
Nov 25, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:产品详情
1 parent
3af3dade
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
347 additions
and
108 deletions
pages/tab/index/constant/data.js
pages/viewProd/index.js
pages/viewProd/index.scss
pages/viewProd/index.wxml
pages/tab/index/constant/data.js
View file @
08e68fc
...
...
@@ -11,6 +11,12 @@ var senceData = [
"sceneCode"
:
"SC001"
,
tabname
:
'车损升级'
,
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
:
[
{
img
:
'product-img1'
,
...
...
@@ -67,6 +73,12 @@ var senceData = [
"sceneCode"
:
"SC002"
,
tabname
:
'精品升级'
,
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
:
[
{
img
:
'product-img2'
,
...
...
@@ -104,6 +116,12 @@ var senceData = [
"sceneCode"
:
"SC003"
,
tabname
:
'膨胀金活动'
,
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
:
[
{
img
:
'product-img3'
,
...
...
@@ -148,6 +166,12 @@ var senceData = [
"sceneCode"
:
"SC004"
,
tabname
:
'众筹活动'
,
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
:
[
{
img
:
'product-img5'
,
...
...
pages/viewProd/index.js
View file @
08e68fc
// 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
({
/**
* 页面的初始数据
*/
noPageAuth
:
true
,
behaviors
:
[
computedBehavior
],
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) {
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({
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)
});
},
/**
* 生命周期函数--监听页面显示
*/
...
...
pages/viewProd/index.scss
View file @
08e68fc
...
...
@@ -36,6 +36,10 @@ page {
}
}
.tab-wrap
{
position
:
sticky
;
top
:
0
;
margin-bottom
:
20rpx
;
z-index
:
1
;
.van-tab
{
font-size
:
28rpx
;
color
:
#5a6066
;
...
...
@@ -46,166 +50,136 @@ page {
color
:
#3666fe
;
}
.van-tabs__line
{
height
:
4rpx
;
width
:
112rpx
!
important
;
height
:
4rpx
!
important
;
}
}
.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-item
11
{
.img-item
00
{
width
:
100%
;
height
:
1110rpx
;
}
.img-item
12
{
.img-item
01
{
width
:
100%
;
height
:
1290rpx
;
}
.img-item
13
{
.img-item
02
{
width
:
100%
;
height
:
596rpx
;
}
.img-item
14
{
.img-item
03
{
width
:
100%
;
height
:
744rpx
;
}
.img-item15
{
width
:
100%
;
height
:
490rpx
;
}
.img-item16
{
width
:
100%
;
height
:
1532rpx
;
}
// 流程图二
.img-item
21
{
.img-item
10
{
width
:
100%
;
height
:
2168
rpx
;
height
:
1110
rpx
;
}
.img-item
22
{
.img-item
11
{
width
:
100%
;
height
:
1290rpx
;
}
.img-item
23
{
.img-item
12
{
width
:
100%
;
height
:
596rpx
;
}
.img-item24
{
width
:
100%
;
height
:
830rpx
;
}
.img-item25
{
.img-item13
{
width
:
100%
;
height
:
490rpx
;
}
.img-item26
{
height
:
752rpx
;
.video-item
{
width
:
100%
;
video
{
border-radius
:
16rpx
;
height
:
348rpx
;
}
}
height
:
744rpx
;
}
// 流程图三
.img-item
31
{
.img-item
20
{
width
:
100%
;
height
:
1110rpx
;
}
.img-item
32
{
.img-item
21
{
width
:
100%
;
height
:
1290rpx
;
}
.img-item
33
{
.img-item
22
{
width
:
100%
;
height
:
596rpx
;
}
.img-item34
{
width
:
100%
;
height
:
984rpx
;
}
.img-item35
{
.img-item23
{
width
:
100%
;
height
:
490
rpx
;
height
:
744
rpx
;
}
// .img-item26 {
// width: 100%;
// height: 752rpx;
// }
// 流程图四
.img-item41
{
width
:
100%
;
height
:
678rpx
;
}
.img-item42
{
.img-item30
{
width
:
100%
;
height
:
1266rpx
;
}
.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
;
height
:
1110rpx
;
}
.img-item
52
{
.img-item
31
{
width
:
100%
;
height
:
998
rpx
;
height
:
1290
rpx
;
}
.img-item
53
{
.img-item
32
{
width
:
100%
;
height
:
596rpx
;
}
.img-item54
{
width
:
100%
;
height
:
984rpx
;
}
.img-item55
{
.img-item33
{
width
:
100%
;
height
:
490
rpx
;
height
:
744
rpx
;
}
}
}
pages/viewProd/index.wxml
View file @
08e68fc
...
...
@@ -2,19 +2,50 @@
<video class="frame" src=""></video>
<view class="title-wrap">
<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}}" />
<view class="num">3256</view>
</view>
<view class="tab-wrap">
<van-tabs sticky>
<van-tab title="
标签 1
"></van-tab>
<van-tab title="
标签 2
"></van-tab>
<van-tab title="
标签 3
"></van-tab>
<van-tab title="
标签 4
"></van-tab>
<van-tabs sticky
bind:click="onClickTab" active="{{tabAct}}"
>
<van-tab title="
项目亮点
"></van-tab>
<van-tab title="
合作案例
"></van-tab>
<van-tab title="
合作方式
"></van-tab>
<van-tab title="
适配产品
"></van-tab>
</van-tabs>
</view>
<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>
<!-- 申请按钮 -->
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment