This commit is contained in:
2025-11-07 16:22:28 +08:00
8 changed files with 3626 additions and 2359 deletions

256
App.vue
View File

@@ -25,135 +25,135 @@ App.vue本身不是页面这里不能编写视图元素也就是没有<tem
uni.hideTabBar()
//#ifdef APP-PLUS
//获取当前系统版本信息
plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
//请求后台接口 解析数据 对比版本
console.log("widgetInfo==",widgetInfo)
getFindBySource({source:'点餐宝'}).then(res => {
if (res.url && widgetInfo.version < res.version) {
let downloadLink = res.url;
console.log(downloadLink)
let ready = false;
// 校验是否强制升级
if (res.isUp == 1) {
uni.showModal({
showCancel: false,
title: '发现新版本',
confirmText: '立即更新',
content: res.message,
success: res => {
if (res.confirm) {
uni.showLoading({title:'下载中...'});
if (uni.getSystemInfoSync().platform ==
'android') {
uni.hideLoading()
uni.downloadFile({
url: downloadLink,
success: downloadResult => {
uni.hideLoading()
if (downloadResult.statusCode === 200) {
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
entry.getParent(_oldFile=>{
entry.moveTo(_oldFile,'.apk',newFilePath=>{
console.log('newFilePath',newFilePath.fullPath)
plus.runtime
.install(newFilePath.fullPath, { force: false },
d => {
console
.log(
'install success...'
);
plus.runtime
.restart();
},
e => {
console.log(e)
console
.error(
'install fail...'
);
}
);
})
})
})
}
}
});
}
if (uni.getSystemInfoSync().platform ==
'ios') {
plus.runtime.openURL(downloadLink, function(
res) {});
}
} else if (res.cancel) {
console.log('取消');
}
}
});
} else {
uni.showModal({
title: '发现新版本',
confirmText: '立即更新',
cancelText: '下次更新',
content: res.message,
success: res => {
if (res.confirm) {
uni.showLoading({title:'下载中...'});
if (uni.getSystemInfoSync().platform ==
'android') {
uni.downloadFile({
url: downloadLink,
success: downloadResult => {
if (downloadResult
.statusCode ===
200) {
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
entry.getParent(_oldFile=>{
entry.moveTo(_oldFile,'.apk',newFilePath=>{
console.log('newFilePath',newFilePath.fullPath)
plus.runtime
.install(newFilePath.fullPath, { force: false },
d => {
console
.log(
'install success...'
);
plus.runtime
.restart();
},
e => {
console.log(e)
console
.error(
'install fail...'
);
}
);
})
})
})
// plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
// //请求后台接口 解析数据 对比版本
// console.log("widgetInfo==",widgetInfo)
// getFindBySource({source:'点餐宝'}).then(res => {
// if (res.url && widgetInfo.version < res.version) {
// let downloadLink = res.url;
// console.log(downloadLink)
// let ready = false;
// // 校验是否强制升级
// if (res.isUp == 1) {
// uni.showModal({
// showCancel: false,
// title: '发现新版本',
// confirmText: '立即更新',
// content: res.message,
// success: res => {
// if (res.confirm) {
// uni.showLoading({title:'下载中...'});
// if (uni.getSystemInfoSync().platform ==
// 'android') {
// uni.hideLoading()
// uni.downloadFile({
// url: downloadLink,
// success: downloadResult => {
// uni.hideLoading()
// if (downloadResult.statusCode === 200) {
// plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
// entry.getParent(_oldFile=>{
// entry.moveTo(_oldFile,'.apk',newFilePath=>{
// console.log('newFilePath',newFilePath.fullPath)
// plus.runtime
// .install(newFilePath.fullPath, { force: false },
// d => {
// console
// .log(
// 'install success...'
// );
// plus.runtime
// .restart();
// },
// e => {
// console.log(e)
// console
// .error(
// 'install fail...'
// );
// }
// );
// })
// })
// })
// }
// }
// });
// }
// if (uni.getSystemInfoSync().platform ==
// 'ios') {
// plus.runtime.openURL(downloadLink, function(
// res) {});
// }
// } else if (res.cancel) {
// console.log('取消');
// }
// }
// });
// } else {
// uni.showModal({
// title: '发现新版本',
// confirmText: '立即更新',
// cancelText: '下次更新',
// content: res.message,
// success: res => {
// if (res.confirm) {
// uni.showLoading({title:'下载中...'});
// if (uni.getSystemInfoSync().platform ==
// 'android') {
// uni.downloadFile({
// url: downloadLink,
// success: downloadResult => {
// if (downloadResult
// .statusCode ===
// 200) {
// plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
// entry.getParent(_oldFile=>{
// entry.moveTo(_oldFile,'.apk',newFilePath=>{
// console.log('newFilePath',newFilePath.fullPath)
// plus.runtime
// .install(newFilePath.fullPath, { force: false },
// d => {
// console
// .log(
// 'install success...'
// );
// plus.runtime
// .restart();
// },
// e => {
// console.log(e)
// console
// .error(
// 'install fail...'
// );
// }
// );
// })
// })
// })
}
}
});
}
if (uni.getSystemInfoSync().platform ==
'ios') {
plus.runtime.openURL(downloadLink, function(
res) {});
}
} else if (res.cancel) {
uni.hideLoading()
console.log('取消');
}
}
});
}
}
}).catch((res)=>{
console.log(res)
})
});
// }
// }
// });
// }
// if (uni.getSystemInfoSync().platform ==
// 'ios') {
// plus.runtime.openURL(downloadLink, function(
// res) {});
// }
// } else if (res.cancel) {
// uni.hideLoading()
// console.log('取消');
// }
// }
// });
// }
// }
// }).catch((res)=>{
// console.log(res)
// })
// });
// #endif