search results contain achievement and product

This commit is contained in:
cxc
2022-12-07 11:22:32 +08:00
parent 081ba02e40
commit 4ba7585aaa
17 changed files with 472 additions and 64 deletions

View File

@ -93,12 +93,12 @@
<div class="val">{{ state.data.expert_count }}</div>
<div class="des">专家数量</div>
</div>
<!-- <div>
<div>
<div class="val">
{{ state.data.patent_count + state.data.achievement_count }}
{{ state.data.laboratory_count }}
</div>
<div class="des">专利成果数量</div>
</div> -->
<div class="des">实验室数量</div>
</div>
<div>
<div class="val">{{ state.data.demand_count }}</div>
<div class="des">需求数量</div>

View File

@ -210,11 +210,7 @@ function getDataList() {
resp.data.district
);
loading.value = false;
// }
});
// .catch(() => {
// loading.value = false;
// });
}
</script>

View File

@ -4,16 +4,22 @@
<div class="img" v-if="data.image">
<el-image :src="data.image" alt="" style="height: 150px" />
</div>
<div v-else class="type">成果</div>
<div v-else-if="data.type == 1" class="type">产品</div>
<div v-else-if="data.type == 2" class="type">成果</div>
<div class="content">
<div class="tit" @click="handleDetail(data.id)">{{ data.title }}</div>
<div class="tit" @click="handleDetail(data.dataId)">
{{
data.type == 2 ? "成果名称" : data.type == 1 ? "产品名称" : ""
}}
{{ data.title }}
</div>
<slot name="des" />
<div v-if="data.industryStr" class="line">
所属领域
<!-- <span>{{ data.industrys[data.industrys.length - 1] }}</span> -->
<span>{{ data.industryStr }}</span>
</div>
<div class="line">
<!-- <div class="line">
所属专家
<span>{{ data.expertName }}</span>
</div>
@ -23,7 +29,7 @@
maturityOptions.find((el) => el.key == data.maturity)?.value ??
"未知"
}}</span>
</div>
</div> -->
<div class="line">
联系人
<span>中科云平台</span>
@ -58,6 +64,7 @@ import wordcloud from "./wordcloud.vue";
// import collectAndVisit from "./collectAndVisit.vue";
import { maturityOptions } from "@/utils/parameter.js";
import { useRoute, useRouter } from "vue-router";
import { toRefs } from "vue";
const route = useRoute();
const router = useRouter();
@ -67,10 +74,19 @@ const props = defineProps({
required: true,
},
});
const { data } = toRefs(props);
function handleDetail(id) {
console.log(data.value);
let path;
if (data.value.type == 1) {
path = `/searchList/product/detail/${id}`;
} else if (data.value.type == 2) {
path = `/searchList/achievement/detail/${id}`;
} else {
return;
}
let routeData = router.resolve({
path: `/searchList/achievement/detail/${id}`,
path,
query: {
keyword: route.query.keyword,
queryType: route.query.queryType,

View File

@ -0,0 +1,367 @@
<template>
<div v-loading="loading">
<searchContainer
bannerKey="首页>产品库>产品详情"
title="产品库"
@handleQuery="handleQuery"
>
<template v-slot>
<div class="head">
<el-breadcrumb separator="/">
<el-breadcrumb-item>
<span class="one">找产品</span>
</el-breadcrumb-item>
<el-breadcrumb-item>
<span>产品详情</span>
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<el-row type="flex" style="padding-bottom: 20px">
<div style="flex: 1">
<achievementItem :data="state.expertDetail">
<template v-slot:des>
<div>{{ state.expertDetail.introduce }}</div>
</template>
</achievementItem>
<div class="btns">
<div class="order" @click="showDocking = true">预约对接</div>
<div class="share">一键分享</div>
</div>
<div class="detail">
<div style="padding: 20px 0">
<div class="pointTit">产品简介</div>
</div>
<div class="html" v-html="state.expertDetail.description"></div>
<div style="padding: 20px 0">
<div class="pointTit">所属单位</div>
</div>
<section>
{{ state.expertDetail.unit }}
</section>
<div style="padding: 20px 0">
<div class="pointTit">产品领先性</div>
</div>
<section>
<div>
{{
leadOptions.find(
(el) => el.key == state.expertDetail.leadStandard
)?.value
}}
</div>
</section>
<div style="padding: 20px 0">
<div class="pointTit">合作模式</div>
</div>
<section>
<div>
{{
cooperationOptions.find(
(el) => el.key == state.expertDetail.cooperationMode
)?.value
}}
</div>
</section>
<div style="padding: 20px 0">
<div class="pointTit">应用客户</div>
</div>
<section>
<div>
{{ state.expertDetail.customer }}
</div>
</section>
<div style="padding: 20px 0">
<div class="pointTit">所在地</div>
</div>
<section>
{{ state.localtion }}
</section>
</div>
</div>
<div class="r">
<webContact />
</div>
</el-row>
</template>
</searchContainer>
<docking v-model:visible="showDocking"></docking>
</div>
</template>
<script setup>
import webContact from "@/components/webContact/index.vue";
import achievementItem from "./components/achievementItem.vue";
// import loadMore from "./components/loadMore.vue";
// import request from "@/utils/request";
// import { onMounted } from "vue";
import searchContainer from "./components/searchContainer.vue";
// import wordcloud from "./components/wordcloud.vue";
// import productItem from "./components/productItem.vue";
import { searchAchievementDetail } from "@/api/website/home";
import { useRoute, useRouter } from "vue-router";
import { reactive, ref } from "vue";
import docking from "./components/docking.vue";
import { getCity } from "@/utils/city";
import { leadOptions, cooperationOptions } from "@/utils/parameter";
const showDocking = ref(false);
const loading = ref(true);
// import {lead}
const state = reactive({
pageNum: 1,
pageSize: 4,
keyword: "",
val: 3,
expertDetail: {},
arr: [
{
name: "Cat",
value: 26,
},
{
name: "fish",
value: 19,
},
],
activeName: "first",
});
const router = useRouter();
const route = useRoute();
// const searchResults = ref([]);
// const total = ref(0);
// const queryParams = reactive({
// pageNum: 1,
// pageSize: 5,
// searchType: 5,
// queryType: route.query.queryType,
// query: route.query.keyword,
// });
// 建议 列表前4条
// function recommend() {
// return request({
// url: "/v1/search",
// method: "post",
// data: {
// mode: 5,
// page: state.pageNum,
// page_size: state.pageSize,
// keyword: state.keyword,
// },
// });
// }
// 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 handleDetail(id) {
// let routeData = router.resolve({
// path: `/searchList/0/detail/${id}`,
// query: { keyword: state.keyword },
// });
// window.open(routeData.href, "_blank");
// }
function handleList(mode, keyword) {
router.push({
path: `/searchList/${mode}`,
query: { keyword, queryType: route.query.queryType },
});
}
// 首次加载数据,其后跳转页面
let flag = true;
function handleQuery(state) {
// queryParams.query = state.currentKeyword;
// queryParams.queryType = state.queryType;
if (flag) {
getDataList();
flag = false;
} else {
handleList("achievement", state.currentKeyword);
}
}
function getDataList() {
loading.value = true;
let id = route.params.id;
if (!id) return;
searchAchievementDetail(id)
// achievementDetail(id)
.then(async (resp) => {
// if (200 == res.code) {
console.log(resp.data);
state.expertDetail = resp.data;
state.localtion = await getCity(
resp.data.province,
resp.data.city,
resp.data.district
);
loading.value = false;
});
}
</script>
<style lang="scss" scoped>
:deep(.el-tabs) {
.el-tabs__item {
color: #666666;
font-size: 14px;
}
.el-tabs__item:hover {
opacity: 0.8;
}
.el-tabs__item.is-active {
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.el-tabs__active-bar {
background-color: #333333;
height: 4px;
}
.el-tabs__nav-wrap::after {
background-color: transparent;
}
}
.head {
padding: 15px 0px;
span {
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
}
.one {
color: #333333;
}
}
.r {
display: inline-block;
width: 325px;
margin-left: 14px;
min-height: 200px;
}
.detail {
width: 661px;
box-sizing: border-box;
padding: 20px;
background: #fff;
.describe {
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
margin-bottom: 5px;
}
}
.pointTit {
position: relative;
padding-left: 10px;
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: 500;
color: #333333;
&:before {
content: "";
top: 8px;
left: 0px;
position: absolute;
display: block;
width: 5px;
height: 5px;
background: #0054ff;
}
}
.btns {
overflow: hidden;
padding: 0 20px 20px 20px;
width: 100%;
background-color: #fff;
margin-top: -20px;
div {
margin-top: 20px;
text-align: center;
float: right;
cursor: pointer;
user-select: none;
width: 101px;
height: 36px;
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 400;
line-height: 36px;
box-sizing: border-box;
&:hover {
opacity: 0.7;
}
}
.share {
color: #333333;
background: #f2f6ff;
border: 1px solid #dcdcdc;
margin-right: 10px;
}
.order {
background: #0054ff;
color: #ffffff;
border: none;
}
}
.achievementItem,
.loadMoreItem {
padding: 20px;
background-color: #fff;
margin-bottom: 10px;
.tit {
margin-left: -8px;
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.line {
margin: 10px 0;
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
}
}
.patentItem {
padding: 20px;
background-color: #fff;
margin-bottom: 10px;
.tit {
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.line {
padding-left: 8px;
margin: 10px 0;
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
}
}
</style>