Files
2022-11-25 17:30:39 +08:00

203 lines
4.8 KiB
Vue

<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>{{ total }}</span> 个实验室
</div>
<div v-loading="loading">
<section v-for="item in searchResults" :key="item.id">
<div style="border: 1px solid #dcdcdc; margin-bottom: 10px">
<!-- <gainItem :data="item"></gainItem> -->
<LaboratoryItem :data="item"></LaboratoryItem>
</div>
</section>
</div>
<pagination
class="pagination"
:total="total"
:pageSizes="[10, 10 << 1, 10 << 2, 10 << 3]"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:autoScroll="false"
@pagination="getDataList"
/>
</div>
</div>
<div class="r">
<WebContact />
</div>
</el-row>
</template>
</searchContainer>
</div>
</template>
<script setup>
// import request from "@/utils/request";
import { onMounted, reactive } from "vue";
import { search } from "@/api/website/home/index";
import WebContact from "@/components/webContact/index.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";
import { useRoute, useRouter } from "vue-router";
import LaboratoryItem from "./components/laboratoryItem.vue";
// const router = useRouter();
const route = useRoute();
const queryParams = reactive({
pageNum: 1,
pageSize: 5,
searchType: 8,
queryType: route.query.queryType,
query: route.query.keyword,
});
// function handleDetail(id) {
// let routeData = router.resolve({
// path: `/searchList/0/detail/${id}`,
// query: { keyword: queryParams.query },
// });
// window.open(routeData.href, "_blank");
// }
const loading = ref(false);
const searchResults = ref([]);
const total = ref(0);
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;
}
// const getSearchResult = async () => {
// const resp = await search(queryParams);
// console.log(resp);
// };
function handleQuery(state) {
// state.keyword = keyword;
queryParams.query = state.currentKeyword;
queryParams.queryType = state.queryType;
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();
// }
const getDataList = async () => {
loading.value = true;
try {
const resp = await search(queryParams);
searchResults.value = resp.list;
total.value = resp.total;
loading.value = false;
} catch (error) {
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>