banner右侧增加三方组件类型数量显示

This commit is contained in:
谢思 2025-11-15 09:46:23 +08:00
parent 6a76e90ac5
commit 29732b5e8b
2 changed files with 16 additions and 8 deletions

View File

@ -22,7 +22,7 @@ function ProjectHomePage(props) {
const [topicId, setTopicId] = useState(undefined);
const [topicDetail, setTopicDetail] = useState(undefined);
const [count, setCount] = useState({});
const {countByGHM, countByOther} = count;
const {countByGHM, countByOther, countByGHMType} = count;
const topicsByCateId = cateTopics && cateTopics[cateID];
// const topicsByCateId = cateTopics && cateTopics[cateID] || [
// {
@ -65,7 +65,8 @@ function ProjectHomePage(props) {
function getInitCount() {
const obj = {
countByGHM: 0,
countByOther: 0
countByOther: 0,
countByGHMType: 0
}
axios.get(`/organizations/gh_mirrors/projects.json?page=1&limit=15&sort_by=updated_on&sort_direction=desc`).then(result => {
if (result && result.data) {
@ -76,8 +77,10 @@ function ProjectHomePage(props) {
if (result && result.data) {
obj.countByOther = result.data.total_count - obj.countByGHM
}
}).finally(()=>{
cateTopics[39] && (obj.countByGHMType = cateTopics[39].length)
setCount(obj);
}).catch(error => { })
})
}
function getCateTopic() {
@ -152,12 +155,17 @@ function ProjectHomePage(props) {
<div className="df color-white project_count glass-effect">
<div className="center">
<p>{countByOther}</p>
<span className="font-14 opacity80">软件包总数</span>
<span className="font-14 opacity80">软件数量</span>
</div>
<Divider type="vertical" />
<div className="center">
<p>{countByGHMType}</p>
<span className="font-14 opacity80">支持三方组件类型</span>
</div>
<Divider type="vertical" />
<div className="center">
<p>{countByGHM}</p>
<span className="font-14 opacity80">可信三方组件数</span>
<span className="font-14 opacity80">三方组件数</span>
</div>
</div>
</div>

View File

@ -50,8 +50,8 @@
}
.project_count {
width: 343px;
height: 103px;
width: 500px;
height: 110px;
// background-image: url('./img/count_bg.png');
// background-size: 100% 100%;
justify-content: space-evenly;
@ -68,7 +68,7 @@
font-family: "YouSheBiaoTiHei";
}
.center{
min-width: 45%;
min-width: 30%;
}
}
}