feat(upgrade): 优化版本更新检测流程并添加问题版本修复机制

This commit is contained in:
2025-12-29 18:07:29 +08:00
parent b2bff1ed54
commit ec869f0395
6 changed files with 94 additions and 47 deletions

View File

@@ -14,7 +14,8 @@
>
<text class="label">{{ item.label }}</text>
<view class="value-wrapper">
<text class="value">{{ item.value }}</text>
<wd-loading v-if="item.id === 4 && !isUpdateAvailable" :size="16" color="#cccccc" />
<text v-else class="value">{{ item.value }}</text>
<wd-icon name="arrow-right" size="16px" color="#aaa" />
</view>
</view>
@@ -73,7 +74,7 @@ import { useI18n } from 'vue-i18n'
import { useMessage } from '@/uni_modules/wot-design-uni'
import { makePhoneCall, copyToClipboard } from '@/utils/index'
// #ifdef APP-PLUS
import update from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
import checkUpdate from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
import { getCurrentVersion } from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version'
// #endif
@@ -211,11 +212,13 @@ const selectLanguage = (languageCode: string) => {
/**
* 检查版本更新
*/
const isUpdateAvailable = ref(true)
const checkVersion = async () => {
// #ifdef APP-PLUS
uni.showLoading()
if (!isUpdateAvailable.value) return
isUpdateAvailable.value = false
try {
const info = await update();
const info = await checkUpdate();
if(info.result.code == 0){
uni.showToast({
title:info.result.message,
@@ -223,15 +226,14 @@ const checkVersion = async () => {
})
}
} catch (error: any) {
console.error('版本检测失败:', error)
const msg = error?.hasOwnProperty('message') && error.message
uni.showToast({
title: msg || t('user.checkVersionFailed'),
title: msg || error || t('global.queryFailed'),
icon: 'none',
duration: 5000
})
} finally {
uni.hideLoading()
isUpdateAvailable.value = true
}
// #endif