From 9c0bf3d30988dbbef049b6f4a7765d34928f046e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Tue, 28 May 2024 08:36:31 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=BB=E5=83=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/AppConfig.js | 2 +-
src/forge/Component/Component.scss | 2 +-
src/forge/Component/projectPortrait.jsx | 88 +++++++++++++++++++++++++
src/forge/Main/CoderDepot.jsx | 3 +
4 files changed, 93 insertions(+), 2 deletions(-)
create mode 100644 src/forge/Component/projectPortrait.jsx
diff --git a/src/AppConfig.js b/src/AppConfig.js
index 2b6b74135..326cfbb03 100644
--- a/src/AppConfig.js
+++ b/src/AppConfig.js
@@ -25,7 +25,7 @@ if (isDev) {
}
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
- window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || ''
+ window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {
diff --git a/src/forge/Component/Component.scss b/src/forge/Component/Component.scss
index 92c973d24..1a08309f2 100644
--- a/src/forge/Component/Component.scss
+++ b/src/forge/Component/Component.scss
@@ -165,7 +165,7 @@ li.ant-menu-item{
.hoverA{
display:flex;
align-items: center;
- max-width: 78px;
+ max-width: 100px;
&:hover a{
color:#2A61FF !important ;
}
diff --git a/src/forge/Component/projectPortrait.jsx b/src/forge/Component/projectPortrait.jsx
new file mode 100644
index 000000000..18eda908b
--- /dev/null
+++ b/src/forge/Component/projectPortrait.jsx
@@ -0,0 +1,88 @@
+import React ,{ Fragment, useEffect } from 'react';
+import echarts from 'echarts/lib/echarts'
+import 'echarts/lib/chart/radar';
+import 'echarts/lib/component/tooltip';
+import axios from 'axios';
+import { Icon, Popover } from 'antd';
+
+function Radar({owner,projectsId}) {
+
+ useEffect(()=>{
+ const url = `/v1/${owner}/${projectsId}/portrait.json`;
+ axios.get(url).then(res=>{
+ if(res && res.data){
+ Init(res.data);
+ }
+ }).catch(error=>{})
+ },[])
+
+ function Init(data) {
+ var huan_val = document.getElementById("projectPortrait");
+ var myEcharts = echarts.init(huan_val);
+ let option = {
+ color: ["#f8e367", "#99dfff", "#58c0f0", "#5ea6ff", "#ff9e48", "#bcbcbc"],
+ title: {
+ show:false
+ },
+ tooltip: {
+ trigger: 'item',
+ formatter: (params) =>{
+ const {name, seriesName, value} = params
+ const tips = seriesName.split(",").map((item, index)=>{
+ return `${item}:${(value[index]-20).toFixed(2)}`
+ })
+ return [name].concat(tips).join("
")
+ }
+ },
+ radar: {
+ indicator: [
+ { name: '社区\n影响力', max: 120},
+ { name: '项目\n成熟度', max: 120},
+ { name: '项目\n健康度', max: 120},
+ { name: '团队\n影响度', max: 120},
+ { name: '开发\n活跃度', max: 120},
+ ],
+ center:["50%","55%"]
+ },
+ series: [{
+ name: "社区影响力,项目成熟度,项目健康度,团队影响度,开发活跃度",
+ type: 'radar',
+ data: [
+ {
+ value: [addTwenty(data.community_impact), addTwenty(data.project_maturity), addTwenty(data.project_health), addTwenty(data.team_impact), addTwenty(data.develop_activity)],
+ name: '本项目评分'
+ },
+ ]
+ }]
+ };
+ myEcharts.setOption(option);
+ }
+
+ function addTwenty(number){
+ return Number(number)+20
+ }
+
+ const content = (
+