弹窗判断

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

@ -10,7 +10,7 @@
</view> -->
</view>
<template v-if="datas.setindexdata==1">
<template v-if="datas.isExamine">
<view class="gongao">
<view class="gongaoicon">
公告
@ -42,18 +42,18 @@
</view>
</view>
<contentlist :list='datas.list'></contentlist>
<image v-if="datas.setindexdata==1" @click="goMsg()" src="@/static/index/red-pack-new.gif"
<image v-if="datas.isExamine" @click="goMsg()" src="@/static/index/red-pack-new.gif"
style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;" mode=""></image>
<up-modal :show="datas.version.show" :confirm-text="datas.version.confirmText"
:showCancelButton="datas.version.cancelText!=''" @confirm='confirmUpdateVersion' :title="datas.version.title"
:title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)" @cancel="datas.version.show = false">
:showCancelButton="datas.version.cancelText!=''" @cancel="cancelUpdateVersion" @confirm='confirmUpdateVersion' :title="datas.version.title"
:title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)">
<view class="" style="padding-top: 30rpx;text-align: left;">
<scroll-view scroll-y="true" style="max-height: 50vh;">
<rich-text style="color:#666" :nodes="datas.version.content"></rich-text>
</scroll-view>
</view>
</up-modal>
<up-modal :show="datas.ruleShow" v-if="$common.isIosExamine&&!datas.version.show" confirm-text="知道了" title="规则说明"
<up-modal :show="datas.ruleShow" v-if="datas.isExamine&&!datas.version.show" confirm-text="知道了" title="规则说明"
:title="datas.rule_title" :title-style="{fontWeight:'700'}" @confirm="ruleConfirm"
confirm-color="rgb(255, 117, 129)">
<view class="u-p-30 u-text-left">
@ -97,11 +97,12 @@
// console.log('cash:' + uni.getStorageSync('userInfo').userId + "" + new Date().getTime(), 'debug')
// ios
$common.init()
let sysInfo = uni.getSystemInfoSync()
let isIos = sysInfo.platform == 'ios'
if (isIos) {
datas.setindexdata = $common.isIosExamine
}
// let sysInfo = uni.getSystemInfoSync()
// let isIos = sysInfo.platform == 'ios'
// if (isIos) {
// datas.setindexdata = $common.setversion
// console.log(datas.setindexdata,'seaeasdas')
// }
})
let datas = reactive({
noticeList: [], //
@ -125,13 +126,12 @@
cancelText: "",
downloadLink: ""
},
setindexdata :"false"
setindexdata :false
})
onLoad(() => {
versionUpdate()
getMsg()
getrecomVideo()
datas.isExamine = $common.isIosExamine || 0
})
onReady(() => {
if (!uni.getStorageSync('ruleShow')) {
@ -169,10 +169,12 @@
version = res.iosVersion
}
let isVersion = await $common.setversion(widgetInfo.version, version)
datas.isExamine = $common.isIosExamine
console.log(isVersion,'')
if ( isVersion == 1 ) {
datas.version.downloadLink = res.androidWgtUrl;
datas.version.show = true;
datas.version.title = "发现新版本";
datas.version.title = "发现新版本";
datas.version.content = res.des;
uni.hideTabBar()
if (res.method == "true") {
@ -187,7 +189,10 @@
});
//#endif
}
function cancelUpdateVersion () {
uni.showTabBar()
datas.version.show = false
}
function confirmUpdateVersion() {
// plus.runtime.openURL(config.baseUrl + '/pages/login/appEq')
linkTo('/pages/login/download')

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