From efbe517a92467a111665a62c51cd5f3479e90bd1 Mon Sep 17 00:00:00 2001 From: davy Date: Tue, 8 Apr 2025 11:17:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DmyAttention=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=96=87=E6=9C=AC=E6=88=AA=E6=96=AD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 252 +++++++++++++++++++++---------------- pages/index/myJoin.vue | 12 +- pagesActivity/winelist.vue | 2 +- pagesMy/feedback.vue | 125 ++++++++++++------ static/send-2.svg | 2 +- 5 files changed, 248 insertions(+), 145 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index e616612..ebb4dcb 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -186,36 +186,123 @@ uni.stopPullDownRefresh() }, onShow() { - this.userInfo = uni.getStorageSync('userInfo') - if (this.userInfo == null || this.userInfo.userType == '09') { - this.showJoinImg = true - } else { - this.showJoinImg = false + const newUserInfo = uni.getStorageSync('userInfo') + // 只在用户信息发生变化时更新状态 + if (JSON.stringify(newUserInfo) !== JSON.stringify(this.userInfo)) { + this.userInfo = newUserInfo + this.showJoinImg = !this.userInfo || this.userInfo.userType === '09' + + // 只在用户状态变化时重新加载数据 + this.resetAndLoadData() } - // 重置分页参数 - this.pageNum = 1 - this.finished = false - this.featurePageList = [] - this.getActivityList() // 获取活动列表 - }, - // onPullDownRefresh(){ - // this.getFeaturePageListFun() // 专辑页列表 - // }, - onPullDownRefresh() { - // 禁用页面下拉刷新效果 - uni.stopPullDownRefresh() }, methods: { loginSuccess() { this.userInfo = uni.getStorageSync('userInfo') if (this.userInfo == null || this.userInfo.userType == '09') { // 没登录或者没认证门店 - console.log('登录') + console.log('登录') this.showJoinImg = true - }else { + } else { this.showJoinImg = false } }, + // 重置并加载数据 + resetAndLoadData() { + this.pageNum = 1 + this.finished = false + this.featurePageList = [] + this.getActivityList() + }, + // 获取活动列表 + async getActivityList() { + if (this.loading || this.finished) return + + try { + this.loading = true + const res = await getActivities({ + pageNum: this.pageNum, + pageSize: this.pageSize + }) + + if (res.code === 200) { + const { rows, total } = res + + // 处理数据,计算剩余天数和状态 + const processedRows = this.processActivityData(rows) + + // 更新列表数据 + if (this.pageNum === 1) { + this.featurePageList = processedRows + } else { + this.featurePageList = [...this.featurePageList, ...processedRows] + } + + this.total = total + this.finished = this.featurePageList.length >= total + this.pageNum++ + } + } catch (error) { + console.error('获取活动列表失败:', error) + } finally { + this.loading = false + } + }, + // 处理活动数据 + processActivityData(rows) { + return rows + .map(it => { + // 计算剩余天数 + const targetDate = new Date(it.endDate) + const currentDate = new Date() + const timeDiff = targetDate.getTime() - currentDate.getTime() + const remainingDays = Math.ceil(timeDiff / (1000 * 3600 * 24)) + + // 设置活动状态 + let activityState = 'recruiting' + if (it.activityStatus === 2) { + activityState = 'in_progress' + } else if (it.activityStatus === 3) { + activityState = 'completed' + } + + return { + ...it, + remainingDays, + activityState, + remainingBeerCount: it.remainingBeerCount || 0, + barAwardStatus: it.barAwardStatus || 0 + } + }) + .filter(item => { + if (item.activityState === 'recruiting') { + return item.remainingDays >= 0 + } + return true + }) + }, + // 修改页面加载更多方法 + async changePage() { + if (!this.finished) { + await this.getActivityList() + } + }, + handleActivityClick(item) { + console.log('handleActivityClick called', item) + uni.navigateTo({ + url: "/pagesActivity/activityDetail?id=" + item.id + }) + }, + handlePopupChange(e) { + if (e && e.detail) { + this.currentAdIndex = e.detail.current; + } + }, + handleAdSwiperChange(e) { + if (e && e.detail) { + this.currentAdIndex = e.detail.current; + } + }, toAddAiad() { uni.navigateTo({ url: '/pagesMy/addAiad' @@ -335,90 +422,6 @@ // 实现搜索逻辑 console.log('搜索关键词:', this.keyword); }, - // 获取活动列表 - async getActivityList() { - if (this.loading || this.finished) return - this.loading = true - try { - const res = await getActivities({ - pageNum: this.pageNum, - pageSize: this.pageSize - }) - if (res.code === 200) { - const { rows, total } = res - - // 处理数据,计算剩余天数和状态 - const processedRows = rows.map(it => { - // 计算剩余天数 - const targetDate = new Date(it.endDate); - const currentDate = new Date(); - const timeDiff = targetDate.getTime() - currentDate.getTime(); - const remainingDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); - - // 设置活动状态 - let activityState = 'recruiting'; - if (it.activityStatus === 2) { - activityState = 'in_progress'; - } else if (it.activityStatus === 3) { - activityState = 'completed'; - } - - return { - ...it, - remainingDays, - activityState, - remainingBeerCount: it.remainingBeerCount || 0, - barAwardStatus: it.barAwardStatus || 0 - }; - }); - - // 过滤掉招募剩余天数为负数的活动 - const filteredRows = processedRows.filter(item => { - if (item.activityState === 'recruiting') { - return item.remainingDays >= 0 - } - return true - }); - - if (this.pageNum === 1) { - this.featurePageList = filteredRows; - } else { - this.featurePageList = [...this.featurePageList, ...filteredRows]; - } - this.total = total; - this.finished = this.featurePageList.length >= total; - this.pageNum++; - } - } catch (error) { - console.error('获取活动列表失败:', error) - } finally { - this.loading = false - } - }, - - // 修改页面加载更多方法 - async changePage() { - if (!this.finished) { - await this.getActivityList() - } - }, - // 处理活动项点击 - handleActivityClick(item) { - console.log('handleActivityClick called', item) - uni.navigateTo({ - url: "/pagesActivity/activityDetail?id=" + item.id - }) - }, - handlePopupChange(e) { - if (e && e.detail) { - this.currentAdIndex = e.detail.current; - } - }, - handleAdSwiperChange(e) { - if (e && e.detail) { - this.currentAdIndex = e.detail.current; - } - }, } } @@ -434,6 +437,20 @@ display: flex; flex-direction: column; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Roboto, "Segoe UI", "Microsoft YaHei", sans-serif; + + .join-box { + width: 100%; + height: 562rpx; + background: #f5f5f5; + position: relative; + overflow: hidden; + + .img { + width: 100%; + height: 100%; + object-fit: cover; + } + } } .search-box { @@ -477,13 +494,22 @@ flex: 1; display: flex; flex-direction: column; + min-height: 200rpx; + position: relative; + z-index: 0; scroll-view { flex: 1; } .activity-list { - padding: 0 24rpx; + padding: 0 32rpx; + opacity: 1; + transition: opacity 0.3s ease; + + &.loading { + opacity: 0.6; + } } .more-btn-box { @@ -646,7 +672,15 @@ .bg-white { background: #FFFFFF; - // box-shadow: 0rpx 1rpx 3rpx 0rpx rgba(0, 0, 0, 0.1); + border-radius: 30rpx 30rpx 12rpx 12rpx; + padding-top: 8rpx; + position: relative; + transform: translateY(-20rpx); + z-index: 1; + + .search-box { + margin: 24rpx 32rpx; + } } .activity-item { @@ -811,4 +845,12 @@ } } } + + // 添加过渡效果 + .fade-enter-active, .fade-leave-active { + transition: opacity 0.3s ease; + } + .fade-enter, .fade-leave-to { + opacity: 0; + } \ No newline at end of file diff --git a/pages/index/myJoin.vue b/pages/index/myJoin.vue index 8538185..10589f9 100644 --- a/pages/index/myJoin.vue +++ b/pages/index/myJoin.vue @@ -24,7 +24,7 @@ 暂无法查看信息 您还没有登录,请登录后查看信息 @@ -32,7 +32,7 @@ 您的门店还未完成认证 请点击认证门店信息 @@ -142,7 +142,7 @@ - + 啤酒币兑换 已完成 @@ -900,6 +900,12 @@ align-items: center; justify-content: center; border-radius: 44rpx; + + .btn-icon { + width: 36rpx; + height: 36rpx; + margin-right: 8rpx; + } } } } diff --git a/pagesActivity/winelist.vue b/pagesActivity/winelist.vue index e67ab33..07ba587 100644 --- a/pagesActivity/winelist.vue +++ b/pagesActivity/winelist.vue @@ -403,7 +403,7 @@ height: 277rpx; .cover { - width: 120rpx; + width: 150rpx; height: 213rpx; border-radius: 16rpx; margin-right: 24rpx; diff --git a/pagesMy/feedback.vue b/pagesMy/feedback.vue index 8bea2c7..6e1d788 100644 --- a/pagesMy/feedback.vue +++ b/pagesMy/feedback.vue @@ -41,6 +41,7 @@