From dd20d02477826301eff100d7e57895b311392d65 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 2 Jun 2021 18:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E4=B8=8A=3Dissue=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/users/Echart/Calendar.jsx | 42 ++++++++--- src/forge/users/Echart/Line.jsx | 22 +++--- src/forge/users/GeneralView/Index.jsx | 16 ++-- src/forge/users/Infos.js | 32 ++++---- src/forge/users/Statistics/Index.jsx | 101 ++++++++++++++------------ src/forge/users/Statistics/Index.scss | 2 +- 6 files changed, 129 insertions(+), 86 deletions(-) diff --git a/src/forge/users/Echart/Calendar.jsx b/src/forge/users/Echart/Calendar.jsx index 1fde52840..743a0a551 100644 --- a/src/forge/users/Echart/Calendar.jsx +++ b/src/forge/users/Echart/Calendar.jsx @@ -10,7 +10,7 @@ function Calendar({ userLogin , time , chooseTime }) { useEffect(()=>{ if(time){ let e,b = ""; - if(time === "0"){ + if(parseInt(time,0) === parseInt(moment().get('year'),0)){ let y = moment().get('year'); let m = moment().get('month'); let d = moment().get('date'); @@ -52,9 +52,18 @@ function Calendar({ userLogin , time , chooseTime }) { } function getVirtulData(data) { + var date = +echarts.number.parseDate(baginT); + var end = +echarts.number.parseDate(endT); + var dayTime = 3600 * 24 * 1000; var array = []; - for(var i=0;ii.date === stamp); + if(stampFilter && stampFilter.length > 0){ + array.push([stampFilter[0].date,stampFilter[0].contributions]); + }else{ + array.push([stamp,0]); + } } return array; } @@ -74,7 +83,11 @@ function Calendar({ userLogin , time , chooseTime }) { title: { show:false }, - tooltip: {}, + tooltip: { + formatter:function(params){ + return params.data[0] + ': ' + params.data[1] + '个贡献'; + } + }, visualMap: { min: 0, max: max, @@ -83,15 +96,23 @@ function Calendar({ userLogin , time , chooseTime }) { left: 'center', bottom: 40, inRange:{ - color:['#C7DBFF', '#5291FF'] + color:['#fafafa', '#216e39'] } }, calendar: { - top: 60, - left: 30, - right: 0, + top: 50, + left: 40, + right: 30, cellSize: ['auto', 13], range: [baginT, endT], + splitLine:{ + show:false, + lineStyle:{ + color:"#fff", + width:1, + type:"solid" + } + }, itemStyle: { borderWidth: 0.5 }, @@ -100,7 +121,8 @@ function Calendar({ userLogin , time , chooseTime }) { nameMap:"cn" }, dayLabel:{ - nameMap:"cn" + nameMap:"cn", + firstDay:1 } }, series: { @@ -117,7 +139,7 @@ function Calendar({ userLogin , time , chooseTime }) { return( -
+
) } export default Calendar; \ No newline at end of file diff --git a/src/forge/users/Echart/Line.jsx b/src/forge/users/Echart/Line.jsx index f7b515cd3..e8c9ac644 100644 --- a/src/forge/users/Echart/Line.jsx +++ b/src/forge/users/Echart/Line.jsx @@ -15,22 +15,20 @@ function Line({data}) { let option = { color: ["#f8e367", "#58c0f0", "#ff9e48"], title: { - text: '近期活动统计', - left: '3%', - top:"3%" + show:false }, tooltip: { trigger: 'axis' }, legend: { - data: ['commits', 'issues', 'pull_requests'], + data: ['提交数', '易修数', '合并请求数'], right: 'center', - bottom: '0', + bottom: '4%', }, grid: { left: '4%', - right: '4%', - bottom: '12%', + right: '5%', + bottom: '16%', containLabel: true }, toolbox: { @@ -53,21 +51,23 @@ function Line({data}) { }, axisTick:{ show:false - } + }, + minInterval:1, + splitNumber: 5, }, series: [ { - name: 'commits', + name: '提交数', type: 'line', data: d.commits_count }, { - name: 'issues', + name: '易修数', type: 'line', data: d.issues_count }, { - name: 'pull_requests', + name: '合并请求数', type: 'line', data: d.pull_requests_count } diff --git a/src/forge/users/GeneralView/Index.jsx b/src/forge/users/GeneralView/Index.jsx index 4d74fa5a1..8fd8d0a02 100644 --- a/src/forge/users/GeneralView/Index.jsx +++ b/src/forge/users/GeneralView/Index.jsx @@ -14,6 +14,7 @@ import ConcentrateProject from './ConcentrateProject'; import Activity from './Activity'; import moment from 'moment'; import Axios from 'axios'; +import Nodata from '../../Nodata'; const { Option } = Select; const aLimit = 5; @@ -22,7 +23,7 @@ function Index(props) { const [ total , setTotal ] = useState(0); const [ projectTrends , setProjectTrends ] = useState(undefined); - const [ year , setYear ] = useState("0"); + const [ year , setYear ] = useState(moment().get('year')); const [ yearList , setYearList ] = useState(undefined); const [ activityDate , setActivityDate ] = useState(undefined); @@ -104,21 +105,24 @@ function Index(props) { />
- +

近期活动统计

+
- + 贡献度 - {setYear(e);setActivityDate(undefined)}}> { yearList && renderYear(yearList) } - +
+ +
动态 { projectTrends && projectTrends.length > 0 && } + { projectTrends && projectTrends.length === 0 && } { total > aLimit &&
setPage(p)}/>
}
diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index ccc26da59..525a2b82a 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -1,6 +1,6 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; -import { Button, Spin , Menu } from "antd"; +import { Avatar, Tag, Button, Spin , Menu } from "antd"; import FocusButton from "../UsersList/focus_button"; import axios from "axios"; @@ -14,10 +14,7 @@ import './Index.scss'; import Loadable from "react-loadable"; import Loading from "../../Loading"; -const UpdateInfo = Loadable({ - loader: () => import("./Material/Index"), - loading: Loading, -}); + const InfosDevOps = Loadable({ loader: () => import("./devOpsCI"), loading: Loading, @@ -135,12 +132,21 @@ class Infos extends Component { undo_events:e }); }) - .catch((error) => { - this.setState({ - isSpin: false, - }); - }); - }; + } + + // change_project_type = (type) => { + // const {user} = this.state + // this.setState({ + // project_type: type , + // route_type: undefined + // }) + // let url = `/users/${user && user.login}` + // if (type){ + // url = `/users/${user && user.login}/projects/${type}` + // } + // this.props.history.push(url) + + // }; change_devops_type=(type)=>{ const {user} = this.state; @@ -241,7 +247,7 @@ class Infos extends Component { )} -
+
- { !route_type && menuKey && + { !route_type && 概览 数据统计 diff --git a/src/forge/users/Statistics/Index.jsx b/src/forge/users/Statistics/Index.jsx index 6375ac613..6d06e2480 100644 --- a/src/forge/users/Statistics/Index.jsx +++ b/src/forge/users/Statistics/Index.jsx @@ -74,14 +74,16 @@ function Index(props) { if(result && result.data){ setRadarData(result.data); let score = result.data.user && result.data.user.each_language_score; - var sortData = [] - for (var item in score) { - sortData.push([item, score[item]]) + if(score){ + var sortData = []; + for (var item in score) { + sortData.push([item, score[item]]) + } + sortData.sort(function(a, b) { + return b[1] - a[1]; + }); + setTopThree(sortData.slice(0,3)); } - sortData.sort(function(a, b) { - return b[1] - a[1]; - }); - setTopThree(sortData.slice(0,3)); let percent = result.data.user && result.data.user.languages_percent; let arr = []; @@ -126,7 +128,7 @@ function Index(props) { return(
- + 开发能力 - - { - topThree && -
- - - -
- } - { - percentData && -
-
- { - percentData.map((i,k)=>{ - return( - - ) - }) - } +
+

从五个维度刻画你的开发能力:语言能力、影响力、贡献度、活跃度、项目经验,同时可以查看社区平均数据。

+ + { + topThree && topThree.length > 0 && +
+ + +
-
- { - percentData.map((i,k)=>{ - return( - - {i.name} - {`${i.p}%`} - - ) - }) - } + } + { + percentData && +
+
+ { + percentData.map((i,k)=>{ + return( + + ) + }) + } +
+
+ { + percentData.map((i,k)=>{ + return( + + {i.name} + {`${i.p}%`} + + ) + }) + } +
-
- } + } +
- + 角色定位 - +
+

根据你在项目开发过程中的工作,对你在项目中扮演的角色进行定位,包括:创建者、管理者、开发者、测试者、文档工作者等。

+ +
- + 专业定位 - +
+

展示你擅长、关注、感兴趣的专业范围,通过你参与项目、收藏项目、关注项目、复刻项目等数据来统计。

+ +
) diff --git a/src/forge/users/Statistics/Index.scss b/src/forge/users/Statistics/Index.scss index a2f944b90..4ea048bfa 100644 --- a/src/forge/users/Statistics/Index.scss +++ b/src/forge/users/Statistics/Index.scss @@ -1,5 +1,5 @@ .boxes{ - padding:20px 30px; + padding:15px 0px; .roundBox{ margin:20px auto; display: flex;