Commit c6bde7aa by chenwq

产品详情,找产品报错;视频详情设置title,下载视频

1 parent 9c4250c9
......@@ -67,23 +67,21 @@ Page({
}
this.setData({
actNum,
activeNavIdx,
actNum, //选中的场景下标
activeNavIdx, //选中的产品
isShare,
sharephone
});
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
// console.log('shareOpenId: ', shareOpenId);
// &shareOpenId=${shareOpenId}
//分享数据
const senceList = this.data.productData[this.data.actNum].filter(item => item.name != '全部')
for (let i = 0; i < senceList.length; i++) {
let item = senceList[i]
let proIdList = senceList[i]?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) {
let proIdList = item?.productList.map(k => k.id)
if (proIdList.includes(+activeNavIdx)) {
let proInfo = item.productList.find(k => k.id == activeNavIdx)
this.setData({
proInfo,
......@@ -122,14 +120,12 @@ Page({
activeNavIdx, //选中的产品
sharephone:phone //联系电话 (登陆的用户)
});
console.log(this.data.productData, 'this.data.productDat')
const senceList = this.data.productData[this.data.actNum].filter(item => item.name != '全部')
for (let i = 0; i < senceList.length; i++) {
let item = senceList[i]
let proIdList = senceList[i]?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) {
if (proIdList.includes(+activeNavIdx)) {
let proInfo = item.productList.find(k => k.id == activeNavIdx)
this.setData({
proInfo,
......@@ -147,7 +143,6 @@ Page({
//分享数据
let item = this.data.proInfo || {}
console.log('title2',item.productName)
setTimeout(() => {
utils.setNavigationBarTitle(item.productName)
},100)
......@@ -201,8 +196,6 @@ Page({
onPageScroll: (function () {
let timer = null;
return function (e) {
// console.log(e)
// console.log("在滚动");
// 监听页面的滚动开始和结束
clearTimeout(timer);
timer = setTimeout(() => {
......@@ -216,36 +209,7 @@ Page({
*/
onReady() {
this.init()
// this.getImgHeight();
},
// getImgHeight() {
// let query = wx.createSelectorQuery().in(this);
// let heightArr = [];
// let imgTopArr = [];
// let s = 0;
// let top;
// let {scrollTop} = this.data
// let _this = this;
// query
// .selectAll(".img-item")
// .boundingClientRect((react) => {
// react.forEach((item, index) => {
// //44 tab的高度
// // console.log('item',item)
// s = item.top - 44 + scrollTop;
// imgTopArr.push(s);
// });
// _this.setData({
// imgTopArr,
// });
// })
// .exec();
// // setTimeout(() => {
// // console.log('imgTopArr',this.data.imgTopArr)
// // },500)
// },
phoneCall(e) {
let { phone } = e.currentTarget.dataset;
wx.$api.phoneCall(phone);
......@@ -281,10 +245,8 @@ Page({
USERAPI.getUserProfile(this.loginToken, detail)
.then((result) => {
let userInfo = wx.$storage.get("wx_user_info");
// console.log('userInfo: ', userInfo);
let { phone } = result;
wx.$storage.set('authphone', phone)
// console.log('phone: ', phone);
wx.$storage.set("wx_user_info", {
...userInfo,
phone,
......@@ -320,19 +282,15 @@ Page({
wx.getUserProfile({
desc: '用于完善资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: res => {
// console.log('res: ', res.userInfo.nickName);
// userInfo.nickName
this.setData({
userInfo: res.userInfo
})
let wx_user_info = wx.$storage.get('wx_user_info')
// console.log('wx_user_info: ', wx_user_info);
let obj = {
...wx_user_info,
nickName: res.userInfo.nickName,
avatarUrl: res.userInfo.avatarUrl
}
// console.log('obj',obj)
wx.$storage.set('wx_user_info', obj)
_this.onLoad(null)
......
......@@ -40,14 +40,15 @@ Page({
}
this.setData({
videoItem: videoItem,
isShare: isShare, //
isShare: isShare,
videoObj: item?.videoList[videoIndex]
})
this.setpagesTitle()
this.shareDataFn(options)
}
},
//接受跳转的路由参数(小程序页面跳转)
onRoute(options) {
console.log(options, 'onroute')
if (!options || utils.isEmptyObj(options)) return
let { videoList, index } = options
options.videoIndex = index
......@@ -60,8 +61,6 @@ Page({
shareDataFn(options) {
if (!options || utils.isEmptyObj(options)) return
let { tabActive, videoIndex } = options
// console.log("options: ", options, !!options);
// console.log('tabActive,videoIndex: ', tabActive,videoIndex);
this.setData({
tabActive: tabActive,
videoIndex: videoIndex,
......@@ -86,8 +85,24 @@ Page({
},
// 下载视频
downVideo() {
let { videoItem: { url } } = this.data
console.log(url)
let { videoObj } = this.data
let url = videoObj.videoUrl
wx.$api.showToast('正在下载视频...')
wx.downloadFile({
url: url,
success(res) {
if (res.statusCode === 200) {
wx.saveVideoToPhotosAlbum({
filePath: res.tempFilePath,
success(res) {
setTimeout(() => {
wx.$api.showToast('下载成功!')
}, 2000)
}
})
}
}
})
},
// 申请合作
toApplication() {
......@@ -106,7 +121,9 @@ Page({
setpagesTitle() {
//设置标题
let { videoObj } = this.data
utils.setNavigationBarTitle(videoObj.name)
setTimeout(() => {
utils.setNavigationBarTitle(videoObj.name)
}, 100)
},
/**
......
<!--packagesList/pages/videoDetal/videoDetal.wxml-->
<!-- aaa -->
<gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}"></gl-video-detail>
<!-- 申请按钮 -->
......
......@@ -156,6 +156,7 @@ const subscriptionSystemData = [
{
name: '数字化转型案例',
"sceneCode":"SC007",
productList: [],
videoList: videoList0.concat(videoList1)
}
]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!