Commit 6991d0e1 by chenwq

视频详情

1 parent 7a2f7a16
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"main": "app.js", "main": "app.js",
"dependencies": { "dependencies": {
"@vant/weapp": "^1.10.7", "@vant/weapp": "^1.10.7",
"glsx-applet-component": "^1.0.37" "glsx-applet-component": "^1.0.38"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
......
...@@ -31,17 +31,18 @@ Page({ ...@@ -31,17 +31,18 @@ Page({
}) })
}) })
if (!utils.isEmptyObj(options)) { if (!utils.isEmptyObj(options)) {
let { isShare, videoIndex, tabActive, sceneCode } = options; let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex } = options;
let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode) let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode)
let videoItem = { let videoItem = {
index: videoIndex, index: videoIndex,
videoList: item?.videoList, videoList: item?.videoList,
videoUrl: item?.videoList[videoIndex] videoUrl: item?.videoList[videoIndex]?.videoUrl
} }
this.setData({ this.setData({
videoItem: videoItem, videoItem: videoItem,
isShare: isShare, isShare: isShare,
videoObj: item?.videoList[videoIndex] videoObj: item?.videoList[videoIndex],
leftMenuIndex: leftMenuIndex
}) })
this.setpagesTitle() this.setpagesTitle()
this.shareDataFn(options) this.shareDataFn(options)
...@@ -50,10 +51,12 @@ Page({ ...@@ -50,10 +51,12 @@ Page({
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { videoList, index } = options let { scenIndex, videoList, index, leftMenuIndex } = options
options.videoIndex = index options.videoIndex = index
options.tabActive = scenIndex
this.setData({ this.setData({
videoObj: videoList[index] videoObj: videoList[index],
leftMenuIndex: leftMenuIndex
}) })
this.setpagesTitle() this.setpagesTitle()
this.shareDataFn(options) this.shareDataFn(options)
...@@ -65,23 +68,33 @@ Page({ ...@@ -65,23 +68,33 @@ Page({
tabActive: tabActive, tabActive: tabActive,
videoIndex: videoIndex, videoIndex: videoIndex,
}); });
//
//分享的数据 //分享的数据
this.changeShareData() this.changeShareData()
}, },
changeShareData() { changeShareData() {
let { senceData, tabActive, videoIndex, videoObj } = this.data let { senceData, tabActive, videoIndex, videoObj, leftMenuIndex } = this.data
// // 设置转发标题 // // 设置转发标题
// let userInfoObj = wx.$storage.get("userInfo"); // let userInfoObj = wx.$storage.get("userInfo");
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称 // // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName; // let name = userInfoObj.merchantName;
tabActive = 99
this.shareTitle = `给您分享一个${videoObj.name} 视频`; this.shareTitle = `给您分享一个${videoObj.name} 视频`;
//分享的数据 //分享的数据
let senceItem = productData[tabActive][videoIndex] let senceItem = productData[tabActive][leftMenuIndex]
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&isShare=${true}&tabActive=${tabActive}&videoIndex=${videoIndex}` this.shareQuery = `sceneCode=${senceItem?.sceneCode}&isShare=${true}&tabActive=${tabActive}&videoIndex=${videoIndex}&leftMenuIndex=${leftMenuIndex}`
},
// 切换视频
chooseVideo(e) {
let { detail } = e
this.setData({
videoIndex: detail.index,
['videoItem.index']: detail.index,
['videoItem.videoUrl']: detail?.info?.videoUrl,
videoObj: detail?.info
})
this.setpagesTitle()
this.changeShareData()
}, },
// 下载视频 // 下载视频
downVideo() { downVideo() {
......
<!--packagesList/pages/videoDetal/videoDetal.wxml--> <!--packagesList/pages/videoDetal/videoDetal.wxml-->
<gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}"></gl-video-detail> <gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 --> <!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button> <apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
\ No newline at end of file \ No newline at end of file
...@@ -12,7 +12,7 @@ const IMAGES = Object.freeze({ ...@@ -12,7 +12,7 @@ const IMAGES = Object.freeze({
//本地图片路径 //本地图片路径
let IMG_URLLocal = '../../../images/' let IMG_URLLocal = '../../../images/'
import { productBysceneApi, pageApi, tagApi, battleMessageApi } from '~/api/index.js' import { productBysceneApi, pageApi, tagApi, battleMessageApi } from '~/api/index.js'
let leftMenuIndex = 0
Page({ Page({
// behaviors: [kfMixin], // behaviors: [kfMixin],
/** /**
...@@ -72,26 +72,26 @@ Page({ ...@@ -72,26 +72,26 @@ Page({
}, },
// 跳转视频详情 // 跳转视频详情
videoClick(e) { videoClick(e) {
const { name } = e.target.dataset
const { const {
index, index,
info: { videoUrl }, info: { videoUrl },
scenIndex, scenIndex,
list list
} = e.detail } = e.detail
// if(scenIndex && scenIndex != 0){
// const videoList = productData[0].
// }
// console.log(productData[0])
//const videoList = productData[scenIndex][0].videoList
const videoList = list const videoList = list
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo")
wx.$router.go('/packagesList/pages/videoDetal/videoDetal', { const obj = {
index, index,
videoList, videoList,
scenIndex: scenIndex, scenIndex: isNaN(scenIndex) ? 99 : scenIndex,
videoUrl: videoUrl, videoUrl: videoUrl,
phone: userInfo.phone phone: userInfo.phone
}) }
if (name == '系统订阅') {
obj.leftMenuIndex = leftMenuIndex
}
wx.$router.go('/packagesList/pages/videoDetal/videoDetal', obj)
}, },
// 跳转活动页 // 跳转活动页
...@@ -99,15 +99,18 @@ Page({ ...@@ -99,15 +99,18 @@ Page({
const id = e.detail const id = e.detail
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
wx.$router.go('/packagesList/pages/activityDetail/activityDetail', { wx.$router.go('/packagesList/pages/activityDetail/activityDetail', {
phone: userInfo.phone, id }) phone: userInfo.phone, id
})
}, },
// 场景跳转 // 场景跳转
senceClick(e) { senceClick(e) {
const { scenIndex } = e.detail const { scenIndex } = e.detail
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
wx.$router.go('/packagesList/pages/scenarioDetail/scenarioDetail', { actNum: scenIndex, wx.$router.go('/packagesList/pages/scenarioDetail/scenarioDetail', {
phone: userInfo.phone }) actNum: scenIndex,
phone: userInfo.phone
})
}, },
//引导图 //引导图
guideFn() { guideFn() {
...@@ -191,7 +194,7 @@ Page({ ...@@ -191,7 +194,7 @@ Page({
// }) // })
}, },
clickDialog(e) { clickDialog(e) {
console.log(e.changedTouches[0].clientY) // console.log(e.changedTouches[0].clientY)
if (e.changedTouches[0].clientY < 352) { if (e.changedTouches[0].clientY < 352) {
this.setData({ this.setData({
visible: false, visible: false,
...@@ -202,12 +205,11 @@ Page({ ...@@ -202,12 +205,11 @@ Page({
}, },
// 提交测算 // 提交测算
submit(e) { submit(e) {
console.log(e)
let sales = e ? +e.detail.value.sales : this.data.formData.sales let sales = e ? +e.detail.value.sales : this.data.formData.sales
let flow = e ? +e.detail.value.flow : this.data.formData.flow let flow = e ? +e.detail.value.flow : this.data.formData.flow
console.log('flow', sales, flow) // console.log('flow', sales, flow)
const reg = /^[1-9]\d*$/ const reg = /^[1-9]\d*$/
console.log(reg.test(sales), flow, '---') // console.log(reg.test(sales), flow, '---')
if (!reg.test(sales)) { if (!reg.test(sales)) {
wx.showToast({ wx.showToast({
title: '门店月平均新车销量应为正整数', title: '门店月平均新车销量应为正整数',
...@@ -236,7 +238,7 @@ Page({ ...@@ -236,7 +238,7 @@ Page({
let name = `senceData[${index}].productList[${lastIndex}].profit` let name = `senceData[${index}].productList[${lastIndex}].profit`
let flowKey = `senceData[${index}].productList[${lastIndex}].flow` let flowKey = `senceData[${index}].productList[${lastIndex}].flow`
let profit = _this.formula(i.productType, sales, flow) let profit = _this.formula(i.productType, sales, flow)
console.log(name, profit) // console.log(name, profit)
this.setData({ this.setData({
[name]: profit, [name]: profit,
[sale]: sales, [sale]: sales,
...@@ -320,8 +322,8 @@ Page({ ...@@ -320,8 +322,8 @@ Page({
profit = (flow * 2880 * 0.9 * 0.015).toFixed(0) profit = (flow * 2880 * 0.9 * 0.015).toFixed(0)
break break
} }
console.log(profit.length) // console.log(profit.length)
console.log(productType, sales, flow, profit) // console.log(productType, sales, flow, profit)
if (profit.length > 9) { if (profit.length > 9) {
return (profit / 10000).toFixed(0) + '万' return (profit / 10000).toFixed(0) + '万'
} else { } else {
...@@ -488,7 +490,7 @@ Page({ ...@@ -488,7 +490,7 @@ Page({
// } // }
// debugger // debugger
}) })
.catch(err => {}) .catch(err => { })
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
...@@ -532,24 +534,31 @@ Page({ ...@@ -532,24 +534,31 @@ Page({
gotoApply() { gotoApply() {
wx.$router.go('/packagesList/apply/pages/apply') wx.$router.go('/packagesList/apply/pages/apply')
}, },
/** 系统订阅 */
sysMenuClick(e) {
console.log(e)
const { id } = e.detail
leftMenuIndex = id
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () {}, onHide: function () { },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () {}, onUnload: function () { },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () {}, onPullDownRefresh: function () { },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () {}, onShareAppMessage: function () { },
onShareTimeline: function () {} onShareTimeline: function () { }
}) })
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
bindshowToggleToast="showToggleToast" /> --> bindshowToggleToast="showToggleToast" /> -->
<!-- <view wx:if="{{tabIndx == 1}}">系统订阅</view> --> <!-- <view wx:if="{{tabIndx == 1}}">系统订阅</view> -->
<block wx:if="{{tabIndx == 1}}"> <block wx:if="{{tabIndx == 1}}">
<gl-subscription list="{{subscriptionSystemData}}" menuClick="sysMenuClick" bannerUrl="{{subscriptionBannerUrl}}" bindactivityClick="activityClick" bind:proClick="proClick" bind:videoClick="videoClick" bind:senceClick="senceClick" bindcurrentScen="getCurrentScen" /> <gl-subscription list="{{subscriptionSystemData}}" bindmenuClick="sysMenuClick" bannerUrl="{{subscriptionBannerUrl}}" bindactivityClick="activityClick" bind:proClick="proClick" bind:videoClick="videoClick" bind:senceClick="senceClick" bindcurrentScen="getCurrentScen" data-name="系统订阅"/>
</block> </block>
</view> </view>
<!-- 收藏、取消提示框 --> <!-- 收藏、取消提示框 -->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!