视频号直播 | 微信开放文档
具体配置点击上面的文档查看
组建里面 直接写一个 image图的占位图就行
<view v-if="zbstatus!='未直播'" class="margin-lr padding-bottom" style="position: relative;" @click="gotoZB">
<image
:src="zbimg?zbimg:''"
mode="aspectFill" style="height: 350upx;width: 100%;border-radius: 24rpx;"></image>
<view class="zhibo">
<image src="../../../static/img/tuoyuan.png" style="width: 28upx;height: 28upx;">
</image>
{{zbstatus}}
</view>
</view>
代码检测是
//直播
gotoZB() {
let that = this
if (this.zbstatus == '直播中') {
//跳转到直播
wx.getChannelsLiveInfo({
finderUserName: that.finderUserNames,
success(res) {
// console.log(res, '成功')
wx.openChannelsLive({
finderUserName: that.finderUserNames,
feedId: res.feedId,
nonceId: res.nonceId,
complete(ret) {
}
})
},
fail(err) {
console.log(err, '查询失败')
}
})
} else {
//预约直播
wx.getChannelsLiveNoticeInfo({
finderUserName: that.finderUserNames,
success(res) {
console.log(res, '成功')
wx.reserveChannelsLive({
noticeId: res.noticeId
})
},
fail(err) {
console.log(err, '查询失败')
}
})
}
},