Files

331 lines
7.8 KiB
Vue
Raw Normal View History

2022-09-20 17:31:39 +08:00
<template>
2022-10-13 17:42:32 +08:00
<div
class="box"
style="background-size: cover; background-color: #fff"
:style="{ backgroundImage: state.banner ? `url(${state.banner})` : '' }"
>
<div>
<el-row>
2023-07-26 17:24:49 +08:00
<!-- <el-col :push="4" :sm="10" :md="16">-->
<el-col :push="4" :md="20">
2022-10-13 17:42:32 +08:00
<div class="tab">
<div
v-for="(v, index) in state.tabList"
:class="{ active: state.tabIndex == index }"
@click="switchTab(index)"
>
2022-12-05 08:46:00 +08:00
<!-- :style="v === '找实验室' ? `display:none` : ''" -->
2023-07-11 17:21:34 +08:00
{{ t(`webSearch.${v}`) }}
2022-10-13 17:42:32 +08:00
</div>
</div>
</el-col>
</el-row>
<div style="height: 16px"></div>
2022-12-05 08:46:00 +08:00
<el-form
:model="queryParams"
:rules="queryRules"
ref="queryRef"
@submit.prevent
>
2022-10-13 17:42:32 +08:00
<el-row>
<el-col :push="4" :sm="10" :md="12">
<el-form-item prop="keyword">
<el-input
v-model.trim="queryParams.keyword"
2023-07-11 17:21:34 +08:00
:placeholder="t('webSearch.placeholder')"
2022-12-05 08:46:00 +08:00
@keyup.enter="handleQuery"
2022-10-13 17:42:32 +08:00
>
2023-07-26 17:24:49 +08:00
<!-- <template #suffix v-if="false">-->
<!-- <el-form-item prop="queryType">-->
<!-- <el-select-->
<!-- v-model="queryParams.queryType"-->
<!-- placeholder="请选择搜索类型"-->
<!-- class="search-type-select"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in queryTypeList[state.tabIndex]"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </template>-->
2022-10-13 17:42:32 +08:00
</el-input>
</el-form-item>
</el-col>
<el-col :push="4" :sm="10" :md="8">
<div class="btnsWrap">
2022-10-27 13:39:36 +08:00
<el-button
class="x_btns"
type="primary"
icon="Search"
@click="handleQuery"
2023-07-11 17:21:34 +08:00
>{{ t("webSearch.search") }}
</el-button>
2022-10-27 13:39:36 +08:00
<!-- <el-button class="x_btns" @click="handleQuery"
2023-07-26 17:24:49 +08:00
>{{ t("admin.table.publishDemand") }}</el-button
2022-10-27 13:39:36 +08:00
> -->
<!-- <el-button class="x_btns" @click="handleQuery"
2022-10-13 17:42:32 +08:00
>专家机构录入</el-button
2022-10-27 13:39:36 +08:00
> -->
2022-10-13 17:42:32 +08:00
</div>
</el-col>
</el-row>
</el-form>
<div style="height: 15vh"></div>
<el-row>
<el-col :push="3" :pull="3" :span="18">
<div class="numBox">
2022-10-19 00:22:39 +08:00
<div>
<div class="val">{{ state.data.patent_count }}</div>
2023-07-11 17:21:34 +08:00
<div class="des">{{ t("quantityOverview.patent") }}</div>
2022-10-19 00:22:39 +08:00
</div>
2022-10-13 17:42:32 +08:00
<div>
<div class="val">{{ state.data.expert_count }}</div>
2023-07-11 17:21:34 +08:00
<div class="des">
{{ t("quantityOverview.expert") }}
</div>
2022-10-13 17:42:32 +08:00
</div>
<div>
2022-10-13 17:42:32 +08:00
<div class="val">
{{ state.data.laboratory_count }}
2022-10-13 17:42:32 +08:00
</div>
2023-07-11 17:21:34 +08:00
<div class="des">
{{ t("quantityOverview.lab") }}
</div>
</div>
2022-10-13 17:42:32 +08:00
<div>
<div class="val">{{ state.data.demand_count }}</div>
2023-07-11 17:21:34 +08:00
<div class="des">
{{ t("quantityOverview.demand") }}
</div>
2022-10-13 17:42:32 +08:00
</div>
<div>
<div class="val">{{ state.data.company_count }}</div>
2023-07-11 17:21:34 +08:00
<div class="des">
{{ t("quantityOverview.company") }}
</div>
2022-10-13 17:42:32 +08:00
</div>
</div>
</el-col>
</el-row>
</div>
</div>
2022-09-20 17:31:39 +08:00
</template>
2022-10-13 17:42:32 +08:00
<script setup>
2022-11-17 17:29:47 +08:00
// TODO:成果搜索添加按成果介绍搜索,需求搜索添加按需求描述搜索,添加实验室搜索
2023-08-02 10:43:49 +08:00
import { computed, onMounted, reactive, ref } from "vue";
import { banner, getAllCount } from "@/api/website/home";
2022-10-13 17:42:32 +08:00
import { useRouter } from "vue-router";
2023-07-11 17:21:34 +08:00
import { useI18n } from "vue-i18n";
2022-10-13 17:42:32 +08:00
const router = useRouter();
2022-12-05 08:46:00 +08:00
2023-07-11 17:21:34 +08:00
const { t } = useI18n();
2022-12-05 08:46:00 +08:00
const testEnter = (ev) => {
ev.stopPropagation();
ev.preventDefault();
console.log("rere");
};
2022-10-13 17:42:32 +08:00
const queryParams = reactive({
keyword: "",
2022-11-17 17:29:47 +08:00
queryType: "2",
2022-10-13 17:42:32 +08:00
});
const queryRules = reactive({
2023-07-26 17:24:49 +08:00
keyword: [
{
required: true,
trigger: "blur",
message: computed(() => t("webSearch.pleaseSelectSearchKeyword")),
},
],
2022-10-13 17:42:32 +08:00
});
const queryRef = ref();
const searchTypeList = ref([
"enterprise",
2022-10-27 13:39:36 +08:00
"achievement",
2022-10-13 17:42:32 +08:00
"lab",
"patent",
"expert",
2022-10-27 13:39:36 +08:00
"technologyDemand",
2022-10-13 17:42:32 +08:00
]);
2022-11-17 17:29:47 +08:00
2022-10-13 17:42:32 +08:00
const handleDetail = async (mode, keyword, queryType) => {
2022-11-25 17:30:39 +08:00
console.log(mode);
2022-10-13 17:42:32 +08:00
await queryRef.value.validate();
const routeData = router.resolve({
path: `/searchList/${mode}`,
query: { keyword, queryType },
});
2023-07-26 17:24:49 +08:00
void router.push(routeData);
2022-10-13 17:42:32 +08:00
};
function handleQuery() {
handleDetail(
searchTypeList.value[state.tabIndex],
queryParams.keyword,
queryParams.queryType
);
}
const state = reactive({
keyword: "",
2022-10-27 13:39:36 +08:00
tabList: [
2023-07-11 17:21:34 +08:00
"findCompany",
"findAchievement",
"findLab",
"findPatent",
"findExpert",
"findDemand",
2022-10-27 13:39:36 +08:00
],
2022-10-13 17:42:32 +08:00
tabIndex: 0,
banner: "",
data: {
expert_count: 0,
company_count: 0,
patent_count: 0,
achievement_count: 0,
2023-08-02 10:43:49 +08:00
laboratory_count: 0,
2022-10-13 17:42:32 +08:00
demand_count: 0,
docking_count: 0,
},
});
2022-11-17 17:29:47 +08:00
const switchTab = (index) => {
state.tabIndex = index;
queryRef.value.resetFields("queryType");
};
2022-10-13 17:42:32 +08:00
onMounted(() => {
banner({ locals: "首页背景" }).then((resp) => {
state.banner = resp.data[0].images;
});
2023-07-26 17:24:49 +08:00
2022-10-19 00:22:39 +08:00
getAllCount().then((res) => {
state.data = res.data;
});
2022-10-13 17:42:32 +08:00
});
</script>
2022-09-20 17:31:39 +08:00
<style lang="scss" scoped>
2022-10-13 17:42:32 +08:00
.x_btns {
font-size: 14px !important;
font-weight: 400;
}
2023-07-11 17:21:34 +08:00
2022-09-20 17:31:39 +08:00
.box {
height: 100%;
width: 100%;
2022-10-13 17:42:32 +08:00
display: flex;
display: -webkit-flex;
align-items: center;
justify-content: center;
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
& > div {
width: 100%;
}
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
.btnsWrap {
margin: 0 0 0 40px;
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
.el-button {
height: 36px;
padding: 10px 25px;
}
}
.numBox {
display: flex;
display: -webkit-flex;
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
& > div {
flex: 1;
height: 200px;
display: -webkit-flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
.val {
font-size: 36px;
2023-07-26 17:24:49 +08:00
font-family: DIN, sans-serif;
2022-10-13 17:42:32 +08:00
font-weight: 400;
color: #333333;
margin-bottom: 10px;
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
.des {
font-size: 16px;
2023-07-26 17:24:49 +08:00
font-family: Source Han Sans CN, sans-serif;
2022-10-13 17:42:32 +08:00
font-weight: 400;
color: #333333;
}
}
.tab {
2023-07-26 17:24:49 +08:00
//width: 630px;
2022-10-13 17:42:32 +08:00
height: 42px;
overflow: hidden;
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
& > div {
2023-07-26 17:24:49 +08:00
//width: 90px;
padding: 0 12px;
2022-10-13 17:42:32 +08:00
height: 42px;
line-height: 42px;
text-align: center;
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #333333;
float: left;
cursor: pointer;
user-select: none;
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
& > div.active {
font-size: 14px;
font-weight: 500;
color: #ffffff;
line-height: 38px;
background-image: url(./img/index1-bg1.png);
background-size: cover;
}
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
.wrap {
padding-left: 460px;
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
.search {
width: 720px;
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
.icp-beian {
width: 100vw;
text-align: center;
position: absolute;
bottom: 10px;
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
// :deep(.el-input__inner) {
// border: 0px solid blueviolet !important;
// }
.search-type-select {
margin: 1px 0;
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
:deep(.el-input__inner) {
// border: 0px solid blueviolet !important;
height: 30px;
box-shadow: none;
}
2023-07-11 17:21:34 +08:00
2022-10-13 17:42:32 +08:00
:deep(.el-input.is-focus .el-input__inner) {
box-shadow: none;
}
2022-09-20 17:31:39 +08:00
}
2023-08-04 17:26:52 +08:00
</style>