hejianhao
2026-08-28 e9d68d1928d5d308228be93009e8e933427e041c
fix0806: 没有版本更新需要展示标签
2个文件已修改
50 ■■■■■ 已修改文件
traditionalApp/pages/mine/mine.vue 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/utils/app-version.js 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/pages/mine/mine.vue
@@ -40,7 +40,14 @@
                    <view class="list-left">
                        <image class="list-icon" :class="item.iconClass" :src="item.icon" mode="aspectFit"></image>
                        <text class="list-title">{{ item.title }}</text>
                        <view v-if="item.action === 'app-update' && hasAppUpdate" class="update-dot"></view>
                    </view>
                    <u-icon name="arrow-right" color="#999" size="16"></u-icon>
                </view>
                <view class="list-item" @tap="handleAppUpdateClick">
                    <view class="list-left">
                        <image class="list-icon icon-update" src="/static/image/mine/refish.png" mode="aspectFit"></image>
                        <text class="list-title">更新版本</text>
                        <view v-if="hasAppUpdate" class="update-dot"></view>
                    </view>
                    <u-icon name="arrow-right" color="#999" size="16"></u-icon>
                </view>
@@ -96,7 +103,6 @@
    url: string
    iconClass?: string
    requiresLogin?: boolean
    action?: 'app-update'
}
interface NoticeSummaryItem {
@@ -164,7 +170,6 @@
        { title: '我的课程', icon: '/static/image/mine/myClass.png', url: '/pages/myCourses/myCourses', iconClass: 'icon-myclass', requiresLogin: true },
        { title: '帮助中心', icon: '/static/image/mine/help.png', url: '/pages/helpCenter/helpCenter', iconClass: 'icon-help' },
        { title: '意见反馈', icon: '/static/image/mine/message.png', url: '/pages/feedback/feedback', iconClass: 'icon-feedback' },
        { title: '更新版本', icon: '/static/image/mine/refish.png', url: '', iconClass: 'icon-update', action: 'app-update' as const },
    ]
    const liveOrderItem = { title: '直播订单', icon: '/static/image/mine/dingdan.png', url: buildWebviewUrl(WEIZAN_LIVE_ORDER_URL, '直播订单'), iconClass: 'icon-live-order', requiresLogin: true }
    const liveStatsList = Number(userCenter.value.type) === 1
@@ -403,18 +408,20 @@
}
/**
 * 更新版本使用统一弹窗,其余菜单保持原跳转行为。
 * 处理底部普通菜单跳转。
 */
async function handleBottomMenuClick(item: MenuItem) {
    if (item.action !== 'app-update') {
        goPage(item)
        return
    }
/**
 * 有新版本时展示更新弹窗,无更新时保持静默。
 */
async function handleAppUpdateClick() {
    if (!appUpdateInfo.value) {
        await loadAppUpdateStatus()
    }
    if (!appUpdateInfo.value) {
        uni.showToast({ title: '当前已是最新版本', icon: 'none' })
        return
    }
    promptAppVersionUpdate(appUpdateInfo.value)
traditionalApp/utils/app-version.js
@@ -49,15 +49,18 @@
            versionName: ''
        }
        if (typeof plus === 'undefined' || !plus.runtime || typeof plus.runtime.getProperty !== 'function') {
            console.log('[APP版本] 系统版本信息', fallbackInfo)
            resolve(fallbackInfo)
            return
        }
        plus.runtime.getProperty(plus.runtime.appid, (info) => {
            resolve({
            const runtimeInfo = {
                platform: resolvePlatform(),
                versionCode: normalizeVersionCode(info && info.versionCode),
                versionName: normalizeText(info && info.version)
            })
            }
            console.log('[APP版本] 系统版本信息', runtimeInfo)
            resolve(runtimeInfo)
        })
    })
}
@@ -96,6 +99,7 @@
                'content-type': 'application/json'
            },
            success: (res) => {
                console.log('[APP版本] 后台接口数据', JSON.stringify(res.data || {}))
                resolve(res.data || {})
            },
            fail: reject
@@ -168,16 +172,35 @@
        plus.runtime.openURL(downloadUrl)
        return
    }
    let lastProgress = -1
    const downloadWaiting = plus.nativeUI.showWaiting('正在下载 0%', {
        modal: true,
        back: 'none'
    })
    const downloadTask = plus.downloader.createDownload(downloadUrl, {}, (download, status) => {
        downloadWaiting.close()
        if (status !== 200 || !download.filename) {
            handleUpdateFailure('安装包下载失败,请重试')
            return
        }
        const apkPath = plus.io.convertLocalFileSystemURL(download.filename)
        plus.runtime.install(apkPath, {}, undefined, () => {
        plus.runtime.install(apkPath, {}, () => {
        }, () => {
            handleUpdateFailure('安装失败,请重试')
        })
    })
    downloadTask.addEventListener('statechanged', (download) => {
        const totalSize = Number(download.totalSize || 0)
        if (totalSize <= 0) {
            return
        }
        const progress = Math.min(100, Math.floor(Number(download.downloadedSize || 0) * 100 / totalSize))
        if (progress === lastProgress) {
            return
        }
        lastProgress = progress
        downloadWaiting.setTitle(`正在下载 ${progress}%`)
    })
    downloadTask.start()
}