feat: 版本更新、列表记录数量取值、
This commit is contained in:
+20
-1
@@ -256,6 +256,20 @@ export const downloadAndOpenApk = async (url, { progress } = {}) => {
|
||||
}
|
||||
try {
|
||||
const tempFilePath = await downloadFileWithProgress(url, { progress, stageText: '下载中...' })
|
||||
const isAppPlus = typeof plus !== 'undefined' && !!plus?.runtime?.install
|
||||
if (isAppPlus) {
|
||||
if (progress?.set) progress.set(100, '安装中...')
|
||||
await new Promise((resolve, reject) => {
|
||||
plus.runtime.install(
|
||||
tempFilePath,
|
||||
{},
|
||||
() => resolve(),
|
||||
(e) => reject(e),
|
||||
)
|
||||
})
|
||||
if (progress?.hide) progress.hide()
|
||||
return
|
||||
}
|
||||
if (progress?.hide) progress.hide()
|
||||
uni.showToast({ title: '下载成功', icon: 'success' })
|
||||
uni.saveFile({
|
||||
@@ -266,7 +280,12 @@ export const downloadAndOpenApk = async (url, { progress } = {}) => {
|
||||
})
|
||||
} catch (e) {
|
||||
if (progress?.hide) progress.hide()
|
||||
uni.showToast({ title: '下载失败,请检查网络', icon: 'none' })
|
||||
uni.showModal({
|
||||
title: '失败提示',
|
||||
content: String(e?.message || e?.code || e || '安装失败'),
|
||||
showCancel: false,
|
||||
confirmColor: 'var(--color2)',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user