首页搜索
This commit is contained in:
222
src/views/website/searchList/index2.vue
Normal file
222
src/views/website/searchList/index2.vue
Normal file
@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<div class="index">
|
||||
<searchContainer
|
||||
bannerKey="首页>实验室库>实验室列表"
|
||||
title="实验室库"
|
||||
@handleQuery="handleQuery"
|
||||
>
|
||||
<template v-slot>
|
||||
<el-row type="flex" style="padding: 20px 0;">
|
||||
<div style="flex: 1">
|
||||
<div style="position: relative;">
|
||||
<industrySelect @industryChange="industryChange"></industrySelect>
|
||||
<div class="total">
|
||||
共找到
|
||||
<span>{{ state.total }}</span> 个实验室
|
||||
</div>
|
||||
<div v-loading="loading">
|
||||
<section v-for="item in state.list" :key="item.id">
|
||||
<div style="border: 1px solid #DCDCDC;margin-bottom: 10px;">
|
||||
<gainItem :data="item"></gainItem>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<pagination
|
||||
class="pagination"
|
||||
:total="state.total"
|
||||
:pageSizes="state.pageSizes"
|
||||
v-model:page="state.pageNum"
|
||||
v-model:limit="state.pageSize"
|
||||
:autoScroll="false"
|
||||
@pagination="getDataList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="r">
|
||||
<webContact />
|
||||
</div>
|
||||
</el-row>
|
||||
</template>
|
||||
</searchContainer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import webContact from "@/components/webContact/index.vue";
|
||||
import request from '@/utils/request'
|
||||
const router = useRouter();
|
||||
import { onMounted } from 'vue';
|
||||
import searchContainer from './components/searchContainer.vue'
|
||||
import industrySelect from './components/industrySelect.vue'
|
||||
import gainItem from './components/gainItem.vue'
|
||||
import wordcloud from './components/wordcloud.vue'
|
||||
|
||||
function handleDetail (id) {
|
||||
let routeData = router.resolve({ path: `/searchList/0/detail/${id}`, query: { keyword: state.keyword } });
|
||||
window.open(routeData.href, '_blank');
|
||||
}
|
||||
|
||||
const loading = ref(true);
|
||||
const state = reactive({
|
||||
pageNum: 1,
|
||||
total: 1,
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 10 << 1, 10 << 2, 10 << 3],
|
||||
keyword: '',
|
||||
industryList: [],
|
||||
id1: '',
|
||||
id2: '',
|
||||
id3: '',
|
||||
val: 3,
|
||||
arr: [{
|
||||
"name": "Cat",
|
||||
"value": 26
|
||||
},
|
||||
{
|
||||
"name": "fish",
|
||||
"value": 19
|
||||
}]
|
||||
});
|
||||
|
||||
function createdData (arr) {
|
||||
let l = [];
|
||||
let snap = JSON.parse(JSON.stringify(arr))
|
||||
snap.map(e => {
|
||||
l.push({ name: e, value: 30 })
|
||||
return { name: e, value: 30 }
|
||||
})
|
||||
return l;
|
||||
}
|
||||
function search () {
|
||||
let industry = '';
|
||||
if (state.id1) {
|
||||
industry += state.id1;
|
||||
}
|
||||
if (state.id2) {
|
||||
industry += `-${state.id2}`;
|
||||
}
|
||||
if (state.id3) {
|
||||
industry += `-${state.id3}`;
|
||||
}
|
||||
return request({
|
||||
url: '/v1/search',
|
||||
method: 'post',
|
||||
data: { industry, mode: 3, page_num: state.pageNum, page_size: state.pageSize, keyword: state.keyword }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleQuery (keyword) {
|
||||
state.keyword = keyword;
|
||||
getDataList()
|
||||
}
|
||||
function industryChange (industry) {
|
||||
if (industry.id1) {
|
||||
state.id1 = industry.id1;
|
||||
}
|
||||
if (industry.id2) {
|
||||
state.id2 = industry.id2;
|
||||
}
|
||||
if (industry.id3) {
|
||||
state.id3 = industry.id3;
|
||||
}
|
||||
getDataList()
|
||||
}
|
||||
|
||||
function getDataList () {
|
||||
loading.value = true;
|
||||
search().then(res => {
|
||||
if (200 == res.code) {
|
||||
// 总条数
|
||||
state.total = res.data.count;
|
||||
state.list = res.data.data;
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.total {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
margin-bottom: 20px;
|
||||
span {
|
||||
font-size: 30px;
|
||||
color: #0054ff;
|
||||
}
|
||||
}
|
||||
|
||||
.r {
|
||||
display: inline-block;
|
||||
width: 325px;
|
||||
margin-left: 14px;
|
||||
min-height: 200px;
|
||||
// background-color: #fff;
|
||||
}
|
||||
|
||||
.item {
|
||||
height: 200px;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
margin-bottom: 16px;
|
||||
|
||||
.img {
|
||||
width: 90px;
|
||||
margin-right: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
img {
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
display: inline-block;
|
||||
width: 390px;
|
||||
.line {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
margin: 10px 0;
|
||||
span {
|
||||
font-size: 16px;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
.keywords {
|
||||
flex: 1;
|
||||
width: 129px;
|
||||
height: 129px;
|
||||
}
|
||||
.tit {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
.text {
|
||||
margin-right: 200px;
|
||||
overflow: hidden;
|
||||
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 20px;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user