chore(电子名片): 支持点击视频号视频,非嵌入模式可以播放了

This commit is contained in:
2026-01-13 11:17:14 +08:00
parent 8ceeca33b4
commit e20968aee2
3 changed files with 31 additions and 54 deletions

View File

@@ -17,7 +17,7 @@ export const wechatChannelConfig = {
maxHeight: 500, // 最大视频高度rpx
defaultCoverUrl: 'addon/personnel/shop/view/enterprise/default-video-cover.png', // 默认视频封面
},
// 播放按钮配置
playButton: {
size: 80, // 标准尺寸rpx
@@ -26,21 +26,21 @@ export const wechatChannelConfig = {
smallIconSize: 30, // 小图标尺寸rpx
background: 'rgba(0, 0, 0, 0.4)', // 背景颜色
},
// 布局配置
layout: {
borderRadius: 12, // 圆角rpx
padding: 16, // 内边距rpx
margin: 10, // 外边距rpx
},
// 字体配置
font: {
channelNameSize: 28, // 频道名称字体大小rpx
videoTitleSize: 28, // 视频标题字体大小rpx
statsSize: 24, // 统计信息字体大小rpx
},
// 颜色配置
color: {
channelName: '#333', // 频道名称颜色
@@ -48,13 +48,13 @@ export const wechatChannelConfig = {
stats: '#999', // 统计信息颜色
border: '#f0f0f0', // 边框颜色
},
// 微信相关配置
wechat: {
minSdkVersion: '2.19.2', // 最小微信基础库版本
embedComponent: 'component.channel-video', // 嵌入式视频组件名称
embedComponent: 'channel-video', // 嵌入式视频组件名称
},
// 错误提示配置
error: {
notWechat: '当前环境不是微信小程序',
@@ -68,14 +68,14 @@ export const wechatChannelConfig = {
export const getwechatChannelConfig = (key, defaultValue = null) => {
const keys = key.split('.');
let config = wechatChannelConfig;
for (const k of keys) {
if (config[k] === undefined) {
return defaultValue;
}
config = config[k];
}
return config;
};
@@ -164,24 +164,14 @@ export const wechatChannelUtil = {
handleError(err, item) {
console.error('微信视频号错误:', err);
let errorMsg = err.errMsg || '视频播放失败';
// 可以添加错误上报或用户提示逻辑
switch (err.errCode) {
case 40001:
errorMsg = '错误40001检查主体要求或嵌入式打开的关联关系';
break;
case 40002:
errorMsg = '错误40002参数错误检查 feedId 和 finderUserName';
break;
default:
break;
let errorMsg = err.errMsg || '微信视频播放失败';
const showErrorToast = (otherMsgs = []) => {
uni.showToast({
title: [errorMsg, ...otherMsgs].join('\n'),
icon: 'none',
duration: 5000
});
}
uni.showToast({
title: [errorMsg, 'feedId: ' + item.feedId, 'finderUserName: ' + item.finderUserName, 'feedToken: ' + item.feedToken].join('\n'),
icon: 'none',
duration: 5000
});
showErrorToast();
}
};