diff --git a/src/forge/users/Echart/Calendar.jsx b/src/forge/users/Echart/Calendar.jsx index 8190d32e5..d0816ccca 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,13 +52,30 @@ 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; } + function timestampToTime(timestamp) { + var date = new Date(timestamp); + var Y = date.getFullYear() + '-'; + var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; + var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate(); + return Y+M+D; + } + function Init(data,max) { var huan_val = document.getElementById("Calendar"); var myEcharts = echarts.init(huan_val); @@ -66,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, @@ -75,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 }, @@ -92,7 +121,8 @@ function Calendar({ userLogin , time , chooseTime }) { nameMap:"cn" }, dayLabel:{ - nameMap:"cn" + nameMap:"cn", + firstDay:1 } }, series: { @@ -108,7 +138,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 c12f1510e..47760da59 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); @@ -100,21 +101,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/GeneralView/Index.scss b/src/forge/users/GeneralView/Index.scss index 74ca9d783..30152fdcb 100644 --- a/src/forge/users/GeneralView/Index.scss +++ b/src/forge/users/GeneralView/Index.scss @@ -45,7 +45,7 @@ } } .ConcentrateTip{ - margin:20px 30px 0px; + margin:0px 30px; padding:5px 20px; border:1px solid rgb(248, 56, 56); border-radius: 4px; diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 6317bff59..ec8f7bf19 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, @@ -89,8 +86,6 @@ class Infos extends Component { this.setState({menuKey:undefined,route_type:"watchers"}); }else if(pathname === `/users/${username}/fan_users`){ this.setState({menuKey:undefined,route_type:"fan_users"}); - }else{ - this.setState({menuKey:undefined,route_type:undefined}); } } @@ -128,25 +123,41 @@ class Infos extends Component { const { notice } = this.state; let url = `/users/${username || (current_user && current_user.login)}.json`; - axios.get(url).then((result) => { - let e = result.data && result.data.undo_events; - let p = result.data && result.data.undo_messages; - let n = notice || pathname === `/users/${username}/notice` ; - this.setState({ - user: result.data, - isSpin: false, - undo_events:n ? (e-p) : e, - undo_messages:0, - notice:n + axios + .get(url) + .then((result) => { + let e = result.data && result.data.undo_events; + let p = result.data && result.data.undo_messages; + let n = notice || pathname === `/users/${username}/notice` ; + this.setState({ + user: result.data, + isSpin: false, + undo_events:n ? (e-p) : e, + undo_messages:0, + notice:n + }); + }) + .catch((error) => { + this.setState({ + isSpin: false, + }); }); - }) - .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; this.setState({ @@ -183,51 +194,39 @@ class Infos extends Component { this.props.history.push(`/users/${user && user.login}/organizes`) } - resetUser=(data)=>{ - this.setState({ - user:data - }) - } - render() { const { current_user, mygetHelmetapi } = this.props; const { username } = this.props.match.params; - const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state; + const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state; return (
-
- - - - { - user && user.gender===1? - - : - - } - - - +
+ + {user && user.user_identity && ( +
+ {user && user.user_identity} +
+ )}
{user && user.username}
-
- {user && user.description} -
{user && current_user && user.login === current_user.login && (
)}
-
+
{user && user.watched_count}
- { - user && (user.province || user.custom_department || user.email) ? -
- { user.province &&
{user.province}{user.city}
} - { user.custom_department &&
{user.custom_department}
} - { user.email &&
{user.email}
} -
- :"" - }
- { !route_type && menuKey && + { !route_type && 概览 数据统计 @@ -340,19 +330,6 @@ class Infos extends Component { return ; }} > - { - return ; - }} - > - { - return ; - }} - > - { diff --git a/src/forge/users/Statistics/Index.jsx b/src/forge/users/Statistics/Index.jsx index ee4e25e24..282bff1d5 100644 --- a/src/forge/users/Statistics/Index.jsx +++ b/src/forge/users/Statistics/Index.jsx @@ -70,14 +70,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 = []; @@ -107,8 +109,8 @@ function Index(props) { const url = `/users/${username}/statistics/major.json`; Axios.get(url,{ params:{ - start_time:rDates && rDates[0], - end_time:rDates && rDates[1] + start_time:cData && cData[0], + end_time:cData && cData[1] } }).then(result=>{ if(result && result.data){ @@ -120,7 +122,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;