bugfix and performance improvements

This commit is contained in:
2023-07-26 17:24:49 +08:00
parent 2be4e29f37
commit 2ba5ff9439
98 changed files with 1900 additions and 1077 deletions

View File

@ -6,7 +6,8 @@
>
<div>
<el-row>
<el-col :push="4" :sm="10" :md="12">
<!-- <el-col :push="4" :sm="10" :md="16">-->
<el-col :push="4" :md="20">
<div class="tab">
<div
v-for="(v, index) in state.tabList"
@ -34,31 +35,22 @@
:placeholder="t('webSearch.placeholder')"
@keyup.enter="handleQuery"
>
<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>
<!-- <template #append>
<el-button
class="x_btns"
type="primary"
icon="Search"
@click="handleQuery"
>搜索</el-button
>
</template> -->
<!-- <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>-->
</el-input>
</el-form-item>
</el-col>
@ -72,7 +64,7 @@
>{{ t("webSearch.search") }}
</el-button>
<!-- <el-button class="x_btns" @click="handleQuery"
>发布需求</el-button
>{{ t("admin.table.publishDemand") }}</el-button
> -->
<!-- <el-button class="x_btns" @click="handleQuery"
>专家机构录入</el-button
@ -109,10 +101,6 @@
{{ t("quantityOverview.demand") }}
</div>
</div>
<!-- <div>
<div class="val">{{ state.data.docking_count }}</div>
<div class="des">对接数量</div>
</div> -->
<div>
<div class="val">{{ state.data.company_count }}</div>
<div class="des">
@ -122,32 +110,19 @@
</div>
</el-col>
</el-row>
<!-- <div class="icp-beian">
<el-link type="primary" href="https://beian.miit.gov.cn/"
>皖ICP备18001784号</el-link
>
</div> -->
</div>
<!-- <webFooter></webFooter> -->
</div>
</template>
<script setup>
// TODO:成果搜索添加按成果介绍搜索,需求搜索添加按需求描述搜索,添加实验室搜索
import { onMounted, reactive, watch } from "vue";
import { banner } from "@/api/website/home/index";
import { computed, onMounted, reactive, ref, watch } from "vue";
import { banner } from "@/api/website/home";
import { useRouter } from "vue-router";
import { getAllCount } from "../../../../api/website/home";
import { getAllCount } from "@/api/website/home";
import { useI18n } from "vue-i18n";
// import request from "@/utils/request";
const router = useRouter();
// function indexData() {
// return request({
// url: "/v1/index",
// method: "get",
// });
// }
const { t } = useI18n();
const testEnter = (ev) => {
@ -156,13 +131,17 @@ const testEnter = (ev) => {
console.log("rere");
};
const queryParams = reactive({
// queryType: undefined,
keyword: "",
queryType: "2",
});
const queryRules = reactive({
queryType: [{ required: true, trigger: "change", message: "请选择搜索类型" }],
keyword: [{ required: true, trigger: "blur", message: "请选择搜索关键词" }],
keyword: [
{
required: true,
trigger: "blur",
message: computed(() => t("webSearch.pleaseSelectSearchKeyword")),
},
],
});
const queryRef = ref();
const searchTypeList = ref([
@ -171,54 +150,8 @@ const searchTypeList = ref([
"lab",
"patent",
"expert",
// "serviceDemand",
"technologyDemand",
]);
// const patentQueryTypeList = ;
const queryTypeList = [
[
{ value: "1", label: "通过企业名称搜索" },
{ value: "2", label: "通过企业简介搜索" },
{ value: "3", label: "通过关键词搜索" },
{ value: "4", label: "通过生产方向搜索" },
{ value: "5", label: "通过产品搜索" },
],
[
{
value: "1",
label: "通过成果名称搜索",
},
{
value: "2",
label: "通过成果简介搜索",
},
],
[
{ value: "1", label: "通过实验室名称搜索" },
{ value: "2", label: "通过实验室简介搜索" },
],
[
{ value: "1", label: "通过标题搜索" },
{ value: "2", label: "通过摘要搜索" },
{ value: "3", label: "通过主权项搜索" },
{ value: "4", label: "通过作者搜索" },
],
[
{ value: "1", label: "通过专家名称搜索" },
{ value: "2", label: "通过个人简介搜索" },
{ value: "3", label: "通过关键词搜索" },
],
[
{ value: "1", label: "通过需求标题搜索" },
{ value: "2", label: "通过需求简介搜索" },
],
[],
[
{ value: "1", label: "通过实验室名称搜索" },
{ value: "2", label: "通过实验室简介搜索" },
],
// [{ value: "1", label: "通过标题搜索" }],
];
const handleDetail = async (mode, keyword, queryType) => {
console.log(mode);
@ -227,14 +160,10 @@ const handleDetail = async (mode, keyword, queryType) => {
path: `/searchList/${mode}`,
query: { keyword, queryType },
});
// window.open(routeData.href, "_blank");
router.push(routeData);
void router.push(routeData);
};
function handleQuery() {
// console.log(1234);
// console.log(queryParams.keyword, state.tabIndex);
// return;
handleDetail(
searchTypeList.value[state.tabIndex],
queryParams.keyword,
@ -250,7 +179,6 @@ const state = reactive({
"findLab",
"findPatent",
"findExpert",
// "接服务需求",
"findDemand",
],
tabIndex: 0,
@ -267,47 +195,17 @@ const state = reactive({
const switchTab = (index) => {
state.tabIndex = index;
// queryParams.queryType = undefined
// if(index)
queryRef.value.resetFields("queryType");
};
// watch(
// () => state.tabIndex,
// (val) => {
// console.log(val);
// // return [2, 0][val];
// queryParams.queryType = ["2", "2", "2", "2", "2", "2"][val];
// },
// { immediate: true }
// );
onMounted(() => {
banner({ locals: "首页背景" }).then((resp) => {
// console.log(resp);
state.banner = resp.data[0].images;
});
// state.data = {
// expert_count: 15,
// company_count: 9,
// patent_count: 181233,
// achievement_count: 12,
// demand_count: 0,
// docking_count: 0,
// distribution: {
// expert: null,
// laboratory: null,
// demand: null,
// patent: null,
// achievement: null,
// company: null,
// },
// };
getAllCount().then((res) => {
// if (200 == res.code) {
state.data = res.data;
// }
});
// console.log("onmunted");
});
</script>
@ -354,7 +252,7 @@ onMounted(() => {
.val {
font-size: 36px;
font-family: DIN;
font-family: DIN, sans-serif;
font-weight: 400;
color: #333333;
margin-bottom: 10px;
@ -362,19 +260,20 @@ onMounted(() => {
.des {
font-size: 16px;
font-family: Source Han Sans CN;
font-family: Source Han Sans CN, sans-serif;
font-weight: 400;
color: #333333;
}
}
.tab {
width: 630px;
//width: 630px;
height: 42px;
overflow: hidden;
& > div {
width: 90px;
//width: 90px;
padding: 0 12px;
height: 42px;
line-height: 42px;
text-align: center;