|
|
@ -142,7 +142,7 @@ export default class LoginPage extends BasePage {
|
|
|
|
// console.log('Version////', this.Version);
|
|
|
|
// console.log('Version////', this.Version);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///********版本号修改区域**********
|
|
|
|
///********版本号修改区域**********
|
|
|
|
version = '0.0.62';//正式版本号
|
|
|
|
version = '0.0.63'; //正式版本号
|
|
|
|
//version = '0.0.2';//测试版本号
|
|
|
|
//version = '0.0.2';//测试版本号
|
|
|
|
//***************标志修改区域:是否是测试标志: false 正式版本; true 测试版本****************
|
|
|
|
//***************标志修改区域:是否是测试标志: false 正式版本; true 测试版本****************
|
|
|
|
//isTest = true;
|
|
|
|
//isTest = true;
|
|
|
@ -174,79 +174,78 @@ export default class LoginPage extends BasePage {
|
|
|
|
async checkupdate() {
|
|
|
|
async checkupdate() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await this.model.checkupdate();
|
|
|
|
await this.model.checkupdate();
|
|
|
|
console.log('3333333',this.model.checkversion)
|
|
|
|
console.log('3333333', this.model.checkversion);
|
|
|
|
if(this.model.checkversion != undefined){
|
|
|
|
if (this.model.checkversion != undefined) {
|
|
|
|
const fileName = this.model.checkversion.fileName;
|
|
|
|
// const fileName = this.model.checkversion.fileName;
|
|
|
|
// const isTestUpdate = fileName.includes('test'); // 检查fileName是否包含'test'
|
|
|
|
// const isTestUpdate = fileName.includes('test'); // 检查fileName是否包含'test'
|
|
|
|
const queryversion = this.model.checkversion.version;
|
|
|
|
const queryversion = this.model.checkversion.version;
|
|
|
|
//const queryversion = this.checkversion.Version.match(/\d+\.\d+\.\d+/)[0];
|
|
|
|
//const queryversion = this.checkversion.Version.match(/\d+\.\d+\.\d+/)[0];
|
|
|
|
let versionNumber = this.compareVersion(this.version, queryversion); //this.version, queryversion
|
|
|
|
let versionNumber = this.compareVersion(this.version, queryversion); //this.version, queryversion
|
|
|
|
if (versionNumber == -1) {
|
|
|
|
if (versionNumber == -1) {
|
|
|
|
//如果 我现在是测试版本test true: 发了一个测试版本更新,isTestUpdate:true走跟新;发了一个正式isTestUpdate:false不走更新
|
|
|
|
//如果 我现在是测试版本test true: 发了一个测试版本更新,isTestUpdate:true走跟新;发了一个正式isTestUpdate:false不走更新
|
|
|
|
//如果 我现在是正式版本 test false:发了一个测试版本更新,isTestUpdate:true不走更新;发了一个正式isTestUpdate:false走跟新
|
|
|
|
//如果 我现在是正式版本 test false:发了一个测试版本更新,isTestUpdate:true不走更新;发了一个正式isTestUpdate:false走跟新
|
|
|
|
// if (isTestUpdate && !this.isTest) {
|
|
|
|
// if (isTestUpdate && !this.isTest) {
|
|
|
|
// // 测试版本更新,但当前环境是正式环境,不提示更新
|
|
|
|
// // 测试版本更新,但当前环境是正式环境,不提示更新
|
|
|
|
// console.log('Test version update available, but running in production environment.');
|
|
|
|
// console.log('Test version update available, but running in production environment.');
|
|
|
|
// uni.navigateTo({
|
|
|
|
// uni.navigateTo({
|
|
|
|
// url: page.shouye,
|
|
|
|
// url: page.shouye,
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// return;
|
|
|
|
// return;
|
|
|
|
// } else if (!isTestUpdate && this.isTest) {
|
|
|
|
// } else if (!isTestUpdate && this.isTest) {
|
|
|
|
// // 正式版本更新,但当前环境是测试环境,不提示更新
|
|
|
|
// // 正式版本更新,但当前环境是测试环境,不提示更新
|
|
|
|
// console.log('Production version update available, but running in test environment.');
|
|
|
|
// console.log('Production version update available, but running in test environment.');
|
|
|
|
// uni.navigateTo({
|
|
|
|
// uni.navigateTo({
|
|
|
|
// url: page.shouye,
|
|
|
|
// url: page.shouye,
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// return;
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// 版本更新提示
|
|
|
|
// 版本更新提示
|
|
|
|
uni.showModal({
|
|
|
|
uni.showModal({
|
|
|
|
content: '新版本为:' + this.model.checkversion.version + ',' + '是否更新?',
|
|
|
|
content: '新版本为:' + this.model.checkversion.version + ',' + '是否更新?',
|
|
|
|
success: (res) => {
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
|
|
|
if (res.confirm) {
|
|
|
|
//确定执行下载
|
|
|
|
//确定执行下载
|
|
|
|
let downloadApkUrl = this.model.checkversion.fileAddress;
|
|
|
|
let downloadApkUrl = this.model.checkversion.fileAddress;
|
|
|
|
uni.showLoading({
|
|
|
|
uni.showLoading({
|
|
|
|
title: '下载中',
|
|
|
|
title: '下载中',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
////////////////uni下载方法,
|
|
|
|
////////////////uni下载方法,
|
|
|
|
uni.downloadFile({
|
|
|
|
uni.downloadFile({
|
|
|
|
url: downloadApkUrl,
|
|
|
|
url: downloadApkUrl,
|
|
|
|
success: (downloadResult) => {
|
|
|
|
success: (downloadResult) => {
|
|
|
|
uni.hideLoading();
|
|
|
|
uni.hideLoading();
|
|
|
|
if (downloadResult.statusCode == 200) {
|
|
|
|
if (downloadResult.statusCode == 200) {
|
|
|
|
//安装更新
|
|
|
|
//安装更新
|
|
|
|
plus.runtime.install(downloadResult.tempFilePath as any, { force: true }, function () {
|
|
|
|
plus.runtime.install(downloadResult.tempFilePath as any, { force: true }, function () {
|
|
|
|
//uni.showToast('更新成功,重启');
|
|
|
|
//uni.showToast('更新成功,重启');
|
|
|
|
plus.runtime.restart();
|
|
|
|
plus.runtime.restart();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (res.cancel) {
|
|
|
|
} else if (res.cancel) {
|
|
|
|
console.log();
|
|
|
|
console.log();
|
|
|
|
uni.navigateTo({
|
|
|
|
uni.navigateTo({
|
|
|
|
url: page.shouye,
|
|
|
|
url: page.shouye,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
|
|
url: page.shouye,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
|
|
|
// title: '无更新内容',
|
|
|
|
|
|
|
|
// icon: 'none',
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
uni.navigateTo({
|
|
|
|
uni.navigateTo({
|
|
|
|
url: page.shouye,
|
|
|
|
url: page.shouye,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// uni.showToast({
|
|
|
|
|
|
|
|
// title: '无更新内容',
|
|
|
|
|
|
|
|
// icon: 'none',
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
|
|
url: page.shouye,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log('error', e);
|
|
|
|
console.log('error', e);
|
|
|
|