feat: 优化首页搜索功能交互,添加默认头像

This commit is contained in:
davy 2025-03-30 22:23:11 +08:00
parent 05d27af5a9
commit 3081fcde2e
4 changed files with 46 additions and 19 deletions

View File

@ -19,12 +19,13 @@
<!-- 快捷导航 -->
<view class="bg-white"
style="border-radius: 30rpx 30rpx 12rpx 12rpx;padding-top:8rpx;position: relative;margin-top:-20rpx">
<view class="search-box">
<!-- <text class="cuIcon-search" style="font-size: 40rpx;color: #A2A2A2;margin-right: 24rpx;"></text>
<input type="text" disabled placeholder="搜索酒款/酒厂" @click="toSearch"> -->
<input style="flex:1;margin-left: 20rpx;" v-model="keyword" type="text" placeholder="搜索酒款/酒厂" @confirm="search" @input="changeSearch">
<view class="searchs" @click="search" style="">
<uni-icons type="search" size="30" color="#fff"></uni-icons>
<view class="search-box" @click="toSearch">
<view class="search-input">
<text class="cuIcon-search" style="font-size: 40rpx;color: #A2A2A2;margin-right: 24rpx;"></text>
<text style="color: #A2A2A2;">搜索酒款名称品牌名称啤酒风格</text>
</view>
<view class="searchs">
<uni-icons type="search" size="30" color="#fff"></uni-icons>
</view>
</view>
<view class="flex justify-between bg-white" style="padding: 20rpx 36rpx;">
@ -167,6 +168,7 @@
userInfo: null,
featurePageList: [], //
homeBanner: [], //banner
keyword: '',
};
},
onLoad() {
@ -218,11 +220,12 @@
},
//
toSearch() {
// uni.navigateTo({
// url: '/pages/index/searchBeer'
// })
uni.navigateTo({
url: '/pagesActivity/homeSearch'
url: '/pagesActivity/homeSearch',
success: () => {
//
uni.$emit('openKeyboard')
}
})
},
changeTag(index) {
@ -257,11 +260,7 @@
// 广
closeAd() {
uni.setStorageSync('showHomeAD', true)
uni.setTabBarStyle({
backgroundColor: '#ffffff'
})
this.$refs.ADRef.close()
},
handleAD(item) {
this.closeAd()
@ -337,6 +336,14 @@
uni.navigateTo({
url: "/pages/activityList/activityList"
})
},
search() {
//
console.log('搜索关键词:', this.keyword);
},
changeSearch() {
//
console.log('搜索关键词:', this.keyword);
}
}
}
@ -367,6 +374,13 @@
margin: 26rpx auto;
box-sizing: border-box;
.search-input {
flex: 1;
display: flex;
align-items: center;
padding: 0 24rpx;
}
.searchs{
background: #D42E78;
width: 80rpx;

View File

@ -14,7 +14,7 @@
</view>
<view v-else class="user-box flex align-center justify-start" :style="{'padding-top': statusBaeHeight + 60 + 'px'}" @click="$refs.loginRef.open()">
<view class="avatar-placeholder flex align-center justify-center">
<image src="/static/default-avatar.png" class="default-avatar"></image>
<image src="/static/default-avatar.svg" class="default-avatar"></image>
</view>
<view class="login-text flex align-center">
<text style="color: #333333; font-size: 36rpx; margin-right: 12rpx;">登录/认证</text>

View File

@ -3,9 +3,8 @@
<!-- 固定搜索框 -->
<view class="fixed-search-box" style="background-color:#19367A;border-radius: 0rpx 0rpx 24rpx 24rpx;">
<view class="search-box">
<text class="cuIcon-loading" style="font-size: 40rpx;color: #A2A2A2;margin-right: 24rpx;padding-left: 20rpx;"
@click="search" :class="{ 'rotate': isRotating }"></text>
<input style="flex:1;" v-model="keyword" type="text" placeholder="搜索酒款名称,品牌名称,啤酒风格" @confirm="search" @input="changeSearch">
<text class="cuIcon-back" style="font-size: 40rpx;color: #fff;margin-right: 24rpx;padding-left: 20rpx;" @click="goBack"></text>
<input ref="searchInput" style="flex:1;" v-model="keyword" type="text" placeholder="搜索酒款名称,品牌名称,啤酒风格" @confirm="search" @input="changeSearch" focus>
<view class="searchs" @click="search" style="">
<uni-icons type="search" size="30" color="#fff"></uni-icons>
</view>
@ -170,8 +169,16 @@
isRotating: false
};
},
mounted() {
onLoad() {
this.getPopularStyle()
//
uni.$on('openKeyboard', () => {
this.$refs.searchInput.focus()
})
},
onUnload() {
//
uni.$off('openKeyboard')
},
methods: {
changeSearch() {

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="100" cy="100" r="100" fill="#F6F6F6"/>
<circle cx="100" cy="80" r="40" fill="#CCCCCC"/>
<path d="M100 130C66.6667 130 40 156.667 40 190H160C160 156.667 133.333 130 100 130Z" fill="#CCCCCC"/>
</svg>

After

Width:  |  Height:  |  Size: 361 B