Commit ec14b4a9 by 杨明

发现

1 parent 633346a7
...@@ -31,6 +31,15 @@ class BusassistantApi { ...@@ -31,6 +31,15 @@ class BusassistantApi {
true true
) )
} }
// 获取一级菜单下所在类别所有数据
getContentList(data) {
return api.post({
method: 'scrm.api.busassistant.discover.weapp.contentList',
...data
},
true
)
}
} }
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
"integrity": "sha512-swM4k3pVwt/6Tnijvq86paLiKE1CzbrBQ4lR7+9uRhwKOM0HS3ooK1Q4IjSEyxQ59ZFKmYYvZln77RZcnSDqmA==" "integrity": "sha512-swM4k3pVwt/6Tnijvq86paLiKE1CzbrBQ4lR7+9uRhwKOM0HS3ooK1Q4IjSEyxQ59ZFKmYYvZln77RZcnSDqmA=="
}, },
"glsx-applet-component": { "glsx-applet-component": {
"version": "1.1.11", "version": "1.1.13",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.11.tgz", "resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.13.tgz",
"integrity": "sha512-Gu70TYByO1q+4ZiOR/aRJOdajgSJSnJTgeggjKDb1GUNVgPgb/iS9sGwyeAImBqGe++76Ws5LxLoegiixTzl4w==" "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.11" "glsx-applet-component": "^1.1.13"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
......
// packagesList/pages/videoDetal/videoDetal.js
// packagesList/pages/videoDetal/videoDetal.js
import { import {
IMG_URL IMG_URL
} from "~/utils/constantData.js"; } from "~/utils/constantData.js";
// import { senceData, productData } from "../constant/senceData"; // import { senceData, productData } from "../constant/senceData";
import { import {
senceData, senceData,
productData productData
} from "~/pages/tab/discovery/constant/senceData"; } from "~/pages/tab/discovery/constant/senceData";
// 导入方法 // 导入方法
import { import {
behavior as computedBehavior behavior as computedBehavior
} from "~/utils/lib/miniprogram-computed"; } from "~/utils/lib/miniprogram-computed";
import utils from '~/utils/util.js' import utils from '~/utils/util.js'
import BusassistantApi from "~/api/busassistantApi/index"; import busassistantApi from "~/api/busassistantApi/index";
Page({ Page({
noPageAuth: true, noPageAuth: true,
/** /**
...@@ -21,75 +22,54 @@ Page({ ...@@ -21,75 +22,54 @@ Page({
data: { data: {
// senceData, // senceData,
// productData, // productData,
hasProduct: true, // videoItem: {
// index: 0,
// videoList: [],
// videoUrl: '',
// isShare: false,//是否是被分享出去
// tabsActive: 1
// },
isShare: false,
hasVideo: true,
videoObj: {},
videoData: {}, videoData: {},
videoId: '', videoId: '',
videoItem: { showAuth: false,
index: 0, sceneCode: ''
videoList: [],
videoUrl: '',
isShare: false, //是否是被分享出去
tabsActive: 1
},
videoObj: {},
showAuth: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
async onLoad(options) { async onLoad(options) {
// wx.$router.getData(res => {
// this.setData({
// videoItem: res
// })
// })
// if (!utils.isEmptyObj(options)) {
// let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex = 0, tabsActive } = options;
// let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode)
// let videoList = []
// let videoUrl = ''
// let videoObj = {}
// if (tabsActive == '3') {
// videoList = item?.operationVideoList
// videoUrl = item?.operationVideoList[videoIndex]?.videoUrl
// videoObj = item?.operationVideoList[videoIndex]
// }else{
// videoList = item?.videoList,
// videoUrl = item.videoList[videoIndex]?.videoUrl
// videoObj = item?.videoList[videoIndex]
// }
// let videoItem = {
// index: videoIndex,
// videoList: videoList,
// videoUrl: videoUrl,
// tabsActive: tabsActive
// }
// this.setData({
// videoItem: videoItem,
// isShare: isShare,
// videoObj: videoObj,
// leftMenuIndex: leftMenuIndex
// })
// this.shareDataFn(options)
// }
if (utils.isEmptyObj(options)) return if (utils.isEmptyObj(options)) return
const { const { id,typeId,isDigitalCase,tabsActive, isShare } = options;
id, let videoLikeList = [];
isShare
} = options;
let videoData = await this.getDetailWithLike(id); let videoData = await this.getDetailWithLike(id);
if (!videoData || videoData?.status == 2) { videoLikeList = videoData.likeList
if (isDigitalCase=='true') {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId,tabsActive);
this.setData({
isDigitalCase: true
})
}
if(!videoData || videoData?.status == 2) {
this.setData({ this.setData({
isLoadding: false, isLoadding: false,
hasProduct: false hasVideo: false
}) })
return return
} }
this.setData({ this.setData({
videoData, videoData,
videoLikeList,
videoId: id, videoId: id,
isShare isLoadding: false,
typeId,
isShare,
tabsActive
}); });
this.setpagesTitle(videoData.proName) this.setpagesTitle(videoData.proName)
this.changeShareData() this.changeShareData()
...@@ -97,118 +77,111 @@ Page({ ...@@ -97,118 +77,111 @@ Page({
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
async onRoute(options) { async onRoute(options) {
if (!options || utils.isEmptyObj(options) || options.isShare) return if (!options || utils.isEmptyObj(options) || options.isShare) return
// let { scenIndex, videoList, index, leftMenuIndex = 0 } = options let { id,typeId,sceneCode,tabsActive } = options;
// options.videoIndex = index let videoLikeList = [];
// options.tabActive = scenIndex
// this.setData({
// videoObj: videoList[index],
// leftMenuIndex: leftMenuIndex
// })
let {
id,
sceneCode
} = options;
let videoData = await this.getDetailWithLike(id); let videoData = await this.getDetailWithLike(id);
if (!videoData || videoData?.status == 2) { videoLikeList = videoData.likeList
// 判断是不是在数字化转型案例菜单下
if (!sceneCode) {
// 调接口获取当前一级菜单下所有视频
videoLikeList = await this.getVideoLikeList(typeId,tabsActive);
this.setData({
isDigitalCase: true
})
}
if(!videoData || videoData?.status == 2) {
this.setData({ this.setData({
isLoadding: false, isLoadding: false,
hasProduct: false hasVideo: false
}) })
return return
} }
this.setData({ this.setData({
videoData, videoData,
videoLikeList,
isLoadding: false, isLoadding: false,
videoId: id, videoId: id,
sceneCode typeId,
tabsActive
}); });
this.setpagesTitle(videoData.proName) this.setpagesTitle(videoData.proName)
this.changeShareData() this.changeShareData()
}, },// 分享数据函数
// 获取视频详情 // 获取视频详情
getDetailWithLike(id) { getDetailWithLike(id) {
return new Promise((resolve) => { return new Promise((resolve) => {
let _data; let _data;
BusassistantApi.getDetailWithLike({ busassistantApi.getDetailWithLike({id}).then((res) => {
id console.log(res);
}).then((res) => {
_data = res.data; _data = res.data;
resolve(_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(options)
});
},
changeShareData() { changeShareData() {
let { let { title } = this.data.videoData
title let { sceneCode, videoId, isDigitalCase,typeId,tabsActive } = this.data
} = this.data.videoData
let {
sceneCode,
videoId
} = this.data
// // 设置转发标题 // // 设置转发标题
// let userInfoObj = wx.$storage.get("userInfo"); // let userInfoObj = wx.$storage.get("userInfo");
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称 // // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName; // let name = userInfoObj.merchantName;
this.shareTitle = `给您分享一个${title} 视频`; let { proName } = this.data.videoData
this.shareTitle = `给您分享一个${proName} 视频`;
//分享的数据 //分享的数据
// let senceItem = productData[tabActive][leftMenuIndex] // let senceItem = productData[tabActive][leftMenuIndex]
this.shareQuery = `sceneCode=${sceneCode}&isShare=${true}&id=${videoId}` this.shareQuery = `sceneCode=${sceneCode}&isShare=${true}&id=${videoId}&isDigitalCase=${isDigitalCase}&typeId=${typeId}&tabsActive=${tabsActive}`
this.shareAppMessage = { this.shareAppMessage = {
title: title, title:this.shareTitle,
path: `/${this.route}?${this.shareQuery}`, path: `/${this.route}?${this.shareQuery}`,
query: this.shareQuery query:this.shareQuery
} }
}, },
// 切换视频 // 切换视频
async chooseVideo(e) { async chooseVideo(e) {
const { const {title, id} = e.detail
proName,
id
} = e.detail
let videoData = await this.getDetailWithLike(id); let videoData = await this.getDetailWithLike(id);
this.setData({ this.setData({
videoId: id, videoId: id,
videoData videoData
}) })
this.setpagesTitle(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
}
console.log(params);
busassistantApi.getContentList(params).then((res) => {
console.log(res);
_data = res.data;
resolve(_data);
});
});
},
// 下载视频 // 下载视频
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 { let {videoId} = this.data
videoId const {vedioUrl} = this.data.videoLikeList.find(item => item.id == 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){
_this.setData({ _this.setData({
showAuth: true showAuth: true
}) })
} else { }else{
wx.$api.showToast('正在下载视频...') wx.$api.showToast('正在下载视频...')
wx.downloadFile({ wx.downloadFile({
url: vedioUrl, url: vedioUrl,
...@@ -221,9 +194,7 @@ Page({ ...@@ -221,9 +194,7 @@ Page({
wx.$api.showToast('下载成功!') wx.$api.showToast('下载成功!')
}, 2000) }, 2000)
}, },
fail({ fail({ errMsg }) {
errMsg
}) {
_this.setData({ _this.setData({
showAuth: errMsg == "saveVideoToPhotosAlbum:fail auth deny", showAuth: errMsg == "saveVideoToPhotosAlbum:fail auth deny",
}) })
...@@ -248,7 +219,7 @@ Page({ ...@@ -248,7 +219,7 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() {}, onReady() { },
//设置标题 //设置标题
setpagesTitle(title) { setpagesTitle(title) {
//设置标题 //设置标题
...@@ -257,12 +228,11 @@ Page({ ...@@ -257,12 +228,11 @@ Page({
}, 100) }, 100)
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.data.videoData.proName&&this.setpagesTitle(this.data.videoData.proName)
}, },
/** /**
......
<!--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}}"> <block wx:if="{{!hasVideo}}">
<no-product></no-product> <no-product></no-product>
</block> </block>
<block wx:else> <block wx:else>
<gl-video-detail list="{{videoData}}" bind:chooseVideo="chooseVideo"></gl-video-detail> <gl-video-detail list="{{videoData}}" likeList="{{videoLikeList}}" bind:chooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 --> <!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button> <apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
......
...@@ -63,14 +63,15 @@ Component({ ...@@ -63,14 +63,15 @@ Component({
}, },
// 视频点击事件 // 视频点击事件
videoClick(e) { videoClick(e) {
let userInfo = wx.$storage.get("userInfo") const { info, sceneCode } = e.detail
const { // 一级菜单ID
info, const typeId = this.data.myTabIdx == 0 ? this.data.productDataId : this.data.systemDataId
sceneCode
} = e.detail
const obj = { const obj = {
phone: userInfo.phone, hasPhoneNumber: this.data.hasPhoneNumber,
id: info.id, id: info.info.id,
tabsActive: info.tabsActive,
sceneCode,
typeId
} }
wx.$router.go('/packagesList/packageDiscovery/pages/videoDetail/videoDetail', obj) wx.$router.go('/packagesList/packageDiscovery/pages/videoDetail/videoDetail', obj)
}, },
...@@ -242,7 +243,7 @@ Component({ ...@@ -242,7 +243,7 @@ Component({
url: "https://work.weixin.qq.com/kfid/kfcf7b721472201345e" url: "https://work.weixin.qq.com/kfid/kfcf7b721472201345e"
}, },
corpId: "ww047bdc0f1e76cc13", corpId: "ww047bdc0f1e76cc13",
complete: (r) => {}, complete: (r) => { },
}); });
}, },
...@@ -272,12 +273,12 @@ Component({ ...@@ -272,12 +273,12 @@ Component({
const systemData = res[1].list const systemData = res[1].list
// this.getSceneData(productData) // this.getSceneData(productData)
this.setData({ this.setData({
['navList[0]']: res[0].name, [`tabList[0].name`]: res[0].name,
['navList[1]']: res[1].name, [`tabList[1]name`]: res[1].name,
systemData, systemData,
showPage: true, systemDataId: res[1].id,
productData, productData,
curTabId: productData?.[this.data.curTabIdx]?.sceneid || 0 productDataId: res[0].id,
}) })
}) })
} }
......
{ {
"appid": "wxc50d04ae5aa9984a", "appid": "wx96c8f2a3e76907cb",
"projectname": "business-assistant", "projectname": "business-assistant",
"compileType": "miniprogram", "compileType": "miniprogram",
"packOptions": { "packOptions": {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!