feat: add article demo videos and category counts

This commit is contained in:
王鹏
2026-08-17 15:50:17 +08:00
parent cf40df23f4
commit 6d847bdd86
5 changed files with 155 additions and 20 deletions

View File

@@ -102,14 +102,11 @@
<!-- <view class="cover-quest">
提交问题
</view> -->
<view @click="showToast()" class="cover-list-btn">
<view class="cover-list-icon">
<image class="ui-img" src="https://img.yidaima.cn/feast/dianzan.svg"
mode="aspectFit">
</image>
</view>
<view class="cover-list-font">点赞</view>
<view @click="openChannelsVideo()" class="cover-list-btn">
<view class="cover-list-icon channels-video-icon cuIcon-videofill"></view>
<view class="cover-list-font">观看视频</view>
</view>
<!-- 点赞入口暂时隐藏保留 showToast 方法便于后续恢复 -->
<view v-if="blogInfo.appResourceId" @click="download()">
<view class="cover-list-icon">
@@ -370,6 +367,64 @@
})
})
},
openChannelsVideo() {
const feedIds = [
this.blogInfo && this.blogInfo.videoFeedId,
this.blogInfo && this.blogInfo.videoFeedId2
].map(function(item) {
return item ? String(item).trim() : ''
}).filter(function(item) {
return !!item
})
if (!feedIds.length) {
uni.showModal({
title: '温馨提示',
content: '暂无演示视频',
showCancel: false
})
return
}
if (feedIds.length === 1) {
this.launchChannelsVideo(feedIds[0])
return
}
const that = this
uni.showActionSheet({
itemList: ['演示视频一', '演示视频二'],
success: function(result) {
that.launchChannelsVideo(feedIds[result.tapIndex])
}
})
},
launchChannelsVideo(feedId) {
// #ifdef MP-WEIXIN
if (typeof wx === 'undefined' || !wx.openChannelsActivity) {
uni.showToast({
title: '当前微信版本暂不支持,请升级微信',
icon: 'none'
})
return
}
wx.openChannelsActivity({
finderUserName: config.channelsVideo.finderUserName,
feedId: feedId,
fail: function(error) {
console.error('打开视频号视频失败', error)
uni.showToast({
title: '视频打开失败,请稍后重试',
icon: 'none'
})
}
})
return
// #endif
// #ifndef MP-WEIXIN
uni.showToast({
title: '请在微信小程序中观看视频',
icon: 'none'
})
// #endif
},
download() {
const id = this.blogInfo && this.blogInfo.appResourceId
if (!id) {
@@ -710,6 +765,13 @@
line-height: unset;
}
.channels-video-icon {
color: #6d52f5;
font-size: 56upx;
line-height: 64upx;
text-align: center;
}
button::after {
border: none;
}