Commit 6991d0e1 by chenwq

视频详情

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