fix
13404089107
2026-04-24 837ac8b9b3abdb91012b060cee4842af12532fb2
fix
3个文件已修改
222 ■■■■■ 已修改文件
traditionalApp/pages/courseDetail/courseDetail.vue 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/pages/liveDetail/liveDetail.vue 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/pages/watchLive/watchLive.vue 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/pages/courseDetail/courseDetail.vue
@@ -227,7 +227,7 @@
                    <image class="icon-img icon-love" :src="favoriteIcon" mode="aspectFit"></image>
                    <text class="icon-text">收藏</text>
                </view>
                <view class="action-icon-item">
                <view class="action-icon-item" @tap="shareToWechatSession">
                    <image class="icon-img icon-share" src="/static/image/healthCourses/share.png" mode="aspectFit"></image>
                    <text class="icon-text">分享</text>
                </view>
@@ -271,6 +271,7 @@
                </view>
            </view>
        </u-popup>
    </view>
</template>
@@ -771,6 +772,70 @@
    }
    uni.makePhoneCall({
        phoneNumber: servicePhone,
    })
}
/**
 * 生成课程分享文案,优先带上标题和摘要。
 */
function buildCourseShareText() {
    const title = courseDetail.value.title.trim() || '养生课程'
    const summary = courseDetail.value.summary.trim()
    return summary ? `给你推荐一个课程:${title}。${summary}` : `给你推荐一个课程:${title}`
}
/**
 * 通过微信好友聊天场景分享当前课程。
 */
function shareToWechatSession() {
    // #ifdef APP-PLUS
    plus.share.getServices((services) => {
        const weixinService = services.find((service) => service.id === 'weixin')
        if (!weixinService) {
            uni.showToast({
                title: '当前环境不支持微信分享',
                icon: 'none',
            })
            return
        }
        if (!weixinService.nativeClient) {
            uni.showToast({
                title: '请先安装微信客户端',
                icon: 'none',
            })
            return
        }
        weixinService.send({
            type: 'text',
            content: buildCourseShareText(),
            extra: {
                scene: 'WXSceneSession',
            },
        }, () => {
            uni.showToast({
                title: '分享成功',
                icon: 'success',
            })
        }, (error) => {
            console.log('课程分享失败', error)
            uni.showToast({
                title: error?.message || '分享失败',
                icon: 'none',
            })
        })
    }, (error) => {
        console.log('获取微信分享服务失败', error)
        uni.showToast({
            title: '微信分享不可用',
            icon: 'none',
        })
    })
    return
    // #endif
    uni.showToast({
        title: '请在App中使用微信分享',
        icon: 'none',
    })
}
@@ -1542,4 +1607,5 @@
    background-color: #E5E6EB;
    color: #86909C;
}
</style>
traditionalApp/pages/liveDetail/liveDetail.vue
@@ -3,7 +3,7 @@
        <view class="nav-bar">
            <image class="back-icon" src="/static/image/home/left.png" mode="aspectFit" @tap="goBack"></image>
            <text class="nav-title">{{ navTitle }}</text>
            <image class="share-icon" src="/static/image/home/share.png" mode="aspectFit"></image>
            <image class="share-icon" src="/static/image/home/share.png" mode="aspectFit" @tap="shareToWechatSession"></image>
        </view>
        <view class="media-section">
