diff --git a/src/pages/login/login/index.vue b/src/pages/login/login/index.vue index ce0c4b9..cf835c5 100644 --- a/src/pages/login/login/index.vue +++ b/src/pages/login/login/index.vue @@ -142,7 +142,10 @@ export default class LoginPage extends BasePage { // console.log('Version////', this.Version); } ///********版本号修改区域********** - version = '0.0.60'; + version = '0.0.61';//正式版本号 + //version = '0.0.58';//测试版本号 + //***************标志修改区域:是否是测试标志: false 正式版本; true 测试版本**************** + isTest = false; compareVersion(version1: any, version2: any) { //如果version1 大 会返回1 &&& 如果version2 大 会返回 -1 @@ -171,10 +174,30 @@ export default class LoginPage extends BasePage { async checkupdate() { try { await this.model.checkupdate(); + const fileName = this.model.checkversion.fileName; + const isTestUpdate = fileName.includes('test'); // 检查fileName是否包含'test' const queryversion = this.model.checkversion.version; //const queryversion = this.checkversion.Version.match(/\d+\.\d+\.\d+/)[0]; let versionNumber = this.compareVersion(this.version, queryversion); //this.version, queryversion if (versionNumber == -1) { + //如果 我现在是测试版本test true: 发了一个测试版本更新,isTestUpdate:true走跟新;发了一个正式isTestUpdate:false不走更新 + //如果 我现在是正式版本 test false:发了一个测试版本更新,isTestUpdate:true不走更新;发了一个正式isTestUpdate:false走跟新 + if (isTestUpdate && !this.isTest) { + // 测试版本更新,但当前环境是正式环境,不提示更新 + console.log('Test version update available, but running in production environment.'); + uni.navigateTo({ + url: page.shouye, + }); + return; + } else if (!isTestUpdate && this.isTest) { + // 正式版本更新,但当前环境是测试环境,不提示更新 + console.log('Production version update available, but running in test environment.'); + uni.navigateTo({ + url: page.shouye, + }); + return; + } + // 版本更新提示 uni.showModal({ content: '新版本为:' + this.model.checkversion.version + ',' + '是否更新?',