13404089107
2026-04-24 67eab31174665e971ee55ab1dc276e394d0edb43
fix: 修复下载列表点击与本地视频播放路径问题

- 下载列表项外层点击仅在批量模式下触发勾选,避免与滑动操作冲突
- 本地视频路径增加转换逻辑,确保在APP端可正确播放
2个文件已修改
52 ■■■■■ 已修改文件
traditionalApp/pages/downloadPlayer/downloadPlayer.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/pages/downloads/downloads.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/pages/downloadPlayer/downloadPlayer.vue
@@ -95,7 +95,7 @@
const videoSource = computed(() => {
    const savedFilePath = normalizeText(taskInfo.value?.savedFilePath)
    if (savedFilePath) {
        return savedFilePath
        return resolvePlayableVideoSource(savedFilePath)
    }
    return normalizeText(taskInfo.value?.videoUrl)
})
@@ -248,6 +248,36 @@
function normalizeText(value: unknown) {
    return typeof value === 'string' ? value.trim() : ''
}
/**
 * 将本地持久化视频路径转换为 APP 原生 video 可识别的文件地址。
 */
function resolvePlayableVideoSource(savedFilePath: string) {
    const normalizedPath = normalizeText(savedFilePath)
    if (!normalizedPath) {
        return ''
    }
    if (/^(https?:)?\/\//i.test(normalizedPath) || normalizedPath.startsWith('data:') || normalizedPath.startsWith('blob:')) {
        return normalizedPath
    }
    // #ifdef APP-PLUS
    try {
        const absolutePath = plus.io.convertLocalFileSystemURL(normalizedPath)
        if (absolutePath && /^[a-zA-Z]:\\/.test(absolutePath)) {
            return `file:///${absolutePath.replace(/\\/g, '/')}`
        }
        if (absolutePath && absolutePath.startsWith('/')) {
            return `file://${absolutePath}`
        }
        if (absolutePath) {
            return absolutePath
        }
    } catch (error) {
        console.log('本地视频路径转换失败', error)
    }
    // #endif
    return normalizedPath
}
</script>
<style lang="scss" scoped>
traditionalApp/pages/downloads/downloads.vue
@@ -13,7 +13,7 @@
                <text class="empty-text">暂无下载记录</text>
            </view>
            <block v-for="(item, index) in downloadList" :key="item.id">
                <view class="list-item-wrapper" @tap="handleItemClick(index)">
                <view class="list-item-wrapper" @tap="handleListItemWrapperTap(index)">
                    <view class="checkbox-col" v-if="isBatchMode">
                        <image
                            class="check-icon"
@@ -23,7 +23,13 @@
                    </view>
                    <view class="swipe-wrap" :class="{ 'in-batch-mode': isBatchMode }">
                        <u-swipe-action :options="swipeOptions" :index="index" @click="handleDelete(index)" :disabled="isBatchMode">
                        <u-swipe-action
                            :options="swipeOptions"
                            :index="index"
                            @click="handleDelete(index)"
                            @content-click="handleItemClick(index)"
                            :disabled="isBatchMode"
                        >
                            <view class="course-item-container">
                                <view class="course-item">
                                    <view class="img-wrap">
@@ -251,6 +257,16 @@
}
/**
 * 外层点击仅在批量模式下处理勾选,普通模式交由 swipe-action 的内容点击事件处理。
 */
function handleListItemWrapperTap(index: number) {
    if (!isBatchMode.value) {
        return
    }
    handleItemClick(index)
}
/**
 * 解析当前列表项对应的本地可播放任务,远端完成记录也必须匹配本地文件路径后才能播放。
 */
function resolvePlayableDownloadTask(item: DownloadListItem): LocalDownloadTask | null {