This commit is contained in:
clay
2022-12-18 18:29:20 +08:00
parent 99b39f3eed
commit 2632ecb1f9
28 changed files with 71 additions and 65 deletions

View File

@@ -2,23 +2,20 @@
<view>
<!-- 顶部导航栏 -->
<view class="top-search">
<customer-searchbar ref="search" :queryParam="queryParam" :search-bar-top="searchBarTop" :search-bar-height="searchBarHeight"
@search="goSearch" @back="goBack" />
<customer-searchbar ref="search" :queryParam="queryParam" :search-bar-top="searchBarTop"
:search-bar-height="searchBarHeight" @search="goSearch" @back="goBack" />
</view>
<!-- 最近搜索 -->
<view class="recent-search" :style="{marginTop: Number(searchBarTop + searchBarHeight) + 'px',}">
<view class="title">
<text class="title-text">最近搜索</text>
<u-icon name="trash" color="#666666" size="24" @click="clearRecentSearch"/>
<u-icon name="trash" color="#666666" size="24" @click="clearRecentSearch" />
</view>
<view class="recent-record">
<view v-if="recentRecordList.length > 0" class="no-empty-record">
<view v-if="recentRecordList.length > 0" class="no-empty-record">
<view v-for="(item, index) in recentRecordList" :key="index" class="tag-item">
<u-tag bg-color="#eee"
borderColor="#eee"
color="#666"
:text="item"
@click="recentSearch(item)"/>
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item"
@click="recentSearch(item)" />
</view>
</view>
<view v-else>
@@ -26,8 +23,6 @@
<text>暂无搜索记录</text>
</view>
</view>
</view>
</view>
<!-- 搜索发现 -->
@@ -37,21 +32,17 @@
</view>
<view class="found-record">
<view v-for="(item, index) in foundList" :key="index" class="tag-item">
<u-tag bg-color="#eee"
borderColor="#eee"
color="#666"
:text="item"
@click="recentSearch(item)"/>
<u-tag bg-color="#eee" borderColor="#eee" color="#666" :text="item" @click="recentSearch(item)" />
</view>
</view>
</view>
</view>
</template>
<script>
import { toast } from 'service/request.js'
import {
toast
} from 'service/request.js'
export default {
data() {
return {
@@ -92,7 +83,7 @@
const index = this.recentRecordList.findIndex(item => {
return item === param
})
if(index > -1) {
if (index > -1) {
this.recentRecordList.splice(index, 1)
}
this.recentRecordList.unshift(param)
@@ -102,7 +93,7 @@
},
recentSearch(obj) {
this.queryParam = obj
console.log(obj)
// console.log(obj)
},
clearRecentSearch() {
this.recentRecordList = []
@@ -121,6 +112,7 @@
padding: 32rpx 10rpx;
display: flex;
justify-content: space-between;
.title-text {
font-size: 32rpx;
font-family: PingFangSC-Regular, PingFang SC;
@@ -129,6 +121,7 @@
line-height: 42rpx;
}
}
.recent-record {
.empty-record {
font-size: 28rpx;
@@ -138,19 +131,23 @@
line-height: 28rpx;
text-align: center;
}
.no-empty-record {
display: flex;
flex-wrap: wrap;
padding: 0 10rpx;
.tag-item {
margin: 0 20rpx 20rpx 0;
}
}
}
}
.search-found {
.title {
padding: 32rpx 10rpx;
.title-text {
font-size: 32rpx;
font-family: PingFangSC-Regular, PingFang SC;
@@ -159,10 +156,12 @@
line-height: 42rpx;
}
}
.found-record {
display: flex;
flex-wrap: wrap;
padding: 0 10rpx;
.tag-item {
margin: 0 20rpx 20rpx 0;
}