From 028d7102c4ed49bd3d65d9755ae9b751e1890887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Sat, 16 Nov 2024 14:21:42 +0800 Subject: [PATCH] =?UTF-8?q?uos=E4=B8=93=E9=A1=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BC=9A=E8=AE=AE=E6=8A=A5=E5=91=8A=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homepage/component/specialProjects.jsx | 45 +++++++++++++------ src/forge/Information/api.js | 8 ++++ 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/forge/Information/Pages/homepage/component/specialProjects.jsx b/src/forge/Information/Pages/homepage/component/specialProjects.jsx index 58fe5b381..280d60a92 100644 --- a/src/forge/Information/Pages/homepage/component/specialProjects.jsx +++ b/src/forge/Information/Pages/homepage/component/specialProjects.jsx @@ -1,5 +1,5 @@ import React , { useEffect, useState } from 'react'; -import { getSpecialProjectDetail, getSpecialProjectList, getSpecialProjectTypeList, getImage } from '../../../api'; +import { getSpecialProjectDetail, getSpecialProjectList, getSpecialProjectTypeList, getImage, getSpecialReportList } from '../../../api'; import { Col, Divider, Icon, Row, Tag } from 'antd'; import Nodata from '../../../../Nodata'; import '../index.scss'; @@ -48,25 +48,38 @@ function SpecialProjects({data, subTitle}) { return res.data; } + async function getRelevancyListByReport(id, pageSize=5) { + const res = await getSpecialReportList({ + specialProjectId: id, + pageNum: 1, + pageSize + }); + return res.data; + } + const handleItemClick = async (id) => { setSelectedItem(selectedItem === id ? null : id); if(id === selectedItem) return const data = await Promise.all(relevancyTypes.map(async (item) => { return {[item]: await getRelevancyList(id, item)}; })); - const [a,b,c] = data + data.push({ + REPORT: await getRelevancyListByReport(id) + }) + const [a,b,c,d] = data setProjectDetail({ detail: projectList.find(item => item.id === id), ...a, ...b, - ...c + ...c, + ...d }); }; const showMore = (type, isShowAll) => { return
{
- const data = await getRelevancyList(selectedItem, type, isShowAll ? 5 : 1000);
+ const data = type === "REPORT" ? await getRelevancyListByReport(selectedItem, isShowAll ? 5 : 1000): await getRelevancyList(selectedItem, type, isShowAll ? 5 : 1000);
const detail = {
...projectDetail
}
@@ -77,7 +90,12 @@ function SpecialProjects({data, subTitle}) {
}
const listItem = (title, table1, table2, table3, res)=>{
- const type = title === "论文" ? "PAPER": "PATENT"
+ const typekey = {
+ "论文": "PAPER",
+ "专利": "PATENT",
+ "会议报告": "REPORT"
+ }
+ const type = typekey[title];
const {rows:list, total} = res;
const isShowAll = list.length === total
return !!list.length &&
: title === "专利" ?
: }
+ {title !== "会议报告" ?
+ {title === "论文" ?
: title === "专利" ?
: }
{name}
-
+
简介: