Fix:5249 【商城小程序】抽奖海报弹窗设置:每次进入小程序时弹窗。当前效果:切换页面回到首页就会弹窗(过于频繁

This commit is contained in:
LinCyJang
2026-05-13 01:02:31 +08:00
parent d0cff1e562
commit 933c6a3628
+19 -2
View File
@@ -872,18 +872,35 @@ export default {
changeOldPopup(state) {
this.isOldUser = state
},
hasShownDrawPosterInSession() {
const app = getApp && getApp()
return Boolean(app && app.globalData && app.globalData.homeDrawPosterShownInSession)
},
markDrawPosterShownInSession() {
const app = getApp && getApp()
if (!app) return
if (!app.globalData) {
app.globalData = {}
}
app.globalData.homeDrawPosterShownInSession = true
},
initPosterPopupState(data = {}) {
const drawEntranceConfig = data.drawEntranceConfig || {}
this.$set(this, 'drawEntranceConfig', drawEntranceConfig)
const hasDrawPoster = Number(drawEntranceConfig.homePosterEnable) === 1
const hasShownDrawPosterInSession = this.hasShownDrawPosterInSession()
const shouldShowDrawPoster = hasDrawPoster && !hasShownDrawPosterInSession
if (shouldShowDrawPoster) {
this.markDrawPosterShownInSession()
}
this.canShowOldPoster = Boolean(
(data.isOldUserPopupShow || 0) &&
data.oldUserPopup &&
data.oldUserPopup.image &&
(data.lotteryCanDraw || false)
)
this.isDrawPosterVisible = hasDrawPoster
this.isOldUser = !hasDrawPoster && this.canShowOldPoster
this.isDrawPosterVisible = shouldShowDrawPoster
this.isOldUser = !shouldShowDrawPoster && !hasShownDrawPosterInSession && this.canShowOldPoster
},
showNextPoster() {
if (!this.isDrawPosterVisible && this.canShowOldPoster) {