Merge pull request '合并代码' (#3) from factory_trust into factory
This commit is contained in:
commit
8c3a166168
|
|
@ -19,6 +19,10 @@ import img16 from '../image/icon16.png';
|
|||
import { rollingButton } from "../../../components/button";
|
||||
const { Search } = Input;
|
||||
function ProjectHomePage(props) {
|
||||
const {mygetHelmetapi} = props;
|
||||
const {common} = mygetHelmetapi || {};
|
||||
// const {governance="http://172.16.6.252:10010"} = common || {};
|
||||
const governance=(window.location.hostname=='172.16.6.250'||window.location.hostname=='localhost')?'http://172.16.6.252:10002':'http://27.122.114.160:4000/governanceAdmin'
|
||||
const carouselEL = createRef()
|
||||
const [current, setCurrent] = useState(0);
|
||||
const [cateList, setCateList] = useState(undefined);
|
||||
|
|
@ -60,11 +64,18 @@ function ProjectHomePage(props) {
|
|||
const topicsLength = topicsByCateId && topicsByCateId.length
|
||||
const LIMIT = !topicsLength ? 30 : 25;
|
||||
|
||||
const trustLevelMap = {
|
||||
'-1':'待治理',
|
||||
0: '不可信',
|
||||
1: '高度可信',
|
||||
2: '可信',
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCate();
|
||||
// getList();
|
||||
getCateTopic();
|
||||
document.title = '菌用开源软件仓库';
|
||||
document.title = '军用开源软件仓库';
|
||||
// 获取总数
|
||||
getInitCount();
|
||||
}, [])
|
||||
|
|
@ -114,14 +125,43 @@ function ProjectHomePage(props) {
|
|||
params.language_id = topicId.split(",")
|
||||
params.topic_id = undefined
|
||||
}
|
||||
|
||||
axios.get(url, { params }).then(result => {
|
||||
if (result && result.data) {
|
||||
setTotal(result.data.total_count);
|
||||
setProjectsList(result.data.projects);
|
||||
setIsSpin(false);
|
||||
// 遍历projects,请求供应链治理接口 获取可信等级
|
||||
const projectsWithTrustLevel = result.data.projects.map(async project => {
|
||||
try {
|
||||
const response = await axios.post(`${governance}/detect/software/trustPage`,
|
||||
{
|
||||
softwareName: project.identifier,
|
||||
size: 1,
|
||||
current: 1
|
||||
}
|
||||
);
|
||||
const records=response.data.data.records||[]
|
||||
const trustLevel = records.length > 0 ? records[0].isTrust : null;
|
||||
return {
|
||||
...project,
|
||||
trustLevel: trustLevel|| '-1' // 假设返回的数据中有一个 trustLevel 字段
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
...project,
|
||||
trustLevel: '-1' // 如果请求失败,设置 trustLevel 为 null 或其他适当的值
|
||||
};
|
||||
}
|
||||
});
|
||||
// 等待所有请求完成
|
||||
Promise.all(projectsWithTrustLevel).then(updatedProjects => {
|
||||
setProjectsList(updatedProjects);
|
||||
setIsSpin(false);
|
||||
}).catch(error => {
|
||||
setIsSpin(false);
|
||||
});
|
||||
}
|
||||
}).catch(error => { })
|
||||
}).catch(error => {
|
||||
setIsSpin(false);
|
||||
});
|
||||
}
|
||||
|
||||
function getList() {
|
||||
|
|
@ -141,8 +181,8 @@ function ProjectHomePage(props) {
|
|||
<div className="font-40 p_h_title p_h_title_2">服务可信<span className="p_h_title_text">资源共享</span></div>
|
||||
<div className="font-18 mb40 mt10 p_h_title_3">汇聚全球顶尖开源力量,构建安全、协同、创新的软件生态</div>
|
||||
</div>
|
||||
{/* <div className="font-60 p_h_title pt70">·<span className="p_h_title_text">护航菌事数智</span></div> */}
|
||||
{/* <div className="font-18 mb40">汇聚全球顶尖开源力量,构建安全、协同、创新的软件生态,赋能菌事数字化转型与智能化升级</div> */}
|
||||
{/* <div className="font-60 p_h_title pt70">·<span className="p_h_title_text">护航军事数智</span></div> */}
|
||||
{/* <div className="font-18 mb40">汇聚全球顶尖开源力量,构建安全、协同、创新的软件生态,赋能军事数字化转型与智能化升级</div> */}
|
||||
<div className="df">
|
||||
<div className="color-white project_count flex1 FlexAJ" style={{justifyContent: count.length > 3 ? 'space-between' : 'space-around'}}>
|
||||
{count.map((item, index)=>{
|
||||
|
|
@ -249,10 +289,11 @@ function ProjectHomePage(props) {
|
|||
{projectsList.map(i => {
|
||||
const url = i.author ? `/${i.author.login}/${i.identifier}${cateID === 39 ? "" : "/about"}` : ``
|
||||
return <div className="home_project">
|
||||
{i.trustLevel !== null && trustLevelMap[i.trustLevel] && <span className={`trustLevel trustLevel${i.trustLevel}`}>{trustLevelMap[i.trustLevel]}</span>}
|
||||
<div className="df a-i-center mb5">
|
||||
{i.lesson_url && <img src={getImageUrl(`${i.lesson_url}`)} alt="" className="author_img" />}
|
||||
{/* {!i.lesson_url && <img src={require("../image/icon14.png").default} alt="" className="author_img" />} */}
|
||||
<div className="flex1">
|
||||
<div className={`flex1 ${i.trustLevel!== null ? 'pr35' : ''}`}>
|
||||
<Link to={url}><div className="task-hide font-16 color-dark hover-light" style={{ marginTop: '-5px' }} title={i.name}>{i.name}</div></Link>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -229,6 +229,33 @@
|
|||
box-shadow: 0 0 12px rgba(92, 102, 193, 0.05);
|
||||
overflow: hidden;
|
||||
|
||||
.trustLevel{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
width:72px;
|
||||
height:29px;
|
||||
text-align: center;
|
||||
padding-top: 2px;
|
||||
font-size: 13px;
|
||||
clip-path: polygon(12px 0%, 100% 0%, 100% 100%, 0% 100%);
|
||||
color:#f8952d;
|
||||
background:linear-gradient(175.67deg,#fdcc97 7.9%,rgba(255, 255, 255, 0) 92.58%);
|
||||
}
|
||||
.trustLevel0{
|
||||
color: #FF3838;
|
||||
background:#FF9A9A;
|
||||
}
|
||||
.trustLevel2{
|
||||
color: #1c9907;
|
||||
background:linear-gradient(175.67deg,#bfeab8 7.9%,rgba(255, 255, 255, 0) 92.58%);
|
||||
}
|
||||
.trustLevel1{
|
||||
color:#6c59ff;
|
||||
padding-left: 4px;
|
||||
background:linear-gradient(175.67deg,#bfb7ff 7.9%,rgba(255, 255, 255, 0) 92.58%);
|
||||
}
|
||||
|
||||
.task-hide-2 {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ function List() {
|
|||
{firstActivity && <div className="first-activity width1600 FlexAJ">
|
||||
<Link style={{whiteSpace: 'break-spaces'}} className="font-36 font-bd lineh-50 first-activity-name" to={`/news/${firstActivity.id}`}>{firstActivity.summary}</Link>
|
||||
<img src={firstActivity.headImg} alt="" width={186} className="headImg"/>
|
||||
<span className="font-38 font-bd lineh-50">{moment(firstActivity.name).format('MM/DD')}<br/>{moment(firstActivity.name).format('HH:MM')}</span>
|
||||
<span className="font-38 font-bd lineh-50">{moment(firstActivity.name).format('MM/DD')}<br/>{moment(firstActivity.name).format('HH:mm')}</span>
|
||||
<RenderHtml value={firstActivity.content} className="first-activity-content"/>
|
||||
<Link to={`/news/${firstActivity.id}`}><i className="iconfont icon-jiantou4"></i></Link>
|
||||
</div>}
|
||||
|
|
|
|||
Loading…
Reference in New Issue