<template>
|
|
<view class="page__view">
|
|
|
|
<!-- 导航栏 -->
|
|
<navbar title="搜索结果" leftClick @leftClick="$utils.navigateBack" bgColor="transparent" color="#191919" />
|
|
|
|
<!-- 搜索栏 -->
|
|
<view :class="['flex', 'search', isFocusSearch ? 'is-focus' : '']" >
|
|
<uv-search
|
|
v-model="keyword"
|
|
placeholder="输入关键词搜索"
|
|
color="#181818"
|
|
bgColor="transparent"
|
|
:showAction="isFocusSearch"
|
|
@custom="search"
|
|
@search="search"
|
|
@focus="isFocusSearch = true"
|
|
@blur="isFocusSearch = false"
|
|
>
|
|
<template #prefix>
|
|
<image class="search-icon" src="/static/image/icon-search-dark.png" mode="widthFix"></image>
|
|
</template>
|
|
</uv-search>
|
|
</view>
|
|
|
|
<view class="main">
|
|
<sortBar v-model="sort" @change="onSortChange"></sortBar>
|
|
|
|
<view v-if="list.length" class="list">
|
|
<recordsView :list="list"></recordsView>
|
|
</view>
|
|
<template v-else>
|
|
<uv-empty mode="list"></uv-empty>
|
|
</template>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import mixinsList from '@/mixins/list.js'
|
|
|
|
import sortBar from './sortBar.vue'
|
|
import recordsView from '@/components/growing/recordsView.vue'
|
|
|
|
export default {
|
|
mixins: [mixinsList],
|
|
components: {
|
|
sortBar,
|
|
recordsView,
|
|
},
|
|
data() {
|
|
return {
|
|
keyword: '',
|
|
isFocusSearch: false,
|
|
sort: 'comprehensive',
|
|
queryParams: {
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
activityTitle: '',
|
|
},
|
|
mixinsListApi: 'queryExperienceList',
|
|
}
|
|
},
|
|
onLoad({ search }) {
|
|
if (search) {
|
|
this.keyword = search
|
|
this.queryParams.activityTitle = search
|
|
}
|
|
|
|
this.getData()
|
|
},
|
|
methods: {
|
|
search() {
|
|
this.queryParams.pageNo = 1
|
|
this.queryParams.pageSize = 10
|
|
if (this.keyword) {
|
|
this.queryParams.activityTitle = this.keyword
|
|
} else {
|
|
delete this.queryParams.activityTitle
|
|
}
|
|
this.getData()
|
|
},
|
|
onSortChange(sort) {
|
|
console.log('onSortChange', sort)
|
|
this.getda()
|
|
},
|
|
beforeGetData() {
|
|
console.log('beforeGetData')
|
|
let params = {}
|
|
|
|
switch(this.sort) {
|
|
// 时间排序(dateOrder):0-从高到低 1-从低到高
|
|
case 'date-desc': // 时间排序 - 降序
|
|
params.dateOrder = '0'
|
|
break
|
|
case 'date-asc': // 时间排序 - 升序
|
|
params.dateOrder = '1'
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
|
|
return params
|
|
},
|
|
getDataThen(records) {
|
|
this.list = records.map(item => {
|
|
const { id, activityTitle, activityId_dictText, imageList, createTime } = item
|
|
|
|
return {
|
|
id,
|
|
name: activityTitle || activityId_dictText || '',
|
|
images: imageList?.split?.(',') || [],
|
|
createTime
|
|
}
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.search {
|
|
$h: 64rpx;
|
|
$radius: 32rpx;
|
|
$borderWidth: 4rpx;
|
|
|
|
margin: 24rpx 32rpx 0 32rpx;
|
|
width: calc(100% - 32rpx * 2);
|
|
height: $h;
|
|
position: relative;
|
|
border-radius: $radius;
|
|
|
|
&-icon {
|
|
margin: 0 13rpx 0 26rpx;
|
|
width: 30rpx;
|
|
height: auto;
|
|
}
|
|
|
|
/deep/ .uv-search__content {
|
|
padding: 12rpx 0;
|
|
background: #FFFFFF !important;
|
|
border-color: #CFEFFF !important;
|
|
border: 4rpx solid transparent;
|
|
}
|
|
|
|
&.is-focus {
|
|
/deep/ .uv-search__action {
|
|
padding: 19rpx 24rpx;
|
|
font-size: 26rpx;
|
|
font-weight: 500;
|
|
line-height: 1;
|
|
color: #FFFFFF;
|
|
background: #00A9FF;
|
|
border-radius: 32rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.main {
|
|
margin-top: 24rpx;
|
|
padding: 0 32rpx 100rpx 32rpx;
|
|
}
|
|
|
|
.content {
|
|
margin-top: 24rpx;
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 16rpx;
|
|
}
|
|
|
|
</style>
|