Commit ef09fa2c by 胡悦

提交场景,产品详情、加载中、接口联调

1 parent 1f1dd645
...@@ -32,5 +32,13 @@ module.exports = { ...@@ -32,5 +32,13 @@ module.exports = {
method: `entmicro.api.business.activityRecord.list`, method: `entmicro.api.business.activityRecord.list`,
...data ...data
}, true) }, true)
},
// 根据id查询
getActivityDetail(data) {
return api.post({
method: `entmicro.api.business.activityRecord.detail`,
...data
})
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
"pages/activityApply/activityApply", "pages/activityApply/activityApply",
"pages/applySuccess/applySuccess", "pages/applySuccess/applySuccess",
"pages/videoDetal/videoDetal", "pages/videoDetal/videoDetal",
"pages/productDetail/productDetail" "pages/productDetail/productDetail",
"pages/scenarioDetail/scenarioDetail"
] ]
} }
], ],
......
@import "/style/common.wxss"; @import "/style/common.wxss";
page {
/* vant 样式覆盖 */
--tabs-bottom-bar-color:#5850FF;
--sidebar-selected-border-color:#5850FF;
--tree-select-nav-background-color:#f6f6f6;
}
.box-center{ .box-center{
position: absolute; position: absolute;
top: 50%; top: 50%;
......
...@@ -18,6 +18,10 @@ Component({ ...@@ -18,6 +18,10 @@ Component({
activeNavIdx: { activeNavIdx: {
type: Number, type: Number,
value: 0 value: 0
},
cardInfo: {
type: Object,
value: {}
} }
}, },
...@@ -30,7 +34,8 @@ Component({ ...@@ -30,7 +34,8 @@ Component({
proInfo: {}, proInfo: {},
prodItemVideo: '', //选中的场景下的video的第一个 prodItemVideo: '', //选中的场景下的video的第一个
tabAct: 0, tabAct: 0,
scrollTop: 0 scrollTop: 0,
showCard: false
}, },
/** /**
...@@ -115,5 +120,11 @@ Component({ ...@@ -115,5 +120,11 @@ Component({
}); });
}); });
}, },
selectCard() {
console.log(this.data.showCard)
this.setData({
showCard: !this.data.showCard
})
}
} }
}) })
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-tab": "@vant/weapp/tab/index", "van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index" "van-tabs": "@vant/weapp/tabs/index",
"user-info": "../UserInfo/UserInfo"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,7 @@ page { ...@@ -15,6 +15,7 @@ page {
margin-left: 32rpx; margin-left: 32rpx;
margin-right: 32rpx; margin-right: 32rpx;
display: flex; display: flex;
height: 104rpx;
align-items: center; align-items: center;
.title { .title {
width: 564rpx; width: 564rpx;
...@@ -224,3 +225,30 @@ page { ...@@ -224,3 +225,30 @@ page {
z-index: 3; z-index: 3;
background-color: transparent; background-color: transparent;
} }
.pro-head {
position: relative;
.select-card {
position: absolute;
right: 0;
top: 26rpx;
width: 142rpx;
height: 68rpx;
background: #FFFFFF;
box-shadow: 0 6rpx 16rpx 0 rgba(175,175,219,0.65);
border-radius: 34rpx 0 0 34rpx;
z-index: 2;
display: flex;
align-items: center;
padding: 12rpx;
box-sizing: border-box;
font-weight: 600;
font-size: 26rpx;
color: #57578A;
.icon-card {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
}
}
}
<!--packagesList/pages/productDetail/components/proDetail/proDetail.wxml--> <!--packagesList/pages/productDetail/components/proDetail/proDetail.wxml-->
<view class="view-prod"> <view class="view-prod">
<view class="pro-head">
<view class="select-card" bindtap="selectCard">
<glsx-image custom-class="icon-card" src="home/icon-card.png"></glsx-image>
<view>{{showCard ? '视频' : '名片'}}</view>
</view>
<!-- 有视频 --> <!-- 有视频 -->
<block > <block wx:if="{{!showCard}}">
<video class="frame" wx:if="{{actNum != 2}}" src="{{prodItemVideo.videoUrl}}"></video> <video class="frame" wx:if="{{actNum != 2}}" src="{{prodItemVideo.videoUrl}}"></video>
<image class="no-video" wx:if="{{actNum == 2}}" src="{{prodItemVideo.posterUrl}}?v={{img_version}}" /> <image class="no-video" wx:if="{{actNum == 2}}" src="{{prodItemVideo.posterUrl}}?v={{img_version}}" />
<view class="title-wrap"> <view class="title-wrap">
...@@ -13,6 +18,8 @@ ...@@ -13,6 +18,8 @@
</block> </block>
<!-- 无视频 --> <!-- 无视频 -->
<user-info wx:if="{{showCard}}" class="card-info" cardInfo="{{cardInfo}}"></user-info>
</view>
<!-- <image class="no-video" wx:if="{{actNum == 2}}" src="{{IMG_URL}}index/poster/no-video.png?v={{img_version}}" /> --> <!-- <image class="no-video" wx:if="{{actNum == 2}}" src="{{IMG_URL}}index/poster/no-video.png?v={{img_version}}" /> -->
<view class="tab-wrap"> <view class="tab-wrap">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}"> <van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
"integrity": "sha512-hFJ48SCSvRgcwT/9TcxwNnNnWSpy2BpaBfwQwVdU6uwgFH+2OqGL435VQN7EDpIMH8YjHbiM84hueTyxAzIPqQ==" "integrity": "sha512-hFJ48SCSvRgcwT/9TcxwNnNnWSpy2BpaBfwQwVdU6uwgFH+2OqGL435VQN7EDpIMH8YjHbiM84hueTyxAzIPqQ=="
}, },
"glsx-applet-component": { "glsx-applet-component": {
"version": "1.0.22", "version": "1.0.24",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.0.22.tgz", "resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.0.24.tgz",
"integrity": "sha512-zI2MPI3/xA4OLMA3z0WyILfjXIN2XSs2rtAGN2j1jbLH3tRcE6BL1LqPNv7xc2jFmPBNrrf+kywBBVJhoPOf4Q==" "integrity": "sha512-F0dyfOVMkSrp+EU7xzZRTqTIwz7104VzY3MmjiM6WyhzoIfPc3jwcX25PRYAmqycCGLe+k1Mvkh4pbvX6zza6g=="
} }
} }
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"main": "app.js", "main": "app.js",
"dependencies": { "dependencies": {
"@vant/weapp": "^1.10.9", "@vant/weapp": "^1.10.9",
"glsx-applet-component": "^1.0.22" "glsx-applet-component": "^1.0.24"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
......
// packagesList/pages/activityDetail/activityDetail.js // packagesList/pages/activityDetail/activityDetail.js
import { entmicroApi } from "../../../api/api";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
activityInfo: {}
}, },
toActivity(){ toActivity(){
...@@ -19,12 +21,23 @@ Page({ ...@@ -19,12 +21,23 @@ Page({
console.log(options) console.log(options)
wx.$router.getData(res => { wx.$router.getData(res => {
console.log(res) console.log(res)
this.getActivityDetail(res.id)
this.setData({ this.setData({
hasPhoneNumber: res hasPhoneNumber: res
}) })
}) })
}, },
getActivityDetail(id) {
entmicroApi.getActivityDetail({id}).then(res => {
res.beginTime = new Date(res.beginTime).format('yyyy年MM月dd日')
res.endTime = new Date(res.endTime).format('yyyy年MM月dd日')
this.setData({
activityInfo: res
})
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
......
...@@ -11,22 +11,21 @@ ...@@ -11,22 +11,21 @@
<view class="activity-introduction"> <view class="activity-introduction">
<view class="activity-title">活动介绍</view> <view class="activity-title">活动介绍</view>
<view class="activity-content"> <view class="activity-content">
座椅加热是利用座椅内的电加热丝对座椅内部加热,并通过热传播将能量传递给乘坐者,改善冬天时座椅因长时间停放后座椅过凉造成的乘坐不舒适感。 {{activityInfo.activityEvent}}
目前市面上大部分高档汽车已经配备了座椅加热功能,加热座椅仍然是一种“品位”和“舒适”的标志,受到消费者追捧。
</view> </view>
<view class="activity-title">活动举办方</view> <view class="activity-title">活动举办方</view>
<view class="activity-info"> <view class="activity-info">
<view class="activity-item"> <view class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-company.png"></glsx-image> <glsx-image custom-class="activity-icon" webp src="image/activity/icon-company.png"></glsx-image>
<view class="text">兰州鑫通汽车销售有限公司</view> <view class="text">{{activityInfo.merchantName}}</view>
</view> </view>
<view class="activity-item"> <view class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-company.png"></glsx-image> <glsx-image custom-class="activity-icon" webp src="image/activity/icon-address.png"></glsx-image>
<view class="text">兰州鑫通汽车销售有限公司</view> <view class="text">兰州鑫通汽车销售有限公司</view>
</view> </view>
<view class="activity-item"> <view class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-company.png"></glsx-image> <glsx-image custom-class="activity-icon" webp src="image/activity/icon-time.png"></glsx-image>
<view class="text">兰州鑫通汽车销售有限公司</view> <view class="text">{{activityInfo.beginTime + ' - ' + activityInfo.endTime}}</view>
</view> </view>
</view> </view>
<view class="activity-btn" bindtap="toActivity">查看活动详情页面</view> <view class="activity-btn" bindtap="toActivity">查看活动详情页面</view>
......
...@@ -28,7 +28,8 @@ Page({ ...@@ -28,7 +28,8 @@ Page({
hasUserInfo: false, hasUserInfo: false,
prodItemVideo:'', //选中的场景下的video的第一个 prodItemVideo:'', //选中的场景下的video的第一个
activeUrl:'', // 1.3场景才有的活动配置 activeUrl:'', // 1.3场景才有的活动配置
sharephone:'' //主要微信用户,服务商 sharephone:'', //主要微信用户,服务商
cardInfo: {}
}, },
// 计算属性 // 计算属性
computed: { computed: {
...@@ -54,12 +55,13 @@ Page({ ...@@ -54,12 +55,13 @@ Page({
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0, phone } = options let { actNum = 0, activeNavIdx = 0, phone, cardInfo } = options
console.log(options)
this.setData({ this.setData({
actNum, //选中的场景下标 actNum, //选中的场景下标
activeNavIdx, //选中的产品 activeNavIdx, //选中的产品
sharephone: phone //联系电话 (登陆的用户) sharephone: phone, //联系电话 (登陆的用户)
cardInfo
}) })
// console.log(this.data.senceData, 'senceData-----') // console.log(this.data.senceData, 'senceData-----')
......
{ {
"usingComponents": { "usingComponents": {
"pro-detail": "./components/proDetail/proDetail" "pro-detail": "../../../components/proDetail/proDetail"
} }
} }
\ No newline at end of file \ No newline at end of file
/* packagesList/pages/productDetail/productDetail.wxss */ /* packagesList/pages/productDetail/productDetail.wxss */
.card-info {
position: fixed;
top: 0;
z-index: 0;
width: 100%;
}
\ No newline at end of file \ No newline at end of file
<!--packagesList/pages/productDetail/productDetail.wxml--> <!--packagesList/pages/productDetail/productDetail.wxml-->
<pro-detail id="pro-detail" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}"></pro-detail> <pro-detail id="pro-detail" actNum="{{actNum}}" cardInfo="{{cardInfo}}" activeNavIdx="{{activeNavIdx}}"></pro-detail>
// packagesList/pages/productDetail/productDetail.js
import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed'
import { IMG_URL } from "~/utils/constantData.js";
import { senceData, productData } from "~/pages/tab/index/constant/senceData"
// import USERAPI from '~/api/usersApi/index'
import utils from '~/utils/util'
// import {getActiveApi} from "~/api/viewprod"
Page({
/**
* 页面的初始数据
*/
noPageAuth: true,
behaviors: [computedBehavior],
data: {
IMG_URL,
senceData,
productData,
proInfo: {},
isShare:false, //是否是分享出去的
actNum: 0,
tabAct: 0,
showLeft:false, //更多按钮显示的内容
scrollTop:0,
img_version: '0.1.0',
// 是否授权昵称
hasUserInfo: false,
prodItemVideo:'', //选中的场景下的video的第一个
activeUrl:'', // 1.3场景才有的活动配置
sharephone:'' //主要微信用户,服务商
},
// 计算属性
computed: {
showLeftFlag(data) {
// 1.分享出去
// 2.点击可以改变状态
return data.isShare && !data.showLeft
},
prodItemVideo(data) {
let {senceData, actNum, activeNavIdx} = data
// if(actNum == 2){
// return senceData[actNum]?.noVideoPicture[0]
// }
// return senceData[actNum]?.videoList[activeNavIdx]
},
// 授权昵称弹框显示
authNcknameShow(data){
return data.isShare && !data.hasUserInfo
}
},
//接受跳转的路由参数(小程序页面跳转)
onRoute(options) {
if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0, phone } = options
this.setData({
actNum, //选中的场景下标
activeNavIdx, //选中的产品
sharephone: phone //联系电话 (登陆的用户)
})
// console.log(this.data.senceData, 'senceData-----')
const senceList = productData[this.data.actNum].filter(item => item.name != '全部')
var proInfo = {}
for(let i = 0; i< senceList.length; i++) {
let proIdList = senceList[i]?.productList.map(k => k.id)
if(proIdList.includes(activeNavIdx)) {
proInfo = senceList[i].productList.find(k => k.id == activeNavIdx)
break
}
}
this.setData({
proInfo
})
// console.log(this.data.proInfo, '---------proInfo')
// 设置转发标题
let userInfoObj = wx.$storage.get("userInfo")
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName
this.shareTitle = `${name}给你分享一个活动${proInfo.productName},戳我参与~`
//分享数据
let item = proInfo
// console.log('title2',item.productName)
setTimeout(() => {
utils.setNavigationBarTitle(item.productName)
},100)
//分享人openId
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
this.shareQuery = `sceneCode=${senceData[actNum].sceneCode}&productCode=${item?.productCode}&isShare=${true}&productDesc=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${phone}`
this.shareTrackData = {
sceneCode: senceData[actNum]?.sceneCode,
productCode: item?.productCode,
productName: item?.productName,
category: item?.category,
productDesc: item?.productName,
shareOpenId:shareOpenId
}
},
onPageScroll: (function () {
let timer = null;
return function (e) {
// console.log(e)
// console.log("在滚动");
// 监听页面的滚动开始和结束
clearTimeout(timer);
timer = setTimeout(() => {
let proDetail = this.selectComponent("#pro-detail")
proDetail.pageSroll(e)
}, 100);
};
})(),
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"pro-detail": "../../../components/proDetail/proDetail"
}
}
\ No newline at end of file \ No newline at end of file
/* packagesList/pages/scenarioDetail/scenarioDetail.wxss */
\ No newline at end of file \ No newline at end of file
<!--packagesList/pages/scenarioDetail/scenarioDetail.wxml-->
<pro-detail id="pro-detail" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}"></pro-detail>
...@@ -113,14 +113,12 @@ Page({ ...@@ -113,14 +113,12 @@ Page({
let { detail } = e let { detail } = e
//登录的用户手机号 //登录的用户手机号
// let userInfo = wx.$storage.get("userInfo") // let userInfo = wx.$storage.get("userInfo")
const {cardInfo} = this.data
let obj = { let obj = {
// actNum: tabActive, //选中的场景
// activeNavIdx: 0, //选中的产品
actNum: detail.scenIndex, //选中的场景 actNum: detail.scenIndex, //选中的场景
activeNavIdx: detail.id //选中的产品 activeNavIdx: detail.id, //选中的产品,
// phone: userInfo.phone cardInfo
} }
wx.$router.go("/packagesList/pages/productDetail/productDetail", obj) wx.$router.go("/packagesList/pages/productDetail/productDetail", obj)
}, },
// 跳转视频详情 // 跳转视频详情
...@@ -138,8 +136,16 @@ Page({ ...@@ -138,8 +136,16 @@ Page({
// 跳转活动页 // 跳转活动页
activityClick(e) { activityClick(e) {
const {hasPhoneNumber} = this.data const {hasPhoneNumber} = this.data
const id = e.detail
console.log(e)
wx.$router.go('/packagesList/pages/activityDetail/activityDetail', {hasPhoneNumber, id})
},
// 场景跳转
senceClick(e) {
const {hasPhoneNumber} = this.data
console.log(e) console.log(e)
wx.$router.go('/packagesList/pages/activityDetail/activityDetail', {hasPhoneNumber}) wx.$router.go('/packagesList/pages/scenarioDetail/scenarioDetail', {hasPhoneNumber})
}, },
// 获取全部活动列表 // 获取全部活动列表
......
...@@ -84,3 +84,17 @@ page { ...@@ -84,3 +84,17 @@ page {
height: 128rpx; height: 128rpx;
} }
/** end */ /** end */
.loadding {
height: 100vh;
font-weight: 500;
font-size: 48rpx;
color: #2D2D33;
text-align: center;
margin-top: 340rpx;
&-img {
width: 432rpx;
height: 300rpx;
margin-bottom: 50rpx;
}
}
\ No newline at end of file \ No newline at end of file
<!-- pages/tab/index/index.wxml --> <!-- pages/tab/index/index.wxml -->
<view class="main-box"> <view class="loadding" wx:if="{{!cardInfo}}">
<glsx-image custom-class="loadding-img" src="home/loadding.webp"></glsx-image>
<view>努力加载中</view>
</view>
<block wx:if="{{!!cardInfo}}">
<view class="main-box">
<user-info shareDisabled="{{shareDisabled}}" cardInfo="{{cardInfo}}"></user-info> <user-info shareDisabled="{{shareDisabled}}" cardInfo="{{cardInfo}}"></user-info>
<view class="main-bottom"> <view class="main-bottom">
<!-- tab介绍 --> <!-- tab介绍 -->
...@@ -33,7 +38,8 @@ ...@@ -33,7 +38,8 @@
<image class="floating-icon" bindtap="toBusinessMiniProgram" webp src="{{IMGURL}}home/icon-business.png?v={{img_version}}"></image> <image class="floating-icon" bindtap="toBusinessMiniProgram" webp src="{{IMGURL}}home/icon-business.png?v={{img_version}}"></image>
<image class="floating-icon" bindtap="handleOpen" webp src="{{IMGURL}}home/custom.png?v={{img_version}}"></image> <image class="floating-icon" bindtap="handleOpen" webp src="{{IMGURL}}home/custom.png?v={{img_version}}"></image>
</view> </view>
</view>
<phone-number type="{{'home'}}" bindtoApplication="toApplication" hasPhoneNumber="{{hasPhoneNumber}}"></phone-number>
<!-- 客服咨询 -->
<customer wx:if="{{showCustomer}}" bindcloseQR="closeQR"></customer>
\ No newline at end of file \ No newline at end of file
</view>
<phone-number type="{{'home'}}" bindtoApplication="toApplication" hasPhoneNumber="{{hasPhoneNumber}}"></phone-number>
<!-- 客服咨询 -->
<customer wx:if="{{showCustomer}}" bindcloseQR="closeQR"></customer>
</block>
\ No newline at end of file \ No newline at end of file
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
{ {
"name": "", "name": "",
"pathName": "pages/tab/index/index", "pathName": "pages/tab/index/index",
"query": "scene=sceneId%3D3996", "query": "scene=sceneId%3D857",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
...@@ -53,6 +53,13 @@ ...@@ -53,6 +53,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "packagesList/pages/productDetail/productDetail",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!