同上=issue修改

This commit is contained in:
caishi 2021-06-02 18:22:29 +08:00 committed by caishi
parent 28d3b5bedd
commit dd20d02477
6 changed files with 129 additions and 86 deletions

View File

@ -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;i<data.length;i++){
array.push([data[i].date,data[i].contributions]);
for (var time = date; time <= end; time += dayTime) {
let stamp = timestampToTime(time);
let stampFilter = data.filter(i=>i.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(
<div id="Calendar" style={{height:"230px"}}></div>
<div id="Calendar" style={{height:"210px"}}></div>
)
}
export default Calendar;

View File

@ -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
}

View File

@ -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) {
/>
</div>
<div className="recentStatic">
<Line data={statisticData}/>
<p className="font-18 mb15">近期活动统计</p>
<div className="echartBox"><Line data={statisticData}/></div>
</div>
<div className="calendarStatic">
<FlexAJ>
<FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">贡献度</span>
<Select style={{width:"200px"}} placeholder="选择年份" value={year} onSelect={(e)=>setYear(e)}>
<Option key={"0"}>选择年份</Option>
<Select style={{width:"200px"}} placeholder="选择年份" value={year} onSelect={(e)=>{setYear(e);setActivityDate(undefined)}}>
{ yearList && renderYear(yearList) }
</Select>
</FlexAJ>
<Calendar time={year} userLogin={username} chooseTime={chooseTime}/>
<div className="echartBox">
<Calendar time={year} userLogin={username} chooseTime={chooseTime}/>
</div>
</div>
<div className="activeStatic">
<span className="font-18">动态</span>
{ projectTrends && projectTrends.length > 0 && <Activity list = {projectTrends}/> }
{ projectTrends && projectTrends.length === 0 && <Nodata _html="暂无动态" />}
{ total > aLimit && <div style={{textAlign:'center',paddingBottom:"30px"}}><Pagination pageSize={aLimit} current={page} total={total} onChange={(p)=>setPage(p)}/></div> }
</div>
</div>

View File

@ -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 {
</div>
)}
</div>
<div className="focusBox">
<div className="width100 inline-block mt20">
<Link
to={`/${user && user.login}/following`}
className={`with50 text-center pull-left ${route_type === "following" ? "text-primary" : ""}`}
@ -272,7 +278,7 @@ class Infos extends Component {
</div>
</div>
<div className="list-right">
{ !route_type && menuKey &&
{ !route_type &&
<Menu selectedKeys={[menuKey]} mode={`horizontal`} className="infosRightMenu">
<Menu.Item key="0"><Link to={`/${user && user.login}`}><i className="iconfont icon-gailan"></i></Link></Menu.Item>
<Menu.Item key="1"><Link to={`/${user && user.login}/statistics`}><i className="iconfont icon-shujutongji"></i></Link></Menu.Item>

View File

@ -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(
<div>
<div className="boxes">
<FlexAJ>
<FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">开发能力</span>
<RangePicker
disabledDate={disabledDate}
@ -134,44 +136,47 @@ function Index(props) {
format={dateFormat}
/>
</FlexAJ>
<Radar data={radarData}/>
{
topThree &&
<div className="roundBox">
<Round num={topThree[0][1]} color="#FF7F69" name={topThree[0][0]}/>
<Round num={topThree[1][1]} color="#99dfff" name={topThree[1][0]}/>
<Round num={topThree[2][1]} color="#ff9e48" name={topThree[2][0]}/>
</div>
}
{
percentData &&
<div className="pBox">
<div class="progress">
{
percentData.map((i,k)=>{
return(
<span style={{width: `${i.p}%`, backgroundColor:`${i.color}`}}></span>
)
})
}
<div className="echartBox">
<p>从五个维度刻画你的开发能力语言能力影响力贡献度活跃度项目经验同时可以查看社区平均数据</p>
<Radar data={radarData}/>
{
topThree && topThree.length > 0 &&
<div className="roundBox">
<Round num={topThree[0][1]} color="#FF7F69" name={topThree[0][0]}/>
<Round num={topThree[1][1]} color="#99dfff" name={topThree[1][0]}/>
<Round num={topThree[2][1]} color="#ff9e48" name={topThree[2][0]}/>
</div>
<div className="progresstip">
{
percentData.map((i,k)=>{
return(
<span>
<i class="zero" style={{backgroundColor: `${i.color}`}}></i><span>{i.name}</span>
<span>{`${i.p}%`}</span>
</span>
)
})
}
}
{
percentData &&
<div className="pBox">
<div class="progress">
{
percentData.map((i,k)=>{
return(
<span style={{width: `${i.p}%`, backgroundColor:`${i.color}`}}></span>
)
})
}
</div>
<div className="progresstip">
{
percentData.map((i,k)=>{
return(
<span>
<i class="zero" style={{backgroundColor: `${i.color}`}}></i><span>{i.name}</span>
<span>{`${i.p}%`}</span>
</span>
)
})
}
</div>
</div>
</div>
}
}
</div>
</div>
<div className="boxes">
<FlexAJ>
<FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">角色定位</span>
<RangePicker
disabledDate={disabledDate}
@ -179,10 +184,13 @@ function Index(props) {
format={dateFormat}
/>
</FlexAJ>
<Pie data={pieData}/>
<div className="echartBox">
<p>根据你在项目开发过程中的工作对你在项目中扮演的角色进行定位包括创建者管理者开发者测试者文档工作者等</p>
<Pie data={pieData}/>
</div>
</div>
<div className="boxes">
<FlexAJ>
<FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">专业定位</span>
<RangePicker
disabledDate={disabledDate}
@ -190,7 +198,10 @@ function Index(props) {
format={dateFormat}
/>
</FlexAJ>
<Cloud data={cloudData}/>
<div className="echartBox">
<p>展示你擅长关注感兴趣的专业范围通过你参与项目收藏项目关注项目复刻项目等数据来统计</p>
<Cloud data={cloudData}/>
</div>
</div>
</div>
)

View File

@ -1,5 +1,5 @@
.boxes{
padding:20px 30px;
padding:15px 0px;
.roundBox{
margin:20px auto;
display: flex;