diff --git a/components/.DS_Store b/components/.DS_Store deleted file mode 100644 index ba9865c..0000000 Binary files a/components/.DS_Store and /dev/null differ diff --git a/components/CustomNavBar.vue b/components/CustomNavBar.vue deleted file mode 100644 index cff4dac..0000000 --- a/components/CustomNavBar.vue +++ /dev/null @@ -1,126 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/commonTitle.vue b/components/commonTitle.vue deleted file mode 100644 index c9655a7..0000000 --- a/components/commonTitle.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/customs.vue b/components/customs.vue deleted file mode 100644 index cff4dac..0000000 --- a/components/customs.vue +++ /dev/null @@ -1,126 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/shaiXuan.vue b/components/shaiXuan.vue deleted file mode 100644 index e778e3e..0000000 --- a/components/shaiXuan.vue +++ /dev/null @@ -1,373 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/shaiXuans.vue b/components/shaiXuans.vue deleted file mode 100644 index ec1b0ad..0000000 --- a/components/shaiXuans.vue +++ /dev/null @@ -1,76 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages.json b/pages.json index 58f9323..df850ff 100644 --- a/pages.json +++ b/pages.json @@ -100,14 +100,6 @@ } }, - { - "path" : "pages/index/home", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { "path" : "pages/index/review", "style" : @@ -291,7 +283,9 @@ "path" : "coinCollect", "style" : { - "navigationBarTitleText" : "品牌啤酒币" + "navigationBarTitleText" : "品牌啤酒币", + "navigationBarBackgroundColor": "#19367A", + "navigationBarTextStyle": "white" } }, { diff --git a/pages/activityList/index.vue b/pages/activityList/index.vue index f5cdbda..34d065e 100644 --- a/pages/activityList/index.vue +++ b/pages/activityList/index.vue @@ -49,12 +49,10 @@ import { listFeaturePage } from '@/api/platform.js' - import commonTitle from '@/components/commonTitle.vue' import rowBeer from '@/components/rowBeer.vue' export default { components: { - commonTitle, rowBeer, }, data() { diff --git a/pages/index/home.vue b/pages/index/home.vue deleted file mode 100644 index 0168a35..0000000 --- a/pages/index/home.vue +++ /dev/null @@ -1,533 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 049ecd6..f6b070d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -114,13 +114,11 @@ import { listFeaturePage } from '@/api/platform.js' - import commonTitle from '@/components/commonTitle.vue' import loginPopup from '@/components/loginPopup.vue'; import rowBeer from '@/components/rowBeer.vue' import ActivityItem from '@/components/ActivityItem.vue' export default { components: { - commonTitle, loginPopup, rowBeer, ActivityItem @@ -199,122 +197,78 @@ methods: { loginSuccess() { this.userInfo = uni.getStorageSync('userInfo') - - if (this.userInfo == null || this.userInfo.userType == '09') { // 没登录或者没认证门店 - console.log('登录') - this.showJoinImg = true - } else { - this.showJoinImg = false - } + this.showJoinImg = !this.userInfo || this.userInfo.userType === '09' + this.resetAndLoadData() }, - // 重置并加载数据 + // 重置数据并重新加载 resetAndLoadData() { this.pageNum = 1 - this.finished = false this.featurePageList = [] + this.finished = false this.getActivityList() }, // 获取活动列表 async getActivityList() { if (this.loading || this.finished) return + this.loading = true try { - this.loading = true const res = await getActivities({ pageNum: this.pageNum, - pageSize: this.pageSize + pageSize: this.pageSize, + keyword: this.keyword }) - if (res.code === 200) { - const { rows, total } = res - - // 处理数据,计算剩余天数和状态 - const processedRows = this.processActivityData(rows) - - // 更新列表数据 + if (res.rows && res.rows.length > 0) { if (this.pageNum === 1) { - this.featurePageList = processedRows + this.featurePageList = res.rows } else { - this.featurePageList = [...this.featurePageList, ...processedRows] + this.featurePageList = [...this.featurePageList, ...res.rows] } - - this.total = total - this.finished = this.featurePageList.length >= total + this.total = res.total this.pageNum++ + + // 判断是否加载完成 + if (this.featurePageList.length >= this.total) { + this.finished = true + } + } else { + this.finished = true } } catch (error) { console.error('获取活动列表失败:', error) + uni.showToast({ + title: '加载失败', + icon: 'none' + }) } 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 (remainingDays <= 0) { - activityState = 'completed' - } else 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 - } - }) - }, - // 修改页面加载更多方法 - async changePage() { - if (!this.finished) { - await this.getActivityList() + // 加载更多 + changePage() { + if (!this.loading && !this.finished) { + this.getActivityList() } }, + // 更多热门活动 + moreHotActivity() { + uni.navigateTo({ + url: '/pages/activityList/activityList' + }) + }, + // 处理活动点击 handleActivityClick(item) { - console.log('handleActivityClick called', item) uni.navigateTo({ - url: "/pagesActivity/activityDetail?id=" + item.id + url: `/pages/activityList/details?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() { + // 跳转酒评页 + toReview(it) { uni.navigateTo({ - url: '/pagesMy/addAiad' + url: "/pages/index/review?beerId=" + it.id }) }, - // 搜索 - toSearch() { - uni.navigateTo({ - url: '/pagesActivity/homeSearch', - success: () => { - uni.$emit('openKeyboard') - } - }) - }, - changeTag(index) { - this.curTag = index - }, // 查询广告弹窗 banner列表 getBannerListFun() { this.ADList = [] @@ -331,26 +285,18 @@ } }) - // 检查是否需要显示开屏广告 - this.checkShowAD() + let showHomeAD = uni.getStorageSync('showHomeAD') + if (!showHomeAD) { + this.$refs.ADRef.open() + } }) }, - // 检查是否需要显示开屏广告 - checkShowAD() { - if (this.ADList.length === 0) return - - const currentSession = uni.getStorageSync('currentSession') - const newSession = Date.now() - - // 每次打开小程序都显示广告 - if (!currentSession || currentSession !== newSession) { - this.$refs.ADRef.open() - // 记录本次会话时间 - uni.setStorageSync('currentSession', newSession) - } - }, // 关闭广告 closeAd() { + uni.setStorageSync('showHomeAD', true) + uni.setTabBarStyle({ + backgroundColor: '#ffffff' + }) this.$refs.ADRef.close() }, handleAD(item) { @@ -361,62 +307,54 @@ }) } }, - // 跳转专辑页 - toFeaturePage(item) { + // 立即认证门店 + toJoin() { + if (!this.bannerJoin) return uni.navigateTo({ - url: `/pages/index/featureInfo?id=${item.id}` + url: this.bannerJoin.bannerLink, }) }, - // 查询专辑页列表 - getFeaturePageListFun() { - listFeaturePage().then(res => { - this.featurePageList = res.data - }) - }, - // 跳转酒评页 - toReview(it) { + // 搜索 + toSearch() { uni.navigateTo({ - url: "/pages/index/review?beerId=" + it.id + url: '/pagesActivity/homeSearch' }) }, - toGo(key) { - switch (key) { + // 导航跳转 + toGo(index) { + switch(index) { case 1: // 新酒上市 uni.navigateTo({ - url: "/pages/index/newBeer" + url: '/pages/index/newBeer' }) break; case 2: // 生成酒单 uni.navigateTo({ - url: "/pagesActivity/winelist" + url: '/pages/index/featureInfo' }) break; - case 3: //酒币换购 + case 3: // 酒币换购 uni.navigateTo({ - url: "/pagesCoin/beerCoin" + url: '/pagesCoin/beerCoin' }) break; - case 4: // 关注酒厂 + case 4: // 关注厂牌 uni.navigateTo({ - url: '/pagesMy/myAttention' + url: '/pages/index/myJoin' }) break; } }, - // 更多热门活动 - moreHotActivity() { - uni.navigateTo({ - url: "/pages/activityList/activityList" - }) - }, - search() { - // 实现搜索逻辑 - console.log('搜索关键词:', this.keyword); - }, - changeSearch() { - // 实现搜索逻辑 - console.log('搜索关键词:', this.keyword); + // 处理广告轮播切换 + handleAdSwiperChange(e) { + this.currentAdIndex = e.detail.current }, + // 处理弹窗状态变化 + handlePopupChange(e) { + if (!e.show) { + this.closeAd() + } + } } } diff --git a/pages/index/indexOld.vue b/pages/index/indexOld.vue deleted file mode 100644 index 128f740..0000000 --- a/pages/index/indexOld.vue +++ /dev/null @@ -1,542 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/index/newBeerOld.vue b/pages/index/newBeerOld.vue deleted file mode 100644 index 1e40242..0000000 --- a/pages/index/newBeerOld.vue +++ /dev/null @@ -1,223 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/index/searchBeer.vue b/pages/index/searchBeer.vue index 03bbf29..3da81ed 100644 --- a/pages/index/searchBeer.vue +++ b/pages/index/searchBeer.vue @@ -131,7 +131,6 @@ - - \ No newline at end of file diff --git a/pagesActivity/homeSearch.vue b/pagesActivity/homeSearch.vue index 65cae00..b59e4d3 100644 --- a/pagesActivity/homeSearch.vue +++ b/pagesActivity/homeSearch.vue @@ -678,7 +678,7 @@ // 跳转到添加新酒款页面 toNewBeer() { uni.navigateTo({ - url: '/pages/index/addBeer' + url: '/pagesActivity/newWine' }) } }, diff --git a/pagesActivity/myActivityDetail.vue b/pagesActivity/myActivityDetail.vue index e255673..95c47c8 100644 --- a/pagesActivity/myActivityDetail.vue +++ b/pagesActivity/myActivityDetail.vue @@ -181,11 +181,9 @@ confirmPayApi } from '@/api/user.js' - import process from './components/progress.vue'; import rowBeer from '@/components/rowBeer.vue' export default { components: { - process, rowBeer }, data() { diff --git a/pagesActivity/newWine.vue b/pagesActivity/newWine.vue index 884a1f6..8bee2f9 100644 --- a/pagesActivity/newWine.vue +++ b/pagesActivity/newWine.vue @@ -1,64 +1,118 @@