Commit c6bde7aa by chenwq

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

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