diff --git a/components/loginPopup.vue b/components/loginPopup.vue index 959144f..ff46810 100644 --- a/components/loginPopup.vue +++ b/components/loginPopup.vue @@ -66,10 +66,6 @@ }, methods: { open() { - // uni.hideTabBar({ - // fail() { - // } - // }) this.$refs.loginRef.open() }, close() { diff --git a/pages/index/brandHome.vue b/pages/index/brandHome.vue index 026fffe..884ff5d 100644 --- a/pages/index/brandHome.vue +++ b/pages/index/brandHome.vue @@ -266,6 +266,7 @@ pageSize: 5, id: '' }, + isLogin: false, // Added for the new favorBreweryFun method }; }, onLoad({ @@ -467,8 +468,7 @@ }, // 收藏品牌方 favorBreweryFun(status) { - const token = uni.getStorageSync('token') - if (!token) { + if (!this.isLogin) { this.$refs.loginRef.open() return } @@ -873,6 +873,7 @@ min-height: 600rpx; width: 100%; box-sizing: border-box; + animation: simple-fade 0.2s ease-out; } /* 滚动容器 */ @@ -901,6 +902,7 @@ display: flex; flex-direction: column; box-sizing: border-box; + box-shadow: 0rpx 1rpx 3rpx 0rpx rgba(0, 0, 0, 0.1); } /* 商品网格 */ @@ -912,6 +914,7 @@ gap: 24rpx; // padding: 0 24rpx; box-sizing: border-box; + box-shadow: 0rpx 1rpx 3rpx 0rpx rgba(0, 0, 0, 0.1); } /* 商品卡片 */ @@ -1094,30 +1097,49 @@ } } - /* 上滑加载动画 */ - @keyframes slide-in { + /* 简化的淡入动画 */ + @keyframes simple-fade { from { - transform: translateY(100%); opacity: 0; } to { - transform: translateY(0); opacity: 1; } } - /* 活动列表项动画 */ - .activity-item { - animation: slide-in 0.3s ease-out; - } - - /* 商品卡片动画 */ - .goods-item { - animation: slide-in 0.3s ease-out; - } - - /* 啤酒卡片动画 */ + /* 移除所有复杂的动画效果 */ + .activity-item, + .goods-item, .beer-card { - animation: slide-in 0.3s ease-out; + animation: none; + } + + /* 移除旧的动画定义 */ + @keyframes tab-fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + + @keyframes item-slide-in { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + + /* 移除延迟动画 */ + .beer-card:nth-child(2n), + .activity-item:nth-child(2n), + .goods-item:nth-child(2n), + .beer-card:nth-child(3n), + .activity-item:nth-child(3n), + .goods-item:nth-child(3n) { + animation-delay: 0s; } \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index f6b070d..f62c510 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -9,11 +9,16 @@ - + - @@ -213,17 +218,26 @@ this.loading = true try { - const res = await getActivities({ + const params = { pageNum: this.pageNum, pageSize: this.pageSize, - keyword: this.keyword - }) + keyword: this.keyword, + orderType: 'latest' // 默认按最新发布排序 + } + + const res = await getActivities(params) if (res.rows && res.rows.length > 0) { + // 处理剩余天数 + const processedRows = res.rows.map(it => { + it.remainingDays = this.getRemainingDays(it.endDate) + return it + }) + if (this.pageNum === 1) { - this.featurePageList = res.rows + this.featurePageList = processedRows } else { - this.featurePageList = [...this.featurePageList, ...res.rows] + this.featurePageList = [...this.featurePageList, ...processedRows] } this.total = res.total this.pageNum++ @@ -233,6 +247,9 @@ this.finished = true } } else { + if (this.pageNum === 1) { + this.featurePageList = [] + } this.finished = true } } catch (error) { @@ -245,6 +262,15 @@ this.loading = false } }, + + // 计算剩余天数 + getRemainingDays(date) { + const targetDate = new Date(date) + const currentDate = new Date() + const timeDiff = targetDate.getTime() - currentDate.getTime() + const remainingDays = Math.ceil(timeDiff / (1000 * 3600 * 24)) + return remainingDays + }, // 加载更多 changePage() { if (!this.loading && !this.finished) { @@ -260,11 +286,16 @@ // 处理活动点击 handleActivityClick(item) { uni.navigateTo({ - url: `/pages/activityList/details?id=${item.id}` + url: `/pagesActivity/activityDetail?id=${item.id}` }) }, // 跳转酒评页 toReview(it) { + const token = uni.getStorageSync('token') + if (!token) { + this.$refs.loginRef.show() + return + } uni.navigateTo({ url: "/pages/index/review?beerId=" + it.id }) @@ -275,44 +306,98 @@ this.homeBanner = [] this.bannerJoin = null getBannerList().then(res => { + if (!res.data || !Array.isArray(res.data)) return + res.data.forEach(it => { - if (it.bannerType == 'homeAD') { // 开屏广告 + if (it.bannerType === 'homeAD') { // 开屏广告 this.ADList.push(it) - } else if (it.bannerType == 'homeJoin') { // 认证门店 + } else if (it.bannerType === 'homeJoin') { // 认证门店 this.bannerJoin = it - } else if (it.bannerType == 'homeBanner') { // 首页banner + } else if (it.bannerType === 'homeBanner') { // 首页banner this.homeBanner.push(it) } }) - let showHomeAD = uni.getStorageSync('showHomeAD') - if (!showHomeAD) { - this.$refs.ADRef.open() + // 检查是否需要显示开屏广告 + const lastShowTime = uni.getStorageSync('lastShowHomeADTime') + const currentTime = new Date().getTime() + // 如果从未显示过或者距离上次显示超过24小时 + if (!lastShowTime || (currentTime - lastShowTime > 24 * 60 * 60 * 1000)) { + if (this.ADList.length > 0) { + this.$refs.ADRef.open() + } } + }).catch(err => { + console.error('获取banner列表失败:', err) }) }, - // 关闭广告 closeAd() { - uni.setStorageSync('showHomeAD', true) + // 记录广告显示时间 + uni.setStorageSync('lastShowHomeADTime', new Date().getTime()) uni.setTabBarStyle({ backgroundColor: '#ffffff' }) this.$refs.ADRef.close() }, handleAD(item) { + if (!item || !item.bannerLink) return + this.closeAd() - if (item.bannerLink) { + // 处理不同类型的链接 + if (item.bannerLink.startsWith('/')) { + // 内部页面跳转 uni.navigateTo({ url: item.bannerLink, + fail: () => { + // 如果普通跳转失败,尝试switchTab + uni.switchTab({ + url: item.bannerLink, + fail: (err) => { + console.error('页面跳转失败:', err) + uni.showToast({ + title: '页面跳转失败', + icon: 'none' + }) + } + }) + } + }) + } else if (item.bannerLink.startsWith('http')) { + // 外部链接,可以使用web-view页面打开 + uni.navigateTo({ + url: `/pages/webview/webview?url=${encodeURIComponent(item.bannerLink)}` }) } }, // 立即认证门店 toJoin() { - if (!this.bannerJoin) return - uni.navigateTo({ - url: this.bannerJoin.bannerLink, - }) + if (!this.bannerJoin || !this.bannerJoin.bannerLink) return + + // 处理不同类型的链接 + if (this.bannerJoin.bannerLink.startsWith('/')) { + // 内部页面跳转 + uni.navigateTo({ + url: this.bannerJoin.bannerLink, + fail: () => { + // 如果普通跳转失败,尝试switchTab + uni.switchTab({ + url: this.bannerJoin.bannerLink, + fail: (err) => { + console.error('页面跳转失败:', err) + uni.showToast({ + title: '页面跳转失败', + icon: 'none' + }) + } + }) + } + }) + } else if (this.bannerJoin.bannerLink.startsWith('http')) { + // 外部链接,使用web-view页面打开 + uni.navigateTo({ + url: `/pages/webview/webview?url=${encodeURIComponent(this.bannerJoin.bannerLink)}` + }) + } }, // 搜索 toSearch() { @@ -330,7 +415,7 @@ break; case 2: // 生成酒单 uni.navigateTo({ - url: '/pages/index/featureInfo' + url: '/pagesActivity/winelist' }) break; case 3: // 酒币换购 @@ -340,7 +425,7 @@ break; case 4: // 关注厂牌 uni.navigateTo({ - url: '/pages/index/myJoin' + url: '/pagesMy/myAttention' }) break; } @@ -354,6 +439,26 @@ if (!e.show) { this.closeAd() } + }, + // 跳转到生成酒单页面 + toBeerList() { + uni.switchTab({ + url: '/pages/index/beerList' + }) + }, + + // 跳转到酒币兑换页面 + toBeerCoin() { + uni.switchTab({ + url: '/pages/index/beerCoin' + }) + }, + + // 跳转到我的关注页面 + toMyAttention() { + uni.switchTab({ + url: '/pages/index/myAttention' + }) } } } @@ -383,6 +488,25 @@ height: 100%; object-fit: cover; } + + /deep/ .uni-swiper-dots { + bottom: 20rpx; + + .uni-swiper-dot { + width: 12rpx; + height: 12rpx; + border-radius: 6rpx; + margin: 0 6rpx; + transition: all 0.3s ease; + background: rgba(255, 255, 255, 0.4); + + &.uni-swiper-dot-active { + width: 28rpx; + background-color: #FFFFFF; + box-shadow: 0 2rpx 8rpx rgba(255, 255, 255, 0.3); + } + } + } } } diff --git a/pages/index/my.vue b/pages/index/my.vue index 0b80a34..47739ef 100644 --- a/pages/index/my.vue +++ b/pages/index/my.vue @@ -28,7 +28,11 @@ - + + 网络连接失败 + 请检查网络设置后重试 + + 登录/认证 @@ -44,33 +48,9 @@ - - - - - - - 本周累计扫码 - - - 20 - - - - - - 同比增长13.2% - - - - - - 欢迎加入啤啤猩球 - - - - - + + - {{item.brandName}} + + {{item.brandName}} + {{item.barCity || '全国'}} + - - {{item.balance}} - + + + 啤酒币余额 + + {{item.balance}} + + + - {{item.goodsNum}}款热门商品可兑换 - + @@ -189,6 +176,7 @@ sortedBrandCoins: [], scanCount: 0, userInfo: null, + hasNetwork: true, // 扫码统计数据 weekScanStats: { total: 20, @@ -217,6 +205,7 @@ }, onLoad() { this.statusBaeHeight = uni.getWindowInfo.statusBarHeight + this.checkNetwork() }, onShow() { console.log('页面显示,检查登录状态'); @@ -309,8 +298,35 @@ console.error('获取扫码数据失败:', error); } }, + // 检查网络状态 + checkNetwork() { + uni.getNetworkType({ + success: (res) => { + this.hasNetwork = res.networkType !== 'none' + if (this.hasNetwork) { + this.checkLoginStatus() + } + } + }) + + // 监听网络状态变化 + uni.onNetworkStatusChange((res) => { + this.hasNetwork = res.isConnected + if (this.hasNetwork) { + this.checkLoginStatus() + } + }) + }, // 处理用户信息区域点击 handleUserBoxClick() { + if (!this.hasNetwork) { + uni.showToast({ + title: '网络连接失败,请检查网络设置', + icon: 'none' + }) + return + } + switch (this.userStatus) { case 'guest': this.$refs.loginRef.open(); @@ -450,7 +466,7 @@ // 跳转到设置页面 toSettings() { uni.navigateTo({ - url: '/pagesMy/settings' + url: '/pagesMy/setting' }); }, @@ -924,199 +940,89 @@ /* 币种区域样式 */ .coin-section { - display: flex; - justify-content: space-between; - align-items: flex-start; margin-bottom: 24rpx; - /* 左侧扫码统计卡片样式 */ - .left-box { - width: 298rpx; - height: 180rpx; - background: #FFFFFF; - border-radius: 16rpx; - padding: 24rpx; - box-sizing: border-box; - box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); - border: 1rpx solid rgba(242, 242, 242, 0.8); - - .title { - font-size: 28rpx; - color: #333333; - font-weight: 600; - margin-bottom: 8rpx; - display: flex; - align-items: center; - height: 88rpx; - line-height: 88rpx; - padding: 8rpx 0; - margin-top: -24rpx; - position: relative; - - .tag-icon { - width: 70rpx; - height: 70rpx; - margin-top: 32rpx; - margin-right: 8rpx; - } - - text { - margin-top: -20rpx; - } - } - - .amount-row { - margin-bottom: 8rpx; - margin-left: 150rpx; - display: flex; - align-items: flex-end; - padding-right: 12rpx; - margin-top: -24rpx; - - .amount { - font-size: 48rpx; - color: #1A1A1A; - font-weight: 600; - line-height: 48rpx; - margin-right: 8rpx; - } - - .unit { - font-size: 24rpx; - color: #666666; - line-height: 48rpx; - padding-bottom: 8rpx; - margin-bottom: -8rpx; - transform: translateY(8rpx); - } - } - - .trend-row { - display: flex; - align-items: center; - font-size: 20rpx; - color: #606060; - line-height: 28rpx; - margin-bottom: 12rpx; - position: relative; - width: 100%; - - .trend-item { - position: absolute; - top: 8rpx; - right: 10rpx; - display: flex; - align-items: center; - white-space: nowrap; - - .trend-icon { - width: 32rpx; - height: 32rpx; - margin-right: 56rpx; - } - - .trend-text { - white-space: nowrap; - } - - &.up { - color: #606060; - } - - &.down { - color: #52C41A; - } - } - } - - .unauth-tip { - display: flex; - align-items: center; - justify-content: center; - height: 100%; - - .tip-text { - font-size: 28rpx; - color: #333333; - font-weight: 600; - white-space: nowrap; - line-height: 28rpx; - } - } - } - - /* 右侧品牌啤酒币轮播卡片样式 */ - .right-box { - width: 382rpx; - height: 180rpx; - background: #FFFFFF; - border-radius: 16rpx; - box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); + /* 啤酒币轮播卡片样式 */ + .coin-box { + width: 100%; + height: 220rpx; + background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FC 100%); + border-radius: 20rpx; + box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06); border: 1rpx solid rgba(242, 242, 242, 0.8); + overflow: hidden; /* 品牌内容容器 */ .brand-content { height: 100%; - padding: 0 24rpx; + padding: 24rpx; box-sizing: border-box; + position: relative; /* 品牌标题区域 */ .brand-header { display: flex; - align-items: flex-start; - padding: 8rpx; + align-items: center; + margin-bottom: 20rpx; .brand-logo { - width: 72rpx; - height: 72rpx; - margin-top: 12rpx; - // margin-left: 12rpx; - border-radius: 12rpx; - margin-right: 12rpx; + width: 80rpx; + height: 80rpx; + border-radius: 16rpx; + margin-right: 16rpx; + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1); } - .title { - font-size: 28rpx; - color: #333333; - font-weight: 600; - text-align: right; + .brand-info { flex: 1; - padding-top: 8rpx; + + .title { + font-size: 32rpx; + color: #333333; + font-weight: 600; + margin-bottom: 4rpx; + display: block; + } + + .sub-title { + font-size: 24rpx; + color: #999999; + display: block; + } } } - /* 币种数量行样式 */ - .amount-row { - display: flex; - align-items: center; - justify-content: flex-end; - padding-right: 12rpx; - margin-bottom: 8rpx; - margin-top: -24rpx; - - .amount { - font-size: 48rpx; - color: #1A1A1A; - font-weight: 600; - line-height: 48rpx; + .coin-info { + .amount-row { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 16rpx; + + .label { + font-size: 26rpx; + color: #666666; + } + + .amount-wrapper { + display: flex; + align-items: center; + + .amount { + font-size: 48rpx; + color: #19367A; + font-weight: 600; + line-height: 1; + } + + .coin-icon { + color: #FFD700; + font-size: 32rpx; + margin-left: 8rpx; + text-shadow: 0 2rpx 4rpx rgba(255, 215, 0, 0.3); + } + } } - - .coin-icon { - color: #FFD700; - font-size: 30rpx; - margin-left: 10rpx; - line-height: 48rpx; - } - } - - /* 底部描述文字样式 */ - .desc { - font-size: 20rpx; - color: #606060; - text-align: right; - line-height: 28rpx; - padding-right: 20rpx; - margin-bottom: 12rpx; } /* 空数据状态样式 */ @@ -1126,27 +1032,79 @@ justify-content: center; align-items: center; height: 100%; + background: linear-gradient(135deg, #F8F9FC 0%, #FFFFFF 100%); .empty-icon { - font-size: 40rpx; + font-size: 48rpx; color: #CCCCCC; - margin-bottom: 8rpx; + margin-bottom: 12rpx; } .empty-text { - font-size: 26rpx; + font-size: 28rpx; color: #333333; font-weight: 500; - margin-bottom: 6rpx; + margin-bottom: 8rpx; } .empty-desc { - font-size: 20rpx; + font-size: 24rpx; color: #999999; + margin-bottom: 16rpx; } } } } } } + + /* 未登录状态样式 */ + .unlogin-content { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; + background: linear-gradient(135deg, #F8F9FC 0%, #FFFFFF 100%); + + .unlogin-icon { + font-size: 48rpx; + color: #CCCCCC; + margin-bottom: 12rpx; + + .cuIcon-lock { + color: #999999; + } + } + + .unlogin-text { + font-size: 28rpx; + color: #333333; + font-weight: 500; + margin-bottom: 16rpx; + } + + .unlogin-btn { + display: flex; + align-items: center; + padding: 12rpx 32rpx; + background: #19367A; + border-radius: 32rpx; + color: #FFFFFF; + font-size: 28rpx; + font-weight: 500; + box-shadow: 0 4rpx 12rpx rgba(25, 54, 122, 0.2); + transition: all 0.3s ease; + + .cuIcon-right { + font-size: 24rpx; + margin-left: 4rpx; + } + + &:active { + transform: scale(0.98); + opacity: 0.9; + } + } + } \ No newline at end of file diff --git a/pages/index/myJoin.vue b/pages/index/myJoin.vue index db3006e..b608bb9 100644 --- a/pages/index/myJoin.vue +++ b/pages/index/myJoin.vue @@ -569,6 +569,21 @@ } }, + // 跳转到酒评页面 + toReview(item) { + if (!item || !item.id) { + uni.showToast({ + title: '酒款信息不完整', + icon: 'none' + }) + return + } + + uni.navigateTo({ + url: "/pages/index/review?beerId=" + item.id + }) + }, + // 检查网络状态 checkNetwork() { uni.getNetworkType({ diff --git a/pages/index/scan.vue b/pages/index/scan.vue index e1edca5..f9a8b74 100644 --- a/pages/index/scan.vue +++ b/pages/index/scan.vue @@ -65,12 +65,12 @@ 需要在平台下单采购吗? - 任意渠道您采购的桶装产品,都可以参与活动,只要确定酒标有'枝点酒掌柜'的二维码,扫码即可. + 任意渠道您采购的桶装产品,都可以参与活动,只要确定酒标有'啤啤猩球'的二维码,扫码即可. 我的酒,没有二维码怎么办? - 1.如果您商品品牌方未入驻"枝点"暂时无法提供服务
2.若品牌方已入驻,需最新批次产品将会体现"枝点"二维码.
+ 1.如果您商品品牌方未入驻"啤啤猩球"暂时无法提供服务
2.若品牌方已入驻,需最新批次产品将会体现"啤啤猩球"二维码.