【update 首页】首页样式及高级搜索

This commit is contained in:
danshihao
2024-06-26 18:59:58 +08:00
parent e40a403d16
commit 87c76abddc
58 changed files with 1043 additions and 416 deletions
@@ -0,0 +1,142 @@
<template>
<!-- 搜索区域 -->
<div class="search-wrapper">
<a-select class="resource-type-select" v-model="resourceType">
<a-select-option value="all">{{ $t('dashboard.generalSearch.all')}}</a-select-option>
<a-select-option v-for="item in resourceTypeOptions" :key="item.value" :value="item.value" :title="item.title">
{{ item.title }}
</a-select-option>
</a-select>
<a-input class="search-input" v-model="searchValue" :placeholder="$t('pleaseEnter')" @pressEnter="searchInputEnter">
<a-icon slot="prefix" type="search" style="color: #0064FA;" />
</a-input>
<div class="btn-box">
<a-button type="primary" icon="search" @click="toSearchWindow('title')">{{ $t('dashboard.retrieval.titleSearch') }}</a-button>
<a-button type="primary" icon="search" @click="toSearchWindow('fullText')">{{ $t('dashboard.retrieval.fullSearch') }}</a-button>
<a-button type="primary" class="btn-ghost" ghost @click="toAdvancedSearch"><img :src="require('@/assets/image/icon/super-search.png')" alt='' class="btn-icon">{{ $t('dashboard.retrieval.advancedSearch') }}</a-button>
</div>
</div>
</template>
<script>
import { ajaxGetDictItems } from '@api/api'
export default {
name: 'RetrievalCard',
data () {
return {
resourceTypeOptions: [], // 资源类型下拉框数据
resourceType: 'all', // 资源类型
searchValue: '' // 检索内容
}
},
mounted () {
this.initResourceTypeOptions()
},
methods: {
// 获取资源类型下拉框数据
initResourceTypeOptions () {
ajaxGetDictItems('resource_type').then(res => {
if (res.success) {
this.resourceTypeOptions = res.result
}
})
},
// 点击跳转到一般检索页
toSearchWindow (type) {
const { href } = this.$router.resolve({
path: '/generalSearch',
query: {
type: type,
resourceType: this.resourceType,
searchValue: this.searchValue
}
})
window.open(href, '_blank')
},
// 点击跳转到高级检索页
toAdvancedSearch () {
const { href } = this.$router.resolve({
path: '/advancedSearch'
})
window.open(href, '_blank')
},
// 回车跳标题检索
searchInputEnter () {
const { href } = this.$router.resolve({
path: '/generalSearch',
query: {
type: 'title',
resourceType: this.resourceType,
searchValue: this.searchValue
}
})
window.open(href, '_blank')
}
}
}
</script>
<style lang="less" scoped>
@height: 56px;
.search-wrapper {
width: 80%;
margin: 0 auto;
display: grid;
grid-template-columns: 102px 1fr auto;
grid-gap: 10px;
& > .resource-type-select {
flex: 0 0 102px;
color: @primary-color;
/deep/.ant-select-arrow svg {
fill: @primary-color;
}
/deep/.ant-select-selection--single {
height: @height;
border-color: @primary-color;
}
/deep/.ant-select-arrow {
right: 20px;
}
/deep/.ant-select-selection__rendered {
line-height: @height;
margin-left: 20px;
margin-right: 34px;
}
}
& > .search-input {
flex: auto;
//margin-left: 10px;
/deep/.ant-input-prefix {
left: 24px;
}
/deep/.ant-input {
padding-left: 40px;
height: @height;
border-color: @primary-color;
}
}
.btn-box .ant-btn {
flex: 138px;
height: @height;
&:not(:first-child) {
margin-left: 10px;
}
}
}
.btn-icon {
margin-right: 8px;
vertical-align: top;
}
@media screen and (max-width: 1366px) {
@height: 42px;
}
</style>