feat: 优化搜索页面交互体验 - 修复搜索触发逻辑,优化页面显示和搜索状态指示

This commit is contained in:
davy 2025-04-07 12:49:04 +08:00
parent 6b7d8a6fcd
commit 92c79166f5
3 changed files with 1359 additions and 347 deletions

View File

@ -2,11 +2,14 @@
<view class="page"> <view class="page">
<!-- 固定搜索栏 --> <!-- 固定搜索栏 -->
<view class="fixed-search" :style="{ top: statusBaeHeight + 'px' }"> <view class="fixed-search" :style="{ top: statusBaeHeight + 'px' }">
<SearchBar <view class="search-box" @tap="toSearch">
:placeholders="'搜索酒款/品牌'" <view class="search-input-container">
:bgcolor="'#19367A'" <text class="search-placeholder">输入酒款名称品牌名称啤酒风格</text>
:borderRs="'0px 0px 24rpx 24rpx'" <view class="search-icon-container">
/> <uni-icons type="search" size="24" color="#fff"></uni-icons>
</view>
</view>
</view>
</view> </view>
<!-- 筛选栏 --> <!-- 筛选栏 -->
@ -48,14 +51,11 @@
} from '@/api/platform.js' } from '@/api/platform.js'
import commonTitle from '@/components/commonTitle.vue' import commonTitle from '@/components/commonTitle.vue'
import rowBeer from '@/components/rowBeer.vue' import rowBeer from '@/components/rowBeer.vue'
import SearchBar from '@/components/SearchBar.vue';
export default { export default {
components: { components: {
commonTitle, commonTitle,
rowBeer, rowBeer,
SearchBar,
}, },
data() { data() {
return { return {
@ -113,18 +113,12 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/newBeer' url: '/pages/index/newBeer'
}) })
// uni.navigateTo({
// url: '/pagesActivity/newWine'
// })
// uni.navigateTo({
// url: '/pages/activityList/details'
// })
} }
}, },
// //
toSearch() { toSearch() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/searchBeer' url: '/pagesActivity/homeSearch'
}) })
}, },
// 广 banner // 广 banner
@ -200,32 +194,70 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {
background: #F9F9F9; background: #F9F9F9;
height: 100vh; height: 100vh;
overflow-y: auto; overflow-y: auto;
} }
.fixed-search { .fixed-search {
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; right: 0;
z-index: 1001; /* 提高导航栏层级 */ z-index: 1001; /* 提高导航栏层级 */
background-color: #19367A; background-color: #19367A;
border-radius: 0 0 24rpx 24rpx; border-radius: 0 0 24rpx 24rpx;
padding: 20rpx 0;
transition: all 0.3s ease;
}
/* 保持搜索栏原有圆角 */ .search-box {
:deep(.search-container) { padding: 0 30rpx;
border-radius: 0 0 24rpx 24rpx !important; }
}
}
.content-container { .search-input-container {
display: flex;
align-items: center;
width: 100%;
background-color: #fff;
border-radius: 30rpx;
overflow: hidden;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
height: 80rpx;
position: relative;
}
.search-placeholder {
flex: 1;
padding: 0 20rpx;
font-size: 28rpx;
color: #999;
position: relative;
}
.search-icon-container {
display: flex;
justify-content: center;
align-items: center;
width: 80rpx;
height: 80rpx;
background-color: #D42E78;
border-radius: 0 30rpx 30rpx 0;
color: #fff;
transition: all 0.3s ease;
&:active {
transform: scale(0.95);
opacity: 0.9;
}
}
.content-container {
padding-top: 0rpx; padding-top: 0rpx;
} }
/* 筛选导航栏 */ /* 筛选导航栏 */
.filter-bar { .filter-bar {
position: sticky; position: sticky;
top:80rpx; top:80rpx;
z-index: 1000; z-index: 1000;
@ -233,21 +265,23 @@
box-shadow: 0rpx 1rpx 3rpx 0rpx rgba(0, 0, 0, 0.1); box-shadow: 0rpx 1rpx 3rpx 0rpx rgba(0, 0, 0, 0.1);
margin-top: -40rpx; margin-top: -40rpx;
padding-top: 40rpx; padding-top: 40rpx;
} }
.choose-center { .choose-center {
height: 112rpx; height: 112rpx;
width: 100%; width: 100%;
padding: 24rpx; padding: 24rpx;
background: #FFFFFF; background: #FFFFFF;
}
.choose-navs { .choose-navs {
// //
font-family: Roboto; font-family: Roboto;
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
}
.choose-navs-txt { .choose-navs-txt {
// //
width: 144rpx; width: 144rpx;
height: 64rpx; height: 64rpx;
@ -255,20 +289,21 @@
border-radius: 12rpx; border-radius: 12rpx;
background: #F9F9F9; background: #F9F9F9;
margin-right: 16rpx; margin-right: 16rpx;
&.actives { &.actives {
// //
color: #FFF; color: #FFF;
background: #D42E78; background: #D42E78;
} }
} }
}
}
.title-box { .title-box {
padding: 24rpx 32rpx; padding: 24rpx 32rpx;
// margin-bottom: 24rpx; // margin-bottom: 24rpx;
// margin-top: 24rpx; // margin-top: 24rpx;
.title { }
.title {
font-size: 32rpx; font-size: 32rpx;
color: #030303; color: #030303;
font-weight: 600; font-weight: 600;
@ -279,9 +314,9 @@
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.sub { .sub {
font-family: Roboto; font-family: Roboto;
font-size: 24rpx; font-size: 24rpx;
font-weight: normal; font-weight: normal;
@ -295,6 +330,5 @@
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
}
</style> </style>

File diff suppressed because it is too large Load Diff

BIN
static/Vector@1x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B