背景:在微信小程序内展示直播预约记录列表,可点击预约视频号直播功能
获取视频号直播列表+预约视频号直播功能
展示效果
准备资料
需准备与小程序同一主体的视频id
源码
微信小程序获取视频号预约直播列表wx.getChannelsLiveNoticeInfo
.js代码
//获取直播列表数据
onLoad: function (options) {
var this_ =this
wx.getChannelsLiveNoticeInfo({
finderUserName: 'sphAAAAAAAAA', // 视频号id
success: function(res) {
//将获取到的数据拼装成列表方便wxml中使用
var live_course = this_.data.live_course_sph
live_course.push(res)
live_course = live_course.concat(res.otherInfos)
const field = 'startTime';
// 按直播时间排序
live_course.sort((a, b) => b[field] - a[field]);
for(var index in live_course){
const date = new Date(live_course[index