diff --git a/pages/home/index.vue b/pages/home/index.vue index d8d5bdb..02c5256 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -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)