安卓自动下载fix

dev
jevononlie 5 months ago
parent c3606ff5f2
commit 656d6eeaff

@ -16,7 +16,7 @@ onLaunch(async () => {
appId: 'com.chanko.yunxi.mes.android' appId: 'com.chanko.yunxi.mes.android'
} }
const res = await appUpdateApi(params) const res = await appUpdateApi(params)
console.log('1-0', res.versionId) console.log('1-0', res,res.versionId)
plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) { plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {
const version = wgtinfo.version || plus.runtime.version const version = wgtinfo.version || plus.runtime.version
console.log('1-1', res.versionId,version) console.log('1-1', res.versionId,version)
@ -26,9 +26,10 @@ onLaunch(async () => {
showCancel: false, showCancel: false,
confirmText: '立即更新', confirmText: '立即更新',
content: res.remark || 'APP有新版本发布点击 立即更新 进行最新版本下载。', content: res.remark || 'APP有新版本发布点击 立即更新 进行最新版本下载。',
success: (res) => { success: (res2) => {
if (res.confirm) { if (res2.confirm) {
onSureClick(res.url) console.log(999,res.url)
plus.runtime.openURL(res.url)
} }
} }
}) })
@ -44,30 +45,6 @@ onShow(async () => {
onHide(() => { onHide(() => {
console.log('App Hide') console.log('App Hide')
}) })
const onSureClick = (upDataUrl) => {
var downloadTask = uni.downloadFile({
url: upDataUrl,
success: (downloadResult) => {
if (downloadResult.statusCode === 200) {
plus.runtime.install(downloadResult.tempFilePath, {
force: false
}, function () {
plus.runtime.restart();
}, (e) => {
console.log(e)
uni.showToast({
title: '安装升级包失败',
icon: 'none'
})
});
}
}
});
//
downloadTask.onProgressUpdate((e) => {
//
})
}
</script> </script>
<style lang="scss"> <style lang="scss">

@ -7,5 +7,5 @@
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
// export const serviceDomain = 'https://nxhs.cjyx.cc' // export const serviceDomain = 'https://nxhs.cjyx.cc'
export const serviceDomain = 'http://222.71.165.187:9021' export const serviceDomain = 'http://192.168.0.86:9021'

Loading…
Cancel
Save