提交判断版本号
This commit is contained in:
parent
18549d562f
commit
1674a62fec
|
|
@ -70,11 +70,26 @@ export const useCommonStore = defineStore("common", {
|
|||
// a是當前應用的版本號 b是接口拿的
|
||||
let appversion = (a.split('.').join('')) * 1
|
||||
let resversion = (b.split('.').join('')) * 1
|
||||
console.log('當前版本-' + appversion, '接口版本-' + resversion, '返回-' + this.isIosExamine,'判斷值-'+this.isExamines)
|
||||
console.log('當前版本-' + appversion, '接口版本-' + resversion, '返回-' + this.isIosExamine, '判斷值-' + this
|
||||
.isExamines)
|
||||
if (appversion > resversion) {
|
||||
// 再審核
|
||||
this.isExamines = 1
|
||||
}
|
||||
},
|
||||
// 判断版本号
|
||||
compare(version1, version2) {
|
||||
let arr1 = version1.split(".");
|
||||
let arr2 = version2.split(".");
|
||||
let length = Math.max(arr1.length, arr2.length);
|
||||
for (let i = 0; i < length; i++) {
|
||||
const n1 = Number(arr1[i] || 0)
|
||||
const n2 = Number(arr2[i] || 0)
|
||||
// version1 > version2 返回1,如果 version1 < version2 返回-1,不然返回0
|
||||
if (n1 > n2) return 1
|
||||
if (n1 < n2) return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue