弹窗判断

This commit is contained in:
duan
2025-01-20 14:32:54 +08:00
parent a60986d0ca
commit 2ba92103f9
2 changed files with 29 additions and 19 deletions

View File

@@ -68,8 +68,8 @@ export const useCommonStore = defineStore("common", {
},
setversion(a, b) {
return new Promise(async (resolve, reject) => {
// console.log('當前版本-' + a, '接口版本-' + b, '判斷值-' + this.isExamines)
this.isExamines = await this.compare(a, b)
console.log('判斷值-' + this.isExamines)
resolve(this.isExamines)
})
},
@@ -82,19 +82,24 @@ export const useCommonStore = defineStore("common", {
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
// 当前版 n1 接口版本是 n2
// 1小于2 更新弹窗、抽奖等显示
if (n1 < n2) return 1
// 1大于2 更新弹窗、抽奖不显示
if (n1 > n2) return -1
}
// 1等于2 更新弹窗不显示‘抽奖显示
return 0
}
},
getters: {
isIosExamine: function () {
isIosExamine: function() {
console.log(this.isExamines)
if (!this.isIos) {
return true
}
if (this.isExamines == 1) {
if (this.isExamines == -1) {
return false
}
return true