Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 素质测评合并
This commit is contained in:
@@ -701,9 +701,43 @@ const handleServiceClick = (serviceType) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 处理直播按钮点击
|
||||
// 处理直播按钮点击 - 跳转微信视频号
|
||||
const handleLiveClick = () => {
|
||||
$api.msg('该功能正在开发中');
|
||||
// #ifdef MP-WEIXIN
|
||||
const feedId = 'sphKH1AEeLfTJJE';
|
||||
|
||||
// 使用微信原生 API 打开视频号直播
|
||||
if (typeof wx !== 'undefined' && wx.openChannelsUserProfile) {
|
||||
wx.openChannelsUserProfile({
|
||||
// feedId: feedId,
|
||||
finderUserName: feedId, // 视频号 finderUserName,如果feedId足够可以留空
|
||||
success: (res) => {
|
||||
console.log('打开视频号成功', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('打开视频号失败', err);
|
||||
$api.msg(err.errMsg || '无法打开直播,请稍后重试');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 如果 API 不存在,尝试使用 uni API
|
||||
uni.openChannelsLive({
|
||||
feedId: feedId,
|
||||
success: (res) => {
|
||||
console.log('打开视频号成功', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('打开视频号失败', err);
|
||||
$api.msg('无法打开直播,请检查微信版本或稍后重试');
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
// 非微信小程序环境提示
|
||||
$api.msg('该功能仅在微信小程序中可用');
|
||||
// #endif
|
||||
};
|
||||
|
||||
// 跳转到测试页面
|
||||
|
||||
Reference in New Issue
Block a user