@@ -332,6 +332,70 @@
    }
    /**
     * 生成直播详情分享文案,优先带上标题与适用人群。
     */
    function buildLiveShareText() {
        const title = liveDetail.value.title?.trim() || '养生直播'
        const targetUsers = liveDetail.value.targetUsers?.trim() || ''
        return targetUsers ? `给你推荐一个直播:${title}。适用人群:${targetUsers}` : `给你推荐一个直播:${title}`
    }
    /**
     * 直接拉起微信好友聊天分享当前直播。
     */
    function shareToWechatSession() {
        // #ifdef APP-PLUS
        plus.share.getServices((services) => {
            const weixinService = services.find((service) => service.id === 'weixin')
            if (!weixinService) {
                uni.showToast({
                    title: '当前环境不支持微信分享',
                    icon: 'none',
                })
                return
            }
            if (!weixinService.nativeClient) {
                uni.showToast({
                    title: '请先安装微信客户端',
                    icon: 'none',
                })
                return
            }
            weixinService.send({
                type: 'text',
                content: buildLiveShareText(),
                extra: {
                    scene: 'WXSceneSession',
                },
            }, () => {
                uni.showToast({
                    title: '分享成功',
                    icon: 'success',
                })
            }, (error) => {
                console.log('直播详情分享失败', error)
                uni.showToast({
                    title: error?.message || '分享失败',
                    icon: 'none',
                })
            })
        }, (error) => {
            console.log('获取微信分享服务失败', error)
            uni.showToast({
                title: '微信分享不可用',
                icon: 'none',
            })
        })
        return
        // #endif
        uni.showToast({
            title: '请在App中使用微信分享',
            icon: 'none',
        })
    }
    /**
     * 处理底部主按钮点击,根据接口状态执行预约或观看。
     */
    async function handlePrimaryAction() {
traditionalApp/pages/watchLive/watchLive.vue
@@ -4,15 +4,16 @@
        <view class="nav-bar">
            <image class="back-icon" src="/static/image/home/left.png" mode="aspectFit" @tap="goBack"></image>
            <text class="nav-title">{{ pageTitle }}</text>
            <image class="share-icon" src="/static/image/home/share.png" mode="aspectFit"></image>
            <image class="share-icon" src="/static/image/home/share.png" mode="aspectFit" @tap="shareToWechatSession"></image>
        </view>
        <!-- 视频区域 -->
        <view class="video-section" :class="{ 'half-height': showAnswer }">
            <view v-if="isVideoPlayable" class="video-player-wrapper" @tap="togglePlayback">
        <view class="video-section" :style="videoSectionStyle">
            <view v-if="isVideoPlayable" class="video-player-wrapper" :style="videoSectionStyle" @tap="togglePlayback">
                <video
                    id="live-watch-player"
                    class="video-player"
                    :style="videoSectionStyle"
                    :src="liveDetail.videoUrl"
                    :poster="videoPoster"
                    :controls="false"
@@ -382,6 +383,9 @@
const pageTitle = computed(() => liveDetail.value.title || '直播观看')
const videoPoster = computed(() => liveDetail.value.displayImage || liveDetail.value.coverImage || defaultVideoPoster)
const videoSectionStyle = computed(() => ({
    height: showAnswer.value ? '500rpx' : '1234rpx',
}))
const showPlaybackRetry = computed(() => {
    if (!isVideoPlayable.value || !isVideoReady.value) {
        return false
@@ -1023,6 +1027,72 @@
}
/**
 * 生成直播观看页分享文案,优先带上标题与观看状态。
 */
function buildWatchLiveShareText() {
    const title = liveDetail.value.title?.trim() || '直播观看'
    if (liveDetail.value.quizPoints) {
        return `给你推荐一个直播:${title}。观看后答题可得${liveDetail.value.quizPoints}积分`
    }
    return `给你推荐一个直播:${title}`
}
/**
 * 直接拉起微信好友聊天分享当前直播。
 */
function shareToWechatSession() {
    // #ifdef APP-PLUS
    plus.share.getServices((services) => {
        const weixinService = services.find((service) => service.id === 'weixin')
        if (!weixinService) {
            uni.showToast({
                title: '当前环境不支持微信分享',
                icon: 'none',
            })
            return
        }
        if (!weixinService.nativeClient) {
            uni.showToast({
                title: '请先安装微信客户端',
                icon: 'none',
            })
            return
        }
        weixinService.send({
            type: 'text',
            content: buildWatchLiveShareText(),
            extra: {
                scene: 'WXSceneSession',
            },
        }, () => {
            uni.showToast({
                title: '分享成功',
                icon: 'success',
            })
        }, (error) => {
            console.log('直播观看分享失败', error)
            uni.showToast({
                title: error?.message || '分享失败',
                icon: 'none',
            })
        })
    }, (error) => {
        console.log('获取微信分享服务失败', error)
        uni.showToast({
            title: '微信分享不可用',
            icon: 'none',
        })
    })
    return
    // #endif
    uni.showToast({
        title: '请在App中使用微信分享',
        icon: 'none',
    })
}
/**
 * 打开答题面板,并在需要时从后端拉取题目与答题状态。
 */
async function openAnswer() {
@@ -1128,10 +1198,11 @@
<style lang="scss" scoped>
.container {
    min-height: 100vh;
    height: 100vh;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.nav-bar {
@@ -1175,14 +1246,10 @@
.video-section {
    width: 100%;
    height: 1234rpx;
    position: relative;
    margin-top: calc(var(--status-bar-height, 0px) + 88rpx);
    transition: height 0.3s ease;
    &.half-height {
        height: 500rpx; /* 缩短高度以展示答题区域 */
    }
    flex-shrink: 0;
    .video-bg {
        width: 100%;
@@ -1284,6 +1351,7 @@
    margin-top: 24rpx;
    padding: 0 40rpx 40rpx 40rpx;
    background-color: #fff;
    flex-shrink: 0;
    .chat-input-wrapper {
        flex: 1;
@@ -1325,8 +1393,10 @@
.answer-area {
    flex: 1;
    height: 0;
    min-height: 0;
    background-color: #fff;
    .answer-container {
        padding-top: 0;
    }