Commit 22394a0e by chenwq

发现版块动态化

1 parent 1194ac85
......@@ -118,6 +118,16 @@ const getDetailWithLike = (data) => {
)
}
// 获取一级菜单下所在类别所有数据
const getContentList = (data) => {
return api.post({
method: 'scrm.api.busassistant.discover.weapp.contentList',
...data
},
true
)
}
module.exports = {
/** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动)
......@@ -140,5 +150,6 @@ module.exports = {
getActivityDetailApi,
getDiscoverList,
getDiscoverDetail,
getDetailWithLike
getDetailWithLike,
getContentList
}
......@@ -10,9 +10,9 @@
"integrity": "sha512-R2FyCk0mK2xvUX2dMgVZjVG512RKBj7ELMDxjRJjhQWtw4495WBgbl5Yb4v2A6d4vWJe6z9toKgDJTciN0Bo9A=="
},
"glsx-applet-component": {
"version": "1.1.10",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.10.tgz",
"integrity": "sha512-0jJ1RT28em/lU4sak53LlU8hNgVWpgqDtF+2XxFMxlD8lT8jopA2zrEARJArRvjp0SNyxe58UXAdhJ/a8R/KdA=="
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.13.tgz",
"integrity": "sha512-erZj/7TIXcckvf2h+Mlr5rMt6YHQLUq9LysgkgbbYA/u6OCVY6pQcT70HBl0WwsoFT4CMbPZ+4gqUKWOP2RocA=="
}
}
}
......@@ -5,7 +5,7 @@
"main": "app.js",
"dependencies": {
"@vant/weapp": "^1.10.7",
"glsx-applet-component": "^1.1.10"
"glsx-applet-component": "^1.1.13"
},
"devDependencies": {},
"scripts": {
......
......@@ -4,7 +4,7 @@ import { IMG_URL } from "~/utils/constantData.js";
// 导入方法
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed";
import utils from '~/utils/util.js'
import {getDetailWithLike} from "~/api/index.js"
import { getDetailWithLike, getContentList } from "~/api/index.js"
Page({
noPageAuth: true,
/**
......@@ -31,50 +31,95 @@ Page({
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
if (utils.isEmptyObj(options)) return
const { id, isShare } = options;
let videoData = await this.getDetailWithLike(id);
// 1-上架;2-下架
if (!videoData || videoData?.status == 2) {
this.setData({
hasProduct: false
})
return
}
if (utils.isEmptyObj(options)) return
const { id, isShare, typeId, isDigitalCase, tabsActive } = options;
let videoLikeList = [];
let videoData = await this.getDetailWithLike(id);
videoLikeList = videoData.likeList
// 判断是不是在数字化转型案例菜单下
if (isDigitalCase == 'true') {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId, tabsActive);
this.setData({
videoData,
videoId: id,
isShare
});
this.setpagesTitle(videoData.proName)
this.changeShareData()
isDigitalCase: true
})
}
// 1-上架;2-下架
if (!videoData || videoData?.status == 2) {
this.setData({
isLoadding: false,
hasProduct: false
})
return
}
this.setData({
videoData,
videoLikeList,
videoId: id,
isShare,
isLoadding: false,
typeId,
tabsActive
});
this.setpagesTitle(videoData.proName)
this.changeShareData()
},
//接受跳转的路由参数(小程序页面跳转)
async onRoute(options) {
if (!options || utils.isEmptyObj(options)) return
let { id, sceneCode } = options;
let { id, sceneCode, typeId, tabsActive } = options;
let videoLikeList = [];
let videoData = await this.getDetailWithLike(id);
videoLikeList = videoData.likeList
// 判断是不是在数字化转型案例菜单下
if (!sceneCode) {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId,tabsActive);
this.setData({
isDigitalCase: true
})
}
// 1-上架;2-下架
if (!videoData || videoData?.status == 2) {
this.setData({
isLoadding: false,
hasProduct: false
})
return
}
this.setData({
videoData,
videoLikeList,
isLoadding: false,
videoId: id,
sceneCode
sceneCode,
typeId,
tabsActive
});
this.setpagesTitle(videoData.proName)
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) {
return new Promise((resolve) => {
let _data;
getDetailWithLike({id}).then((res) => {
getDetailWithLike({ id }).then((res) => {
_data = res.data;
resolve(_data);
});
......@@ -100,12 +145,12 @@ Page({
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName;
let { proName } = this.data.videoData
let { sceneCode, videoId } = this.data
let { sceneCode, videoId, isDigitalCase, typeId, tabsActive } = this.data
this.shareTitle = `给您分享一个${proName} 视频`;
//分享的数据
// let senceItem = productData[tabActive][leftMenuIndex]
// 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) {
......@@ -116,7 +161,7 @@ Page({
// ['videoItem.videoUrl']: detail?.info?.videoUrl,
// videoObj: detail?.info
// })
const {proName, id} = e.detail
const { proName, id } = e.detail
let videoData = await this.getDetailWithLike(id)
this.setData({
videoId: id,
......@@ -130,8 +175,8 @@ Page({
const _this = this
// let { videoObj } = this.data
// let url = videoObj.videoUrl
let {videoId} = this.data
const {vedioUrl} = this.data.videoData.likeList.find(item => item.id == videoId)
let { videoId } = this.data
const { vedioUrl } = this.data.videoLikeList.find(item => item.id == videoId)
wx.getSetting({
success: (res) => {
if (res.authSetting['scope.writePhotosAlbum'] === false) {
......
......@@ -4,7 +4,7 @@
<no-product></no-product>
</block>
<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>
......
......@@ -116,32 +116,16 @@ Page({
},
// 跳转视频详情
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
let userInfo = wx.$storage.get("userInfo");
// 一级菜单ID
const typeId = this.data.tabIndx == 0 ? this.data.productDataId : this.data.systemDataId
const obj = {
phone: userInfo.phone,
id:info.id,
id: info.info.id,
tabsActive: info.tabsActive,
sceneCode,
typeId
}
wx.$router.go("/packagesList/pages/videoDetal/videoDetal", obj);
},
......@@ -479,7 +463,9 @@ Page({
const systemData = res[1].list
this.setData({
systemData,
systemDataId: res[1].id,
productData,
productDataId: res[0].id,
['navList[0]']: res[0].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!