Commit ccd38c76 by 匡雅琴

看产值组件修改

1 parent 81b93dcc
...@@ -88,6 +88,36 @@ const getActivityDetailApi = data => { ...@@ -88,6 +88,36 @@ const getActivityDetailApi = data => {
}) })
} }
// 获取小程序首页数据列表
const getDiscoverList = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.weapp.list',
...data
},
true
)
}
// 获取特色产品内容详情
const getDiscoverDetail = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.content.detail',
...data
},
true
)
}
// 获取案例视频、操作指引详情
const getDetailWithLike = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.content.detailWithLike',
...data
},
true
)
}
module.exports = { module.exports = {
/** 线索埋点数据上报 /** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动) * operationType 操作类型(0:分享 1:浏览 2:申请活动)
...@@ -107,5 +137,8 @@ module.exports = { ...@@ -107,5 +137,8 @@ module.exports = {
tagApi, tagApi,
battleMessageApi, battleMessageApi,
getActivityRecordApi, getActivityRecordApi,
getActivityDetailApi getActivityDetailApi,
getDiscoverList,
getDiscoverDetail,
getDetailWithLike
} }
...@@ -37,6 +37,8 @@ import './utils/share' ...@@ -37,6 +37,8 @@ import './utils/share'
//监听网络状态 //监听网络状态
import './utils/network' import './utils/network'
import { getDiscoverList } from '~/api/index.js'
App({ App({
onLaunch(options) { onLaunch(options) {
/**挂载到wx对象 */ /**挂载到wx对象 */
...@@ -53,6 +55,17 @@ App({ ...@@ -53,6 +55,17 @@ App({
// console.log('test') // console.log('test')
}, },
// 获取公共数据
getBaseData() {
console.log("method")
return new Promise((resolve, reject) => {
getDiscoverList().then(res => {
console.log(res, '555');
resolve(res.data)
})
})
},
onShow(options) { onShow(options) {
getUpdateManager() getUpdateManager()
}, },
......
...@@ -122,7 +122,8 @@ ...@@ -122,7 +122,8 @@
"popup": "/components/Popup/Popup", "popup": "/components/Popup/Popup",
"nothing-tips": "/components/Nothing-tips/nothingTips", "nothing-tips": "/components/Nothing-tips/nothingTips",
"crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster", "crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster",
"glsx-image": "/components/image/index" "glsx-image": "/components/image/index",
"no-product": "/components/NoProduct/index"
}, },
"resolveAlias": { "resolveAlias": {
"~/*": "/*" "~/*": "/*"
......
// components/NoProduct/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/NoProduct/index.wxss */
.no-product {
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
<!--components/NoProduct/index.wxml-->
<view class="no-product">
<glsx-image custom-class="no-product-img" src="index/productImgs/no-product.png" />
<view>产品已下架</view>
</view>
...@@ -8,30 +8,30 @@ Component({ ...@@ -8,30 +8,30 @@ Component({
*/ */
properties: { properties: {
// 场景值下标 // 场景值下标
actNum: { // actNum: {
type: Number, // type: Number,
value: -1, // value: -1,
observer(n) { // observer(n) {
this.getInfo() // this.getInfo()
if (n == 3) { // if (n == 3) {
this.setVideoCtx() // this.setVideoCtx()
} // }
} // }
}, // },
// 选中的产品 // // 选中的产品
activeNavIdx: { // activeNavIdx: {
type: Number, // type: Number,
value: 0 // value: 0
}, // },
cardInfo: { // cardInfo: {
type: Object, // type: Object,
value: {} // value: {}
}, // },
// 配置url // // 配置url
activeUrl: { // activeUrl: {
type: String, // type: String,
value: '' // value: ''
}, // },
sharephone: { sharephone: {
type: String, type: String,
value: '' value: ''
...@@ -39,6 +39,14 @@ Component({ ...@@ -39,6 +39,14 @@ Component({
showLeftFlag: { showLeftFlag: {
type: Boolean, type: Boolean,
value: false value: false
},
detailType: {
type: String,
value: 'pro'
},
proDetail: {
type: Object,
value: {}
} }
}, },
...@@ -128,10 +136,12 @@ Component({ ...@@ -128,10 +136,12 @@ Component({
// },500) // },500)
}, },
// 1.3查看活动详情按钮 // 1.3查看活动详情按钮
checkActive() { checkActive(e) {
let { activeUrl } = this.data // let { activeUrl } = this.data
wx.$router.jumpH5(activeUrl); // wx.$router.jumpH5(activeUrl);
console.log(e);
let { url } = e.currentTarget.dataset
wx.$router.jumpH5(url);
}, },
onClickTab(event) { onClickTab(event) {
// console.log('event: ', event); // console.log('event: ', event);
...@@ -177,25 +187,20 @@ Component({ ...@@ -177,25 +187,20 @@ Component({
}, },
// 膨胀金-二维码-长按图片 // 膨胀金-二维码-长按图片
handleLongPress(e) { handleLongPress(e) {
let { index } = e.target.dataset let {item} = e.currentTarget.dataset
let { activeNavIdx, actNum } = this.data // 如果图片有长按事件 posterEventType: 1-无 2-有
// 膨胀金活动,合作方式 if (item.posterEventType == 1) return
if (actNum == 99 && activeNavIdx == 3 && index == 4) { wx.downloadFile({
wx.downloadFile({ url: item.posterEventUrl,
// 示例 url,并非真实存在 success: function (res) {
url: 'https://scrm.glsx.com.cn/frontpdf/expand_agreement.pdf', const filePath = res.tempFilePath
success: function (res) { wx.openDocument({
console.log(res) filePath: filePath,
const filePath = res.tempFilePath success: function (res) {
wx.openDocument({ }
filePath: filePath, })
success: function (res) { }
console.log('打开文档成功') })
}
})
}
})
}
}, },
} }
}) })
...@@ -78,6 +78,9 @@ page { ...@@ -78,6 +78,9 @@ page {
} }
.prod-detail { .prod-detail {
.img-items {
position: relative;
}
.occupancy { .occupancy {
height: 120rpx; height: 120rpx;
......
<!-- packagesList/pages/productDetail/components/proDetail/proDetail.wxml --> <!-- packagesList/pages/productDetail/components/proDetail/proDetail.wxml -->
<view class="view-prod custom-class"> <view class="view-prod custom-class">
<view class="pro-head"> <view class="pro-head">
<!-- 有视频 --> <!-- 产品详情是视频 -->
<video class="frame" id="video" wx:if="{{actNum != 2}}" src="{{prodItemVideo.videoUrl}}" bindplay="handleVideoPlay" data-attr="crowdVideoCtx" /> <!-- mediaType: 1-图片,2-视频 -->
<image class="no-video" wx:if="{{actNum == 2}}" src="{{prodItemVideo.posterUrl}}?v={{img_version}}" /> <video class="frame" id="video" wx:if="{{proDetail.mediaType == '2'}}" src="{{proDetail.vedioUrl}}" bindplay="handleVideoPlay" data-attr="crowdVideoCtx" />
<!-- 产品详情是图片 -->
<image class="no-video" wx:if="{{proDetail.mediaType == '1'}}" src="{{proDetail.imageUrl}}?v={{img_version}}" />
<!-- 标题+视频时展示观看人数 -->
<view class="title-wrap"> <view class="title-wrap">
<view class="title">{{prodItemVideo.name}}</view> <view class="title">{{proDetail.title}}</view>
<image class="check" wx:if="{{actNum != 2}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" /> <image class="check" wx:if="{{proDetail.mediaType != '1'}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num" wx:if="{{actNum != 2}}">{{prodItemVideo.view}}</view> <view class="num" wx:if="{{proDetail.mediaType != '1'}}">{{proDetail.view}}</view>
</view> </view>
</view> </view>
<view class="tab-wrap"> <view class="tab-wrap">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}"> <van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
<van-tab wx:for="{{tabList}}" title="{{item}}" wx:key="idnex" /> <van-tab wx:for="{{proDetail.detailList}}" title="{{item.name}}" wx:key="idnex" />
<!-- <van-tab title="合作案例" /> <!-- <van-tab title="合作案例" />
<van-tab title="合作方式" /> <van-tab title="合作方式" />
<van-tab title="适配产品" /> --> <van-tab title="适配产品" /> -->
</van-tabs> </van-tabs>
</view> </view>
<view class="prod-detail"> <view class="prod-detail">
<block wx:for="{{productImgs}}" wx:key="index"> <block wx:for="{{proDetail.detailList}}" wx:key="index">
<image webp wx:if="{{ index < 3}}" webp mode="widthFix" class="img-item {{item.className?item.className:''}}" src="{{item.url?item.url:item}}?v={{img_version}}"> <image webp mode="widthFix" class="img-items" src="{{item.posterUrl}}?v={{img_version}}" bindlongpress="handleLongPress" data-item="{{item}}">
<!-- 第一张图的点击拨打电话事件 -->
<block wx:if="{{ index == 0}}"> <block wx:if="{{ index == 0}}">
<!-- && phone --> <view class="phone" bindtap="phoneCall" data-phone="{{proDetail.phone}}">
<view class="phone" bindtap="phoneCall" data-phone="{{sharephone}}"> <image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image>
<!-- <image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image> -->
<glsx-image webp src="index/phone.png" class="icon" /> <glsx-image webp src="index/phone.png" class="icon" />
请联系我 请联系我
<view style="color:#3666fe">{{sharephone}}</view> <view style="color:#3666fe">{{proDetail.phone}}</view>
</view> </view>
</block> </block>
<!-- 查看活动那个详情 1.3才有 -->
<block wx:if="{{ index == 0 && actNum == 3 && activeUrl}}"> <!-- 如果有活动跳转 -->
<view class="check-act" bindtap="checkActive">点击查看活动页面</view> <!-- 按钮点击事件 buttonClickEvent:1-无 2-有 -->
<block wx:if="{{ item.buttonEventType == 2 }}">
<view class="check-act" bindtap="checkActive" data-url="{{item.buttonEventUrl}}">{{item.buttonEventName}}</view>
</block> </block>
<!-- 获取更多详情 --> <!-- 获取更多详情 -->
<block wx:if="{{ index == 2 && showLeftFlag}}"> <!-- <block wx:if="{{ index == 2 && showLeftFlag}}">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber"> <button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
点击查看更多详情 点击查看更多详情
</button> </button>
</block> -->
<!-- 如果有视频 -->
<block wx:if="{{ item.videoUrl }}">
<video class="crowd-video" id="crowd-video" bindplay="handleVideoPlay" data-attr="videoCtx" src="{{item.videoUrl}}" />
</block> </block>
</image> </image>
<image webp wx:if="{{ index >= 3 && !showLeftFlag}}" mode="widthFix" webp class="img-item {{item.className?item.className:''}}" src="{{item.url?item.url:item}}?v={{img_version}}" data-index="{{index}}" bindlongpress="handleLongPress">
<!-- 众筹-视频 -->
<block wx:if="{{ index == 3 && actNum == 3 }}">
<video class="crowd-video" id="crowd-video" bindplay="handleVideoPlay" data-attr="videoCtx" src="{{videoBaseUrl}}video/crowd-detail.mp4" />
</block>
</image>
</block> </block>
<view class="occupancy" wx:if="{{!isShare}}"> <view class="occupancy" wx:if="{{!isShare}}">
<!-- padding底部 占位元素 -->
</view> </view>
</view> </view>
</view> </view>
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
"integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A==" "integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A=="
}, },
"glsx-applet-component": { "glsx-applet-component": {
"version": "1.1.3", "version": "1.1.10",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.3.tgz", "resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.10.tgz",
"integrity": "sha512-Ze+HdtFJImhOsWLfV+ZzB86Kf18pm9M9CZWhctPel/qJNMEn29g9ywC16NXmeac+gTu07MOpURyF+YmO8ojkJA==" "integrity": "sha512-0jJ1RT28em/lU4sak53LlU8hNgVWpgqDtF+2XxFMxlD8lT8jopA2zrEARJArRvjp0SNyxe58UXAdhJ/a8R/KdA=="
} }
} }
} }
...@@ -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.1.3" "glsx-applet-component": "^1.1.10"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
......
// pages/viewProd/index.js // pages/viewProd/index.js
import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed' import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed'
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
import { scenceList } from '~/pages/tab/index/constant/data' // import { scenceList } from '~/pages/tab/index/constant/data'
import { senceData, productData } from '~/pages/tab/index/constant/senceData' // import { senceData, productData } from '~/pages/tab/index/constant/senceData'
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
import utils from '~/utils/util.js' import utils from '~/utils/util.js'
import {getActiveApi} from "~/api/viewprod" import {getActiveApi} from "~/api/viewprod"
import {getDiscoverDetail} from "~/api/index.js"
Page({ Page({
/** /**
...@@ -28,7 +29,9 @@ Page({ ...@@ -28,7 +29,9 @@ Page({
// phone: '', //授权手机号 // phone: '', //授权手机号
prodItemVideo:'', //选中的场景下的video的第一个 prodItemVideo:'', //选中的场景下的video的第一个
activeUrl:'', // 1.3场景才有的活动配置 activeUrl:'', // 1.3场景才有的活动配置
sharephone:'' //主要微信用户,服务商 sharephone:'', //主要微信用户,服务商
productData: {}, // 场景详情数据
hasProduct: true
}, },
// 计算属性 // 计算属性
computed: { computed: {
...@@ -51,44 +54,69 @@ Page({ ...@@ -51,44 +54,69 @@ Page({
} }
}, },
// 获取产品详情
getProductDetail(id) {
return new Promise((resolve) => {
let _data;
getDiscoverDetail({id}).then((res) => {
console.log(res);
_data = res.data;
resolve(_data);
});
});
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
* 分享出去,或扫码进来 * 分享出去,或扫码进来
*/ */
onLoad(options) { async onLoad(options) {
this.getActiveApiFn() this.getActiveApiFn()
// 是否已经查看详情 // 是否已经查看详情
this.isgetAuthphone() this.isgetAuthphone()
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { actNum, activeNavIdx, isShare,sharephone, sceneCode } = options // let { actNum, activeNavIdx, isShare,sharephone, sceneCode } = options
let { isShare,sharephone, sceneCode, id } = options
let proData = await this.getProductDetail(id);
if (!proData) {
this.setData({
hasProduct: false
})
return
}
if(isShare){ if(isShare){
wx.hideHomeButton() wx.hideHomeButton()
} }
let sceneObj = {}
if(actNum != 99) {
sceneObj = scenceList.find(item => item.sceneid == actNum)
} else {
sceneObj = productData[99].find(item => item.sceneCode == sceneCode)
}
let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
this.setData({ this.setData({
actNum, //选中的场景下标/sceneid productData: proData,
activeNavIdx, //选中的产品
isShare, isShare,
sharephone sharephone
}); });
// let sceneObj = {}
// if(actNum != 99) {
// sceneObj = scenceList.find(item => item.sceneid == actNum)
// } else {
// sceneObj = productData[99].find(item => item.sceneCode == sceneCode)
// }
// let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
// this.setData({
// actNum, //选中的场景下标/sceneid
// activeNavIdx, //选中的产品
// isShare,
// sharephone
// });
let wx_user_info = wx.$storage.get('wx_user_info'), let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || '' shareOpenId = wx_user_info.openId || ''
setTimeout(() => { setTimeout(() => {
utils.setNavigationBarTitle(proInfo?.productName) utils.setNavigationBarTitle(proData?.proName)
},100) },100)
this.shareQuery = `sceneCode=${sceneObj.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${sharephone}` // this.shareQuery = `sceneCode=${sceneObj.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${sharephone}`
this.shareQuery = `id=${id}&sceneCode=${sceneCode}&productCode=${proData?.productCode}&isShare=${true}&sharephone=${sharephone}`
console.log(this.shareQuery, 'onload----') console.log(this.shareQuery, 'onload----')
this.shareTrackData = { this.shareTrackData = {
sceneCode: sceneObj.sceneCode, sceneCode: sceneObj.sceneCode,
...@@ -104,31 +132,43 @@ Page({ ...@@ -104,31 +132,43 @@ Page({
}, },
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { async onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0,phone=123, sceneid99=0 } = options; // let { actNum = 0, activeNavIdx = 0,phone=123, sceneid99=0 } = options;
let data = actNum != 99 ? scenceList : productData[actNum] // let data = actNum != 99 ? scenceList : productData[actNum]
let value = actNum != 99 ? actNum : sceneid99 // let value = actNum != 99 ? actNum : sceneid99
let sceneObj = data.find(item => item.sceneid == value) // let sceneObj = data.find(item => item.sceneid == value)
let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx) // let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
// this.setData({
// actNum, //选中的场景下标
// activeNavIdx, //选中的产品
// sharephone:phone //联系电话 (登陆的用户)
// });
let { phone=123, id, sceneCode } = options;
let proData = await this.getProductDetail(id);
if (!proData) {
this.setData({
hasProduct: false
})
return
}
this.setData({ this.setData({
actNum, //选中的场景下标 sharephone:phone, //联系电话 (登陆的用户)
activeNavIdx, //选中的产品 productData: proData,
sharephone:phone //联系电话 (登陆的用户)
}); });
// 设置转发标题 // 设置转发标题
let userInfoObj = wx.$storage.get("userInfo"); let userInfoObj = wx.$storage.get("userInfo");
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称 // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName; let name = userInfoObj.merchantName;
this.shareTitle = `${name}给你分享一个活动${proInfo?.productName},戳我参与~`; this.shareTitle = `${name}给你分享一个活动${proData?.proName},戳我参与~`;
//分享数据 //分享数据
// let item = this.data.proInfo || {} // let item = this.data.proInfo || {}
setTimeout(() => { setTimeout(() => {
utils.setNavigationBarTitle(proInfo?.productName) utils.setNavigationBarTitle(proData?.proName)
},100) },100)
//分享人openId //分享人openId
...@@ -136,14 +176,26 @@ Page({ ...@@ -136,14 +176,26 @@ Page({
shareOpenId = wx_user_info.openId || '' shareOpenId = wx_user_info.openId || ''
// &shareOpenId=${shareOpenId} // &shareOpenId=${shareOpenId}
this.shareQuery = `sceneCode=${sceneObj?.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${phone}` // this.shareQuery = `sceneCode=${sceneObj?.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${phone}`
this.shareQuery = `id=${id}&sceneCode=${sceneCode}&productCode=${proData?.productCode}&isShare=${true}&sharephone=${phone}`
console.log(this.shareQuery, 'onrouter----') console.log(this.shareQuery, 'onrouter----')
this.shareTrackData = { // this.shareTrackData = {
sceneCode: sceneObj?.sceneCode, // sceneCode: sceneObj?.sceneCode,
productCode: proInfo?.productCode, // productCode: proInfo?.productCode,
productName: proInfo?.productName, // productName: proInfo?.productName,
category: proInfo?.category, // category: proInfo?.category,
productDesc: proInfo?.productName, // productDesc: proInfo?.productName,
// shareOpenId:shareOpenId
// // actNum,
// // activeNavIdx,
// // apiData,
// }
this.shareTrackData = {
sceneCode: sceneCode,
productCode: proData?.productCode,
productName: proData?.productName,
category: proData?.category,
productDesc: proData?.productName,
shareOpenId:shareOpenId shareOpenId:shareOpenId
// actNum, // actNum,
// activeNavIdx, // activeNavIdx,
......
<!--packagesList/pages/productDetail/productDetail.wxml--> <!--packagesList/pages/productDetail/productDetail.wxml-->
<pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}" activeUrl="{{activeUrl}}" bind:getUserInfo="getUserInfo"></pro-detail> <!-- <pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}" activeUrl="{{activeUrl}}" bind:getUserInfo="getUserInfo"></pro-detail> -->
<block wx:if="{{!hasProduct}}">
<no-product></no-product>
</block>
<block wx:else>
<pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" proDetail="{{productData}}" bind:getUserInfo="getUserInfo"></pro-detail>
<!-- <block wx:if="{{showLeftFlag}}"> <!-- <block wx:if="{{showLeftFlag}}">
<button class="more-btn" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber"> <button class="more-btn" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
...@@ -9,4 +14,5 @@ ...@@ -9,4 +14,5 @@
<!-- 申请按钮 不是分享出去的显示按钮 --> <!-- 申请按钮 不是分享出去的显示按钮 -->
<apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button> <apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button>
<!-- 授权昵称 --> <!-- 授权昵称 -->
<view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view>
\ No newline at end of file \ No newline at end of file
<view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view>
</block>
\ No newline at end of file \ No newline at end of file
// packagesList/pages/videoDetal/videoDetal.js // packagesList/pages/videoDetal/videoDetal.js
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
import { senceData, productData } from "~/pages/tab/index/constant/senceData"; // import { senceData, productData } from "~/pages/tab/index/constant/senceData";
// 导入方法 // 导入方法
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed"; import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed";
import utils from '~/utils/util.js' import utils from '~/utils/util.js'
import {getDetailWithLike} from "~/api/index.js"
Page({ Page({
noPageAuth: true, noPageAuth: true,
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
senceData, // senceData,
productData, // productData,
videoItem: { videoItem: {
index: 0, index: 0,
videoList: [], videoList: [],
...@@ -20,102 +21,158 @@ Page({ ...@@ -20,102 +21,158 @@ Page({
tabsActive: 1 tabsActive: 1
}, },
videoObj: {}, videoObj: {},
showAuth: false showAuth: false,
videoData: {},
videoId: '',
hasProduct: true
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { async onLoad(options) {
wx.$router.getData(res => { // wx.$router.getData(res => {
this.setData({ // this.setData({
videoItem: res // videoItem: res
}) // })
}) // })
if (!utils.isEmptyObj(options)) { // if (!utils.isEmptyObj(options)) {
let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex = 0, tabsActive } = options; // let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex = 0, tabsActive } = options;
let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode) // let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode)
let videoList = [] // let videoList = []
let videoUrl = '' // let videoUrl = ''
let videoObj = {} // let videoObj = {}
if (tabsActive === '3') { // if (tabsActive === '3') {
videoList = item?.operationVideoList // videoList = item?.operationVideoList
videoUrl = item?.operationVideoList[videoIndex]?.videoUrl // videoUrl = item?.operationVideoList[videoIndex]?.videoUrl
videoObj = item?.operationVideoList[videoIndex] // videoObj = item?.operationVideoList[videoIndex]
} else { // } else {
videoList = item?.videoList, // videoList = item?.videoList,
videoUrl = item.videoList[videoIndex]?.videoUrl // videoUrl = item.videoList[videoIndex]?.videoUrl
videoObj = item?.videoList[videoIndex] // videoObj = item?.videoList[videoIndex]
} // }
let videoItem = { // let videoItem = {
index: videoIndex, // index: videoIndex,
videoList: videoList, // videoList: videoList,
videoUrl: videoUrl, // videoUrl: videoUrl,
tabsActive: tabsActive // tabsActive: tabsActive
// }
// this.setData({
// videoItem: videoItem,
// isShare: isShare,
// videoObj: videoObj,
// leftMenuIndex: leftMenuIndex
// })
// this.setpagesTitle()
// this.shareDataFn(options)
if (utils.isEmptyObj(options)) return
console.log(options);
const { id, isShare } = options;
let videoData = await this.getDetailWithLike(id);
if (!videoData) {
this.setData({
hasProduct: false
})
return
} }
this.setData({ this.setData({
videoItem: videoItem, videoData,
isShare: isShare, videoId: id,
videoObj: videoObj, isShare
leftMenuIndex: leftMenuIndex });
}) this.setpagesTitle(videoData.title)
this.setpagesTitle() this.changeShareData()
this.shareDataFn(options)
}
}, },
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { async onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { scenIndex, videoList, index, leftMenuIndex = 0 } = options // let { scenIndex, videoList, index, leftMenuIndex = 0 } = options
options.videoIndex = index // options.videoIndex = index
options.tabActive = scenIndex // options.tabActive = scenIndex
this.setData({ // this.setData({
videoObj: videoList[index], // videoObj: videoList[index],
leftMenuIndex: leftMenuIndex // leftMenuIndex: leftMenuIndex
}) // })
this.setpagesTitle() // this.setpagesTitle()
this.shareDataFn(options) // this.shareDataFn(options)
},// 分享数据函数 let { id, sceneCode } = options;
shareDataFn(options) { let videoData = await this.getDetailWithLike(id);
if (!options || utils.isEmptyObj(options)) return if (!videoData) {
let { tabActive, videoIndex, tabsActive } = options this.setData({
hasProduct: false
})
return
}
this.setData({ this.setData({
tabsActive, videoData,
tabActive: tabActive, isLoadding: false,
videoIndex: videoIndex, videoId: id,
}, () => { sceneCode
//分享的数据 });
this.changeShareData() this.setpagesTitle(videoData.title)
this.changeShareData()
},
// 获取视频详情
getDetailWithLike(id) {
return new Promise((resolve) => {
let _data;
getDetailWithLike({id}).then((res) => {
console.log(res);
_data = res.data;
resolve(_data);
});
}); });
}, },
// 分享数据函数
// shareDataFn(options) {
// if (!options || utils.isEmptyObj(options)) return
// let { tabActive, videoIndex, tabsActive } = options
// this.setData({
// tabsActive,
// tabActive: tabActive,
// videoIndex: videoIndex,
// }, () => {
// //分享的数据
// this.changeShareData()
// });
// },
changeShareData() { changeShareData() {
let { senceData, tabActive, videoIndex, videoObj, leftMenuIndex = 0, tabsActive } = this.data // let { senceData, tabActive, videoIndex, videoObj, leftMenuIndex = 0, tabsActive } = this.data
// // 设置转发标题 // // 设置转发标题
// let userInfoObj = wx.$storage.get("userInfo"); // let userInfoObj = wx.$storage.get("userInfo");
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称 // // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName; // let name = userInfoObj.merchantName;
this.shareTitle = `给您分享一个${videoObj.name} 视频`; let { title } = this.data.videoData
let { sceneCode, videoId } = this.data
this.shareTitle = `给您分享一个${title} 视频`;
//分享的数据 //分享的数据
let senceItem = productData[tabActive][leftMenuIndex] // let senceItem = productData[tabActive][leftMenuIndex]
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&isShare=${true}&tabActive=${tabActive}&videoIndex=${videoIndex}&leftMenuIndex=${leftMenuIndex}&tabsActive=${tabsActive}` // this.shareQuery = `sceneCode=${senceItem?.sceneCode}&isShare=${true}&tabActive=${tabActive}&videoIndex=${videoIndex}&leftMenuIndex=${leftMenuIndex}&tabsActive=${tabsActive}`
this.shareQuery = `sceneCode=${sceneCode}&isShare=${true}&id=${videoId}`
}, },
// 切换视频 // 切换视频
chooseVideo(e) { chooseVideo(e) {
let { detail } = e // let { detail } = e
// this.setData({
// videoIndex: detail.index,
// ['videoItem.index']: detail.index,
// ['videoItem.videoUrl']: detail?.info?.videoUrl,
// videoObj: detail?.info
// })
const {title, id} = e.detail
this.setData({ this.setData({
videoIndex: detail.index, videoId: id
['videoItem.index']: detail.index,
['videoItem.videoUrl']: detail?.info?.videoUrl,
videoObj: detail?.info
}) })
this.setpagesTitle() this.setpagesTitle(title)
this.changeShareData() this.changeShareData()
}, },
// 下载视频 // 下载视频
downVideo() { downVideo() {
const _this = this const _this = this
let { videoObj } = this.data // let { videoObj } = this.data
let url = videoObj.videoUrl // let url = videoObj.videoUrl
let {videoId} = this.data
const {vedioUrl} = this.data.videoData.likeList.find(item => item.id == videoId)
wx.getSetting({ wx.getSetting({
success: (res) => { success: (res) => {
if (res.authSetting['scope.writePhotosAlbum'] === false) { if (res.authSetting['scope.writePhotosAlbum'] === false) {
...@@ -125,7 +182,7 @@ Page({ ...@@ -125,7 +182,7 @@ Page({
} else { } else {
wx.$api.showToast('正在下载视频...') wx.$api.showToast('正在下载视频...')
wx.downloadFile({ wx.downloadFile({
url: url, url: vedioUrl,
success(res) { success(res) {
if (res.statusCode === 200) { if (res.statusCode === 200) {
wx.saveVideoToPhotosAlbum({ wx.saveVideoToPhotosAlbum({
...@@ -162,11 +219,10 @@ Page({ ...@@ -162,11 +219,10 @@ Page({
*/ */
onReady() { }, onReady() { },
//设置标题 //设置标题
setpagesTitle() { setpagesTitle(title) {
//设置标题 //设置标题
let { videoObj } = this.data
setTimeout(() => { setTimeout(() => {
utils.setNavigationBarTitle(videoObj.name) utils.setNavigationBarTitle(title)
}, 100) }, 100)
}, },
......
<!--packagesList/pages/videoDetal/videoDetal.wxml--> <!--packagesList/pages/videoDetal/videoDetal.wxml-->
<gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail> <!-- <gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail> -->
<block wx:if="{{!hasProduct}}">
<no-product></no-product>
</block>
<block wx:else>
<gl-video-detail list="{{videoData}}" bindchooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 --> <!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button> <apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
<block wx:if="{{showAuth}}"> <block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize> <authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
</block> </block>
\ No newline at end of file \ No newline at end of file
...@@ -3,9 +3,9 @@ import { IMG_URL } from '~/utils/constantData.js' ...@@ -3,9 +3,9 @@ import { IMG_URL } from '~/utils/constantData.js'
// import Util from '~/utils/util.js' // import Util from '~/utils/util.js'
import { deleteSecond } from '~/utils/format' import { deleteSecond } from '~/utils/format'
// import { senceData } from './constant/data' // import { senceData } from './constant/data'
import { scenceList } from './constant/data' // import { scenceList } from './constant/data'
// import { senceData, productData } from './constant/senceData' // import { senceData, productData } from './constant/senceData'
import { subscriptionBannerUrl, subscriptionSystemData } from './constant/systemData' // import { subscriptionBannerUrl, subscriptionSystemData } from './constant/systemData'
import { getMockData } from '~/api/api' import { getMockData } from '~/api/api'
const IMAGES = Object.freeze({ const IMAGES = Object.freeze({
arrow: `${IMG_URL}/index/point.png`, arrow: `${IMG_URL}/index/point.png`,
...@@ -77,7 +77,7 @@ Page({ ...@@ -77,7 +77,7 @@ Page({
isFirst: true, isFirst: true,
// tabList: pageData.tabList, // tabList: pageData.tabList,
// 定义数据 // 定义数据
scenceList, // scenceList,
// senceData, // senceData,
isShow: false, isShow: false,
// productData, // productData,
...@@ -88,43 +88,58 @@ Page({ ...@@ -88,43 +88,58 @@ Page({
headerHeight: 0, headerHeight: 0,
unreadClueCount: 0, unreadClueCount: 0,
img_version: "0.1.1", img_version: "0.1.1",
subscriptionBannerUrl: Object.freeze(subscriptionBannerUrl), // subscriptionBannerUrl: Object.freeze(subscriptionBannerUrl),
subscriptionSystemData: Object.freeze(subscriptionSystemData), // subscriptionSystemData: Object.freeze(subscriptionSystemData),
systemData: [],
productData: [],
}, },
proClick(e) { proClick(e) {
let { detail } = e; // let { detail } = e;
//登录的用户手机号 // //登录的用户手机号
// let userInfo = wx.$storage.get("userInfo");
// let obj = {
// actNum: isNaN(detail.scenIndex) ? 99 : detail.scenIndex, //选中的场景 没有就是订阅系统的
// sceneid99: detail.sceneid,
// activeNavIdx: detail.id, //选中的产品,
// phone: userInfo.phone,
// };
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
const { info, sceneCode } = e.detail
let obj = { let obj = {
actNum: isNaN(detail.scenIndex) ? 99 : detail.scenIndex, //选中的场景 没有就是订阅系统的
sceneid99: detail.sceneid,
activeNavIdx: detail.id, //选中的产品,
phone: userInfo.phone, phone: userInfo.phone,
}; id:info.id,
sceneCode
}
wx.$router.go("/packagesList/pages/productDetail/productDetail", obj); wx.$router.go("/packagesList/pages/productDetail/productDetail", obj);
}, },
// 跳转视频详情 // 跳转视频详情
videoClick(e) { videoClick(e) {
const { name } = e.target.dataset; // const { name } = e.target.dataset;
const { // const {
index, // index,
info: { videoUrl }, // info: { videoUrl },
scenIndex, // scenIndex,
list, // list,
tabsActive, // tabsActive,
} = e.detail; // } = e.detail;
const videoList = list; // const videoList = list;
// let userInfo = wx.$storage.get("userInfo");
// const obj = {
// index,
// videoList,
// scenIndex: isNaN(scenIndex) ? 99 : scenIndex,
// videoUrl: videoUrl,
// phone: userInfo.phone,
// tabsActive,
// };
// if (name == "客户数字化") {
// obj.leftMenuIndex = leftMenuIndex;
// }
const { info, sceneCode } = e.detail
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
const obj = { const obj = {
index,
videoList,
scenIndex: isNaN(scenIndex) ? 99 : scenIndex,
videoUrl: videoUrl,
phone: userInfo.phone, phone: userInfo.phone,
tabsActive, id:info.id,
};
if (name == "客户数字化") {
obj.leftMenuIndex = leftMenuIndex;
} }
wx.$router.go("/packagesList/pages/videoDetal/videoDetal", obj); wx.$router.go("/packagesList/pages/videoDetal/videoDetal", obj);
}, },
...@@ -145,12 +160,21 @@ Page({ ...@@ -145,12 +160,21 @@ Page({
// phone: userInfo.phone, // phone: userInfo.phone,
// }; // };
// wx.$router.go("/pages/viewProdBanner/index", obj); // wx.$router.go("/pages/viewProdBanner/index", obj);
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", { // wx.$router.go("/packagesList/pages/scenarioDetail/scenarioDetail", {
actNum: scenIndex, // actNum: scenIndex,
phone: userInfo.phone, // phone: userInfo.phone,
}); // });
// 如果没有sceneCode,或者没有配置banner跳转 isBannerLink 1-有配置 2-没有配置
if (!e.detail.sceneCode || e.detail.isBannerLink == 2) return
let userInfo = wx.$storage.get("userInfo");
// 获取场景
let systemItem = this.data.systemData.find(item => item.sceneCode == e.detail.sceneCode)
let productItem = this.data.productData.find(item => item.sceneCode == e.detail.sceneCode)
const id = systemItem?.productList[0].id || productItem?.productList[0].id
if (!id) return
wx.$router.go('/packagesList/pages/productDetail/productDetail', { phone: userInfo.phone, id })
}, },
// 获取全部活动列表 // 获取全部活动列表
getActivityRecord() { getActivityRecord() {
...@@ -420,6 +444,16 @@ Page({ ...@@ -420,6 +444,16 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
// 获取看产值数据
const app = getApp()
app.getBaseData().then(res => {
const productData = res[0].list
const systemData = res[1].list
this.setData({
systemData,
productData
})
})
// console.log('options: ', options); // console.log('options: ', options);
let { sessionId } = wx.$storage.get(); let { sessionId } = wx.$storage.get();
// console.log("sessionId: ", sessionId); // console.log("sessionId: ", sessionId);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
headerHeight="{{headerHeight}}" headerHeight="{{headerHeight}}"
bindrefresherrefresh="refresherrefresh" /> --> bindrefresherrefresh="refresherrefresh" /> -->
<block wx:if="{{tabIndx == 0}}"> <block wx:if="{{tabIndx == 0}}">
<gl-scenario currentScenIndex="{{3}}" discoverIndex="{{2}}" list="{{scenceList}}" activityList="{{activityList}}" bindactivityClick="activityClick" bindproClick="proClick" bind:videoClick="videoClick" bindsenceClick="senceClick" bindleftClick="leftClick"></gl-scenario> <gl-scenario list="{{productData}}" activityList="{{activityList}}" bindactivityClick="activityClick" bindproClick="proClick" bind:videoClick="videoClick" bindsenceClick="senceClick" bindleftClick="leftClick"></gl-scenario>
</block> </block>
<!-- 看线索内容 --> <!-- 看线索内容 -->
<!-- <indexClue <!-- <indexClue
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,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}}" bindmenuClick="sysMenuClick" bannerUrl="{{subscriptionBannerUrl}}" bind:proClick="proClick" bind:videoClick="videoClick" bindcurrentScen="getCurrentScen" data-name="客户数字化" /> <gl-subscription list="{{systemData}}" bindmenuClick="sysMenuClick" bind:proClick="proClick" bind:videoClick="videoClick" bindcurrentScen="getCurrentScen" bindsenceClick="senceClick" data-name="客户数字化" />
</block> </block>
</view> </view>
<!-- 收藏、取消提示框 --> <!-- 收藏、取消提示框 -->
......
...@@ -25,7 +25,7 @@ const systemInfo = wx.getSystemInfoSync() ...@@ -25,7 +25,7 @@ const systemInfo = wx.getSystemInfoSync()
const manual = false const manual = false
const release = false const release = false
let index = 2 let index = 1
// 判断小程序环境 // 判断小程序环境
// develop:开发版(正常开发工具,测试时) // develop:开发版(正常开发工具,测试时)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!