feat: 1. 优化页面样式和交互 2. 添加新的图标资源

This commit is contained in:
davy 2025-04-10 00:38:18 +08:00
parent aba7fe92d3
commit c022c02f2f
5 changed files with 158 additions and 45 deletions

View File

@ -73,7 +73,7 @@
width: 208rpx;
background: #FFFFFF;
margin-right: 16rpx;
margin-bottom: 36rpx;
margin-bottom: 24rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;

View File

@ -9,8 +9,8 @@
<scroll-view scroll-y style="height: 100%;width: 100%;">
<!-- 活动标题和描述 -->
<view class="activity-header">
<view class="activity-title">{{activityInfo.title || 'TasteRoom 风味屋 · 风味之旅系列'}}</view>
<view class="activity-desc">{{activityInfo.description || '探索啤酒风味新边界'}}</view>
<view class="activity-title">{{featureInfo.pageName || '专辑详情'}}</view>
<view class="activity-desc">{{featureInfo.subTitle || '探索啤酒风味新边界'}}</view>
</view>
<!-- 酒款列表 -->
@ -50,8 +50,8 @@
},
data() {
return {
activityId: '',
activityInfo: {},
featureId: '',
featureInfo: {},
beerList: [],
queryForm: {
search: ''
@ -61,28 +61,45 @@
};
},
onLoad(options) {
console.log('专辑详情页 onLoad options:', options)
if (options.id) {
this.activityId = options.id
this.getActivityDetail()
this.featureId = options.id
console.log('专辑ID:', this.featureId)
this.getFeatureDetail()
} else {
console.error('未传递专辑ID')
uni.showToast({
title: '参数错误',
icon: 'none'
})
}
},
onShow(){
// uni.showTabBar()
},
methods: {
//
async getActivityDetail() {
//
async getFeatureDetail() {
try {
const res = await getFeaturePage(this.activityId)
console.log('开始获取专辑详情ID:', this.featureId)
const res = await getFeaturePage(this.featureId)
console.log('专辑详情接口返回数据:', res)
if (res.code === 200 && res.data) {
this.activityInfo = res.data
//
this.featureInfo = res.data
console.log('专辑详情数据:', this.featureInfo)
//
this.getBeerList()
} else {
console.error('获取专辑详情失败,返回码:', res.code)
uni.showToast({
title: '获取专辑详情失败',
icon: 'none'
})
}
} catch (error) {
console.error('获取活动详情失败:', error)
console.error('获取专辑详情失败:', error)
uni.showToast({
title: '获取活动详情失败',
title: '获取专辑详情失败',
icon: 'none'
})
}
@ -91,9 +108,23 @@
//
async getBeerList() {
try {
const res = await getBeerList(this.activityInfo.keyword || '')
// 使ID
const params = {
featurePageId: this.featureId
}
console.log('开始获取酒款列表,参数:', params)
const res = await getBeerList(params)
console.log('酒款列表接口返回数据:', res)
if (res.code === 200 && res.data) {
this.beerList = res.data
console.log('酒款列表数据:', this.beerList)
} else {
console.error('获取酒款列表失败,返回码:', res.code)
uni.showToast({
title: '获取酒款列表失败',
icon: 'none'
})
}
} catch (error) {
console.error('获取酒款列表失败:', error)

View File

@ -28,13 +28,13 @@
</view>
<!-- 专辑列表 -->
<view v-for="(item,i) in featurePageList" :key="i" class="bg-white">
<view v-for="(item,i) in featurePageList" :key="i" class="bg-white feature-item">
<view class="flex justify-between align-center title-box" @click="toFeaturePage(item)">
<view class="flex-1 flex flex-col">
<text class="title">{{ item.pageName }}</text>
<text class="sub">{{ item.subTitle}}</text>
</view>
<image src="@/static/arrow-right.png" style="width: 48rpx;height: 48rpx;"></image>
<image src="@/static/arrow-right.svg" style="width: 48rpx;height: 48rpx;"></image>
</view>
<rowBeer :beers="item.beers" />
</view>
@ -192,12 +192,14 @@
</script>
<style lang="scss" scoped>
/* 页面基础样式 */
.page {
background: #F9F9F9;
height: 100vh;
overflow-y: auto;
}
/* 固定搜索栏样式 */
.fixed-search {
position: fixed;
left: 0;
@ -209,10 +211,12 @@
transition: all 0.3s ease;
}
/* 搜索框容器样式 */
.search-box {
padding: 0 30rpx;
}
/* 搜索输入框样式 */
.search-input-container {
display: flex;
align-items: center;
@ -225,6 +229,7 @@
position: relative;
}
/* 搜索框占位符文本样式 */
.search-placeholder {
flex: 1;
padding: 0 20rpx;
@ -233,6 +238,7 @@
position: relative;
}
/* 搜索图标容器样式 */
.search-icon-container {
display: flex;
justify-content: center;
@ -250,11 +256,12 @@
}
}
/* 内容区域容器样式 */
.content-container {
padding-top: 0rpx;
}
/* 筛选导航栏 */
/* 筛选导航栏样式 */
.filter-bar {
position: sticky;
top:80rpx;
@ -265,6 +272,7 @@
padding-top: 40rpx;
}
/* 筛选选项中心区域样式 */
.choose-center {
height: 112rpx;
width: 100%;
@ -272,6 +280,7 @@
background: #FFFFFF;
}
/* 导航选项容器样式 */
.choose-navs {
//
font-family: Roboto;
@ -279,6 +288,7 @@
font-weight: 500;
}
/* 导航选项文本样式 */
.choose-navs-txt {
//
width: 144rpx;
@ -295,16 +305,18 @@
}
}
/* 专辑标题区域样式 */
.title-box {
padding: 24rpx 32rpx;
// margin-bottom: 24rpx;
// margin-top: 24rpx;
}
/* 专辑主标题样式 */
.title {
font-size: 32rpx;
color: #030303;
font-weight: 600;
font-weight: bold;
line-height: 48rpx;
letter-spacing: normal;
margin-bottom: 8rpx;
@ -314,6 +326,7 @@
text-overflow: ellipsis;
}
/* 专辑副标题样式 */
.sub {
font-family: Roboto;
font-size: 24rpx;
@ -329,4 +342,12 @@
text-overflow: ellipsis;
overflow: hidden;
}
/* 专辑项样式 */
.feature-item {
margin: 24rpx 0; /* 上下间距24rpx */
border-radius: 24rpx 0rpx 0rpx 24rpx; /* 圆角 */
overflow: hidden; /* 确保内容不会溢出圆角 */
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05); /* 添加轻微阴影 */
}
</style>

View File

@ -146,6 +146,7 @@
finished: false,
navItems: ['新酒上市', '生成酒单', '酒币换购', '关注厂牌'],
currentAdIndex: 0, // 广
adLoading: false, // 广
};
},
created() {
@ -160,6 +161,8 @@
if (this.featurePageList.length === 0) {
this.getActivityList()
}
// 广
this.preloadAdData()
},
watch: {
featurePageList: {
@ -181,7 +184,6 @@
// })
// }, 500)
this.statusBaeHeight = uni.getWindowInfo.statusBarHeight
this.getBannerListFun() // 广
uni.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
@ -198,6 +200,9 @@
//
this.resetAndLoadData()
}
// 广
this.checkAndShowAd()
},
methods: {
loginSuccess() {
@ -300,13 +305,30 @@
url: "/pages/index/review?beerId=" + it.id
})
},
// 广
async preloadAdData() {
try {
this.adLoading = true
await this.getBannerListFun()
} catch (error) {
console.error('广告预加载失败:', error)
} finally {
this.adLoading = false
}
},
// 广 banner
getBannerListFun() {
async getBannerListFun() {
this.ADList = []
this.homeBanner = []
this.bannerJoin = null
getBannerList().then(res => {
if (!res.data || !Array.isArray(res.data)) return
try {
const res = await getBannerList()
if (!res.data || !Array.isArray(res.data)) {
console.error('广告数据格式错误')
return
}
res.data.forEach(it => {
if (it.bannerType === 'homeAD') { // 广
@ -317,20 +339,46 @@
this.homeBanner.push(it)
}
})
} catch (err) {
console.error('获取banner列表失败', err)
uni.showToast({
title: '广告加载失败',
icon: 'none'
})
}
},
// 广
checkAndShowAd() {
if (this.ADList.length === 0) {
// 广广
this.getBannerListFun().then(() => {
this.showAdIfNeeded()
})
return
}
this.showAdIfNeeded()
},
// 广
showAdIfNeeded() {
if (this.ADList.length === 0) return
// 广
const lastShowTime = uni.getStorageSync('lastShowHomeADTime')
const currentTime = new Date().getTime()
// 24
if (!lastShowTime || (currentTime - lastShowTime > 24 * 60 * 60 * 1000)) {
if (this.ADList.length > 0) {
// 1
if (!lastShowTime || (currentTime - lastShowTime > 60 * 60 * 1000)) {
this.$nextTick(() => {
if (this.$refs.ADRef) {
this.$refs.ADRef.open()
}
}
}).catch(err => {
console.error('获取banner列表失败', err)
})
}
},
// 广
closeAd() {
// 广
uni.setStorageSync('lastShowHomeADTime', new Date().getTime())
@ -338,7 +386,12 @@
backgroundColor: '#ffffff'
})
this.$refs.ADRef.close()
//
this.currentAdIndex = 0
},
// 广
handleAD(item) {
if (!item || !item.bannerLink) return
@ -363,12 +416,29 @@
}
})
} else if (item.bannerLink.startsWith('http')) {
// 使web-view
// 使web-view
uni.navigateTo({
url: `/pages/webview/webview?url=${encodeURIComponent(item.bannerLink)}`
})
}
},
// 广
handleAdSwiperChange(e) {
this.currentAdIndex = e.detail.current
},
//
handlePopupChange(e) {
if (!e.show) {
this.closeAd()
} else {
// 广
if (this.ADList.length === 0) {
this.closeAd()
}
}
},
//
toJoin() {
if (!this.bannerJoin || !this.bannerJoin.bannerLink) return
@ -430,16 +500,6 @@
break;
}
},
// 广
handleAdSwiperChange(e) {
this.currentAdIndex = e.detail.current
},
//
handlePopupChange(e) {
if (!e.show) {
this.closeAd()
}
},
//
toBeerList() {
uni.switchTab({

1
static/arrow-right.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.0 KiB