Fix:5145 【商城小程序】首页海报状态未实时更新,需重启小程序才生效

This commit is contained in:
linxi
2026-04-13 18:41:39 +08:00
parent 2f5bb204bb
commit 9cbf35d693
+52
View File
@@ -429,6 +429,7 @@ export default {
mixins: [pageListenMixins, goCartMixin, GuideMixins],
data() {
return {
isFirstLoad: true,
isOldUserPopupShow: 0,
webUrl: this.$VUE_APP_RESOURCES_URL,
// 状态栏高度
@@ -514,6 +515,10 @@ export default {
onShow() {
this.pageToShowHandle()
uni.$emit('updateUnreadMessageCount')
if (!this.isFirstLoad) {
this.refreshPageData()
}
this.isFirstLoad = false
},
onHide() {
this.pageToHideHandle()
@@ -1495,6 +1500,53 @@ export default {
uni.hideLoading()
})
},
refreshPageData() {
getHomeData({ cityName: this.cityName }).then(res => {
const { success, data } = res
if (success && data) {
this.$set(this, 'banner', data.banner || [])
this.$set(this, 'menus', data.menus || [])
this.$set(this, 'landmarkGoodsImage', data.landmarkGoodsImage || {})
this.$set(this, 'countyFamousImage', data.countyFamousImage || {})
this.$set(this, 'oldUserPopup', data.oldUserPopup || {})
this.$set(this, 'contentHomestay', data.contentHomestayV2 || [])
this.$set(this, 'contentFestival', data.contentFestivalV2 || [])
this.$set(this, 'newZone', data.newGoods || [])
this.$set(this, 'hasExperienceCoupon', data.hasExperienceCoupon || 0)
this.$set(this, 'hasUnusedExperienceCoupon', data.hasUnusedExperienceCoupon || 0)
this.$set(this, 'experienceCouponImage', data.experienceCouponImage || '')
this.$set(this, 'isOldUserPopupShow', data.isOldUserPopupShow || 0)
this.indexVideo = data.indexVideo ? data.indexVideo.videoUrl : ''
this.lotteryCanDraw = data.lotteryCanDraw || false
if (data.bastList) {
const newBastLeftList = []
const newBastRightList = []
for (let i = 0; i < data.bastList.length; i++) {
if (i % 2 === 0) {
if (i === 4 && data.hotelList.length > 0) {
newBastLeftList.push({
type: 'hotel',
list: data.hotelList
})
}
newBastLeftList.push(data.bastList[i])
}
if (i % 2 === 1) {
if (i === 3 && data.contentBest.length > 0) {
newBastRightList.push({
type: 'swiper',
list: data.contentBest
})
}
newBastRightList.push(data.bastList[i])
}
}
this.bastLeftList = newBastLeftList
this.bastRightList = newBastRightList
}
}
}).catch(() => {})
},
goRoll(item) {
if (item.uniapp_url) {
this.$yrouter.push(item.uniapp_url)