337 lines
7.1 KiB
Vue
Raw Permalink Normal View History

2025-04-03 11:47:12 +08:00
<template>
<view class="page">
<!-- 固定搜索栏 -->
<view class="fixed-search" :style="{ top: statusBaeHeight + 'px' }">
<SearchBar
:placeholders="'搜索酒款/品牌'"
:bgcolor="'#19367A'"
:borderRs="'0px 0px 24rpx 24rpx'"
/>
</view>
<!-- 内容容器 -->
<view class="content-container" style="margin-top: 120rpx;">
<view class="bg-white" :style="{ borderRadius: '30rpx 30rpx 12rpx 12rpx' }">
<view class="choose-center bg-white">
<view class="flex align-center choose-navs">
<view class="" v-for="item in tabList" style="text-align: center;">
<view class="choose-navs-txt" @click="changeNavs(item.value)"
:class="actives==item.value?'actives':''">
{{item.label}}
</view>
</view>
</view>
</view>
</view>
<!-- 专辑列表 -->
<view v-for="(item,i) in featurePageList" :key="i" class="bg-white">
<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>
</view>
<rowBeer :beers="item.beers" />
</view>
</view>
</view>
</template>
<script>
import {
getBannerList
} from '@/api/bar.js'
import {
listFeaturePage
} from '@/api/platform.js'
import commonTitle from '@/components/commonTitle.vue'
import rowBeer from '@/components/rowBeer.vue'
import SearchBar from '@/components/SearchBar.vue';
export default {
components: {
commonTitle,
rowBeer,
SearchBar,
},
data() {
return {
statusBaeHeight: 0,
curTag: 0,
ADList: [], // 广告弹窗
bannerJoin: null, // 入驻banner
showJoinImg: false, // 是否显示入驻图片
userInfo: null,
featurePageList: [], // 专辑页列表
homeBanner: [], //首页banner
bgcolor:'#19367A',
owPopup: false,
tabList:[
{
label:'为您推荐',
value:'1'
},
{
label:'风格选酒',
value:'2'
},
{
label:'热门厂牌',
value:'3'
},
{
label:'新酒上市',
value:'4'
},
],
actives:'1',
};
},
onLoad() {
this.statusBaeHeight = uni.getWindowInfo.statusBarHeight
this.getBannerListFun()
uni.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
this.actives = '1'
},
onShow() {
this.actives = '1'
// this.userInfo = uni.getStorageSync('userInfo')
// if (this.userInfo == null || this.userInfo.userType == '09') { // 没登录或者没入驻
// this.showJoinImg = true
// }else {
// this.showJoinImg = false
// }
this.getFeaturePageListFun() // 专辑页列表
},
// onPullDownRefresh(){
// this.getFeaturePageListFun() // 专辑页列表
// },
methods: {
handleUpdateHeight(height) {
this.contentMarginTop = height; // 动态更新 margin-top
},
changeNavs(ind){
this.actives = ind
if(ind == 2) {
uni.navigateTo({
url: '/pages/activityList/styleSelection'
})
}else if(ind == 3){
//pages/activityList/hotLabel
uni.navigateTo({
url: '/pages/activityList/hotLabel'
})
}else if(ind == 4){
//pages/activityList/hotLabel
// uni.navigateTo({
// url: '/pages/index/newBeer'
// })
uni.navigateTo({
url: '/pagesActivity/newWine'
})
// uni.navigateTo({
// url: '/pages/activityList/details'
// })
}
},
handleClose() {
},
toAddAiad() {
uni.navigateTo({
url: '/pagesMy/addAiad'
})
},
// 搜索
toSearch() {
uni.navigateTo({
url: '/pages/index/searchBeer'
})
},
changeTag(index) {
this.curTag = index
},
// 查询广告弹窗 banner列表
getBannerListFun() {
this.ADList = []
this.homeBanner = []
this.bannerJoin = null
getBannerList().then(res => {
res.data.forEach(it => {
if (it.bannerType == 'homeAD') { // 开屏广告
this.ADList.push(it)
} else if (it.bannerType == 'homeJoin') { // 入驻
this.bannerJoin = it
} else if (it.bannerType == 'homeBanner') { // 首页banner
this.homeBanner.push(it)
}
})
let showHomeAD = uni.getStorageSync('showHomeAD')
if (!showHomeAD) {
this.$refs.ADRef.open()
}
})
},
// 关闭广告
closeAd() {
uni.setStorageSync('showHomeAD', true)
uni.setTabBarStyle({
backgroundColor: '#ffffff'
})
this.$refs.ADRef.close()
},
handleAD(item) {
this.closeAd()
if (item.bannerLink) {
uni.navigateTo({
url: item.bannerLink,
})
}
},
// 立即入驻
toJoin() {
if (!this.bannerJoin) return
uni.navigateTo({
url: this.bannerJoin.bannerLink,
})
},
// 跳转专辑页
toFeaturePage(item) {
uni.navigateTo({
url: `/pages/activityList/details`
})
},
// 查询专辑页列表
getFeaturePageListFun() {
listFeaturePage().then(res => {
this.featurePageList = res.data
})
},
// 跳转酒评页
toReview(it) {
uni.navigateTo({
url: "/pages/index/review?beerId=" + it.id
})
},
toGo(key) {
switch (key) {
case 1: // 新酒上市
uni.navigateTo({
url: "/pages/index/newBeer"
})
break;
case 2: // 生成酒单
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
uni.navigateTo({
url: "/pagesActivity/winelist"
})
break;
case 3: //酒币换购
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
uni.navigateTo({
url: "/pagesCoin/beerCoin"
})
break;
case 4: // 关注酒厂
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
uni.navigateTo({
url: '/pagesMy/myAttention'
})
break;
}
}
}
}
</script>
<style lang="scss" scoped>
.page {
background: #FFFFFF;
height: 100vh;
overflow-y: auto;
}
.fixed-search {
position: fixed;
left: 0;
right: 0;
z-index: 1000;
background-color: #19367A;
/* 保持搜索栏原有圆角 */
:deep(.search-container) {
border-radius: 0 0 24rpx 24rpx !important;
}
}
.content-container {
padding-top: 20rpx; /* 与搜索栏间距 */
}
/* 原有样式保持不变 */
.choose-center {
height: 112rpx;
width: 100%;
padding: 24rpx;
box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
.choose-navs {
font-family: Roboto;
font-size: 12px;
font-weight: 500;
.choose-navs-txt {
width: 144rpx;
height: 64rpx;
line-height: 64rpx;
border-radius: 12rpx;
background: #F9F9F9;
margin-right: 16rpx;
&.actives {
color: #FFF;
background: #D42E78;
}
}
}
}
.title-box {
padding: 24rpx 32rpx;
margin-bottom: 28rpx;
.title {
font-size: 32rpx;
font-weight: bold;
color: #1E2019;
}
.sub {
font-size: 20rpx;
color: #9D9D9D;
margin-top: 18rpx;
}
}
</style>