Commit 22394a0e by chenwq

发现版块动态化

1 parent 1194ac85
...@@ -118,6 +118,16 @@ const getDetailWithLike = (data) => { ...@@ -118,6 +118,16 @@ const getDetailWithLike = (data) => {
) )
} }
// 获取一级菜单下所在类别所有数据
const getContentList = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.weapp.contentList',
...data
},
true
)
}
module.exports = { module.exports = {
/** 线索埋点数据上报 /** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动) * operationType 操作类型(0:分享 1:浏览 2:申请活动)
...@@ -140,5 +150,6 @@ module.exports = { ...@@ -140,5 +150,6 @@ module.exports = {
getActivityDetailApi, getActivityDetailApi,
getDiscoverList, getDiscoverList,
getDiscoverDetail, getDiscoverDetail,
getDetailWithLike getDetailWithLike,
getContentList
} }
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
"integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A==" "integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A=="
}, },
"glsx-applet-component": { "glsx-applet-component": {
"version": "1.1.10", "version": "1.1.13",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.10.tgz", "resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.13.tgz",
"integrity": "sha512-0jJ1RT28em/lU4sak53LlU8hNgVWpgqDtF+2XxFMxlD8lT8jopA2zrEARJArRvjp0SNyxe58UXAdhJ/a8R/KdA==" "integrity": "sha512-erZj/7TIXcckvf2h+Mlr5rMt6YHQLUq9LysgkgbbYA/u6OCVY6pQcT70HBl0WwsoFT4CMbPZ+4gqUKWOP2RocA=="
} }
} }
} }
...@@ -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.10" "glsx-applet-component": "^1.1.13"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
......
...@@ -4,7 +4,7 @@ import { IMG_URL } from "~/utils/constantData.js"; ...@@ -4,7 +4,7 @@ import { IMG_URL } from "~/utils/constantData.js";
// 导入方法 // 导入方法
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" import { getDetailWithLike, getContentList } from "~/api/index.js"
Page({ Page({
noPageAuth: true, noPageAuth: true,
/** /**
...@@ -32,19 +32,34 @@ Page({ ...@@ -32,19 +32,34 @@ Page({
*/ */
async onLoad(options) { async onLoad(options) {
if (utils.isEmptyObj(options)) return if (utils.isEmptyObj(options)) return
const { id, isShare } = options; const { id, isShare, typeId, isDigitalCase, tabsActive } = options;
let videoLikeList = [];
let videoData = await this.getDetailWithLike(id); let videoData = await this.getDetailWithLike(id);
videoLikeList = videoData.likeList
// 判断是不是在数字化转型案例菜单下
if (isDigitalCase == 'true') {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId, tabsActive);
this.setData({
isDigitalCase: true
})
}
// 1-上架;2-下架 // 1-上架;2-下架
if (!videoData || videoData?.status == 2) { if (!videoData || videoData?.status == 2) {
this.setData({ this.setData({
isLoadding: false,
hasProduct: false hasProduct: false
}) })
return return
} }
this.setData({ this.setData({
videoData, videoData,
videoLikeList,
videoId: id, videoId: id,
isShare isShare,
isLoadding: false,
typeId,
tabsActive
}); });
this.setpagesTitle(videoData.proName) this.setpagesTitle(videoData.proName)
this.changeShareData() this.changeShareData()
...@@ -52,29 +67,59 @@ Page({ ...@@ -52,29 +67,59 @@ Page({
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
async onRoute(options) { async onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { id, sceneCode } = options; let { id, sceneCode, typeId, tabsActive } = options;
let videoLikeList = [];
let videoData = await this.getDetailWithLike(id); let videoData = await this.getDetailWithLike(id);
videoLikeList = videoData.likeList
// 判断是不是在数字化转型案例菜单下
if (!sceneCode) {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId,tabsActive);
this.setData({
isDigitalCase: true
})
}
// 1-上架;2-下架 // 1-上架;2-下架
if (!videoData || videoData?.status == 2) { if (!videoData || videoData?.status == 2) {
this.setData({ this.setData({
isLoadding: false,
hasProduct: false hasProduct: false
}) })
return return
} }
this.setData({ this.setData({
videoData, videoData,
videoLikeList,
isLoadding: false, isLoadding: false,
videoId: id, videoId: id,
sceneCode sceneCode,
typeId,
tabsActive
}); });
this.setpagesTitle(videoData.proName) this.setpagesTitle(videoData.proName)
this.changeShareData() this.changeShareData()
}, },
// 获取一级菜单下所有视频
getVideoLikeList(id,type) {
return new Promise((resolve) => {
let _data;
let params = {
menuId: id,
// 内容专区(1:特色产品,2:案例视频,3:营销海报,4:操作指引,5:banner)
type: type == 1 ? 2 : 4
}
getContentList(params).then((res) => {
_data = res.data;
resolve(_data);
});
});
},
// 获取视频详情 // 获取视频详情
getDetailWithLike(id) { getDetailWithLike(id) {
return new Promise((resolve) => { return new Promise((resolve) => {
let _data; let _data;
getDetailWithLike({id}).then((res) => { getDetailWithLike({ id }).then((res) => {
_data = res.data; _data = res.data;
resolve(_data); resolve(_data);
}); });
...@@ -100,12 +145,12 @@ Page({ ...@@ -100,12 +145,12 @@ Page({
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称 // // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName; // let name = userInfoObj.merchantName;
let { proName } = this.data.videoData let { proName } = this.data.videoData
let { sceneCode, videoId } = this.data let { sceneCode, videoId, isDigitalCase, typeId, tabsActive } = this.data
this.shareTitle = `给您分享一个${proName} 视频`; this.shareTitle = `给您分享一个${proName} 视频`;
//分享的数据 //分享的数据
// 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}` this.shareQuery = `sceneCode=${sceneCode}&isShare=${true}&id=${videoId}&isDigitalCase=${isDigitalCase}&typeId=${typeId}&tabsActive=${tabsActive}`
}, },
// 切换视频 // 切换视频
async chooseVideo(e) { async chooseVideo(e) {
...@@ -116,7 +161,7 @@ Page({ ...@@ -116,7 +161,7 @@ Page({
// ['videoItem.videoUrl']: detail?.info?.videoUrl, // ['videoItem.videoUrl']: detail?.info?.videoUrl,
// videoObj: detail?.info // videoObj: detail?.info
// }) // })
const {proName, id} = e.detail const { proName, id } = e.detail
let videoData = await this.getDetailWithLike(id) let videoData = await this.getDetailWithLike(id)
this.setData({ this.setData({
videoId: id, videoId: id,
...@@ -130,8 +175,8 @@ Page({ ...@@ -130,8 +175,8 @@ Page({
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 let { videoId } = this.data
const {vedioUrl} = this.data.videoData.likeList.find(item => item.id == videoId) const { vedioUrl } = this.data.videoLikeList.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) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<no-product></no-product> <no-product></no-product>
</block> </block>
<block wx:else> <block wx:else>
<gl-video-detail list="{{videoData}}" bindchooseVideo="chooseVideo"></gl-video-detail> <gl-video-detail list="{{videoData}}" likeList="{{videoLikeList}}" bindchooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 --> <!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button> <apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
......
...@@ -116,32 +116,16 @@ Page({ ...@@ -116,32 +116,16 @@ Page({
}, },
// 跳转视频详情 // 跳转视频详情
videoClick(e) { videoClick(e) {
// const { name } = e.target.dataset;
// const {
// index,
// info: { videoUrl },
// scenIndex,
// list,
// tabsActive,
// } = e.detail;
// 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 const { info, sceneCode } = e.detail
let userInfo = wx.$storage.get("userInfo"); let userInfo = wx.$storage.get("userInfo");
// 一级菜单ID
const typeId = this.data.tabIndx == 0 ? this.data.productDataId : this.data.systemDataId
const obj = { const obj = {
phone: userInfo.phone, phone: userInfo.phone,
id:info.id, id: info.info.id,
tabsActive: info.tabsActive,
sceneCode,
typeId
} }
wx.$router.go("/packagesList/pages/videoDetal/videoDetal", obj); wx.$router.go("/packagesList/pages/videoDetal/videoDetal", obj);
}, },
...@@ -479,7 +463,9 @@ Page({ ...@@ -479,7 +463,9 @@ Page({
const systemData = res[1].list const systemData = res[1].list
this.setData({ this.setData({
systemData, systemData,
systemDataId: res[1].id,
productData, productData,
productDataId: res[0].id,
['navList[0]']: res[0].name || '看产品', ['navList[0]']: res[0].name || '看产品',
['navList[1]']: res[1].name || '客户数字化' ['navList[1]']: res[1].name || '客户数字化'
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!