From 8118d5877c01f31441b1e4e33b09548ea6f7b442 Mon Sep 17 00:00:00 2001 From: daihh Date: Fri, 23 Dec 2022 15:08:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E5=87=BA=E7=AA=97=E5=8F=A3=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AlertPopup.vue | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/AlertPopup.vue b/src/components/AlertPopup.vue index ab14d5d0..01ce2042 100644 --- a/src/components/AlertPopup.vue +++ b/src/components/AlertPopup.vue @@ -29,6 +29,7 @@ baseUrl:process.env.VUE_APP_FILE_BASE_URL, popupList:[],//需要弹出的窗口 sessionKey:'alertpopup', + localTimesKey:'popuptimes' }; }, mounted() { @@ -84,12 +85,25 @@ }, methods:{ countPopup(){ - // let newLogin = localStorage.getItem(this.$xpage.constants.newLoginKey); - // this.popupList.forEach(item=>{ - // if(item.loginEd && newLogin && newLogin==1){ + //let newLogin = localStorage.getItem(this.$xpage.constants.newLoginKey); + this.popupList.forEach(item=>{ + //次数检查 + if(item.times>0){ + var localKey=this.localTimesKey+item.id; + var curLocal=localStorage.getItem(localKey); + if(curLocal){ + let times=parseInt(curLocal); + if(item.times< times){ + item.show=false; + }else{ + localStorage.setItem(localKey,curLocal+1); + } + }else{ + localStorage.setItem(localKey,1); + } - // } - // }) + } + }) } } }