forked from Gitlink/forgeplus-react
同上=issue修改
This commit is contained in:
parent
6105df55a0
commit
8a968fbf04
|
@ -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;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;
|
||||
}
|
||||
|
||||
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(
|
||||
<div id="Calendar" style={{height:"230px"}}></div>
|
||||
<div id="Calendar" style={{height:"210px"}}></div>
|
||||
)
|
||||
}
|
||||
export default Calendar;
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
|||
<ConcentrateProject userLogin={username} current={current_user && (current_user.login === username)}/>
|
||||
</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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 (
|
||||
<div className="newMain clearfix">
|
||||
<Spin spinning={isSpin}>
|
||||
<div className="new-content-flex">
|
||||
<div className="list-left" style={{border:"none"}}>
|
||||
<div className="bgcF">
|
||||
<div className="list-l-Menu text-center" style={{padding:"20px 25px"}}>
|
||||
<span className="headimg">
|
||||
<img src={getImageUrl(`/${user && user.image_url}`)} alt=""/>
|
||||
<span>
|
||||
{
|
||||
user && user.gender===1?
|
||||
<i className="iconfont icon-nan"></i>
|
||||
:
|
||||
<i className="iconfont icon-nv"></i>
|
||||
}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<div className="list-l-Menu text-center pd20">
|
||||
<Avatar size={110} src={getImageUrl(`/${user && user.image_url}`)} />
|
||||
{user && user.user_identity && (
|
||||
<div className="mt-n15 position-relative">
|
||||
<Tag color="#FF6E21" style={{marginRight:"0px"}}>{user && user.user_identity}</Tag>
|
||||
</div>
|
||||
)}
|
||||
<div className="text-center mt15 font-16 fwb">
|
||||
{user && user.username}
|
||||
</div>
|
||||
<div className="userDescription">
|
||||
{user && user.description}
|
||||
</div>
|
||||
<div>
|
||||
{user && current_user && user.login === current_user.login && (
|
||||
<div className="user-info-star-button ">
|
||||
<Button
|
||||
block
|
||||
className="text-button-grey"
|
||||
onClick={()=>this.props.history.push(`/users/${user.login}/info`)}
|
||||
type="primary"
|
||||
href={`${
|
||||
mygetHelmetapi &&mygetHelmetapi.new_course&&
|
||||
mygetHelmetapi.new_course.edit_account
|
||||
}`}
|
||||
target="_blank"
|
||||
>
|
||||
{" "}
|
||||
<i className="iconfont icon-shezhi4 font-15 mr5"></i>
|
||||
|
@ -247,7 +246,7 @@ class Infos extends Component {
|
|||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="focusBox">
|
||||
<div className="width100 inline-block mt20">
|
||||
<Link
|
||||
to={`/users/${user && user.login}/watchers`}
|
||||
className={`with50 text-center pull-left ${route_type === "watchers" ? "text-primary" : ""}`}
|
||||
|
@ -265,20 +264,11 @@ class Infos extends Component {
|
|||
<span>{user && user.watched_count}</span>
|
||||
</Link>
|
||||
</div>
|
||||
{
|
||||
user && (user.province || user.custom_department || user.email) ?
|
||||
<div className="infoBox">
|
||||
{ user.province && <div><i className="iconfont icon-weizhi"></i><span>{user.province}</span><span>{user.city}</span></div> }
|
||||
{ user.custom_department && <div><i className="iconfont icon-danwei"></i><span>{user.custom_department}</span></div> }
|
||||
{ user.email && <div><i className="iconfont icon-youxiangrenzheng"></i><span>{user.email}</span></div> }
|
||||
</div>
|
||||
:""
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="list-right">
|
||||
{ !route_type && menuKey &&
|
||||
{ !route_type &&
|
||||
<Menu selectedKeys={[menuKey]} mode={`horizontal`} className="infosRightMenu">
|
||||
<Menu.Item key="0"><Link to={`/users/${user && user.login}`}><i className="iconfont icon-gailan"></i>概览</Link></Menu.Item>
|
||||
<Menu.Item key="1"><Link to={`/users/${user && user.login}/statistics`}><i className="iconfont icon-shujutongji"></i>数据统计</Link></Menu.Item>
|
||||
|
@ -340,19 +330,6 @@ class Infos extends Component {
|
|||
return <Organize {...this.props} {...this.state} />;
|
||||
}}
|
||||
></Route>
|
||||
<Route
|
||||
path="/users/:username/info"
|
||||
render={() => {
|
||||
return <UpdateInfo {...this.props} {...this.state} resetUser={this.resetUser}/>;
|
||||
}}
|
||||
></Route>
|
||||
<Route
|
||||
path="/users/:username/password"
|
||||
render={() => {
|
||||
return <UpdateInfo {...this.props} {...this.state}/>;
|
||||
}}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/users/:username/statistics"
|
||||
render={(props) => {
|
||||
|
|
|
@ -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(
|
||||
<div>
|
||||
<div className="boxes">
|
||||
<FlexAJ>
|
||||
<FlexAJ style={{marginBottom:"15px"}}>
|
||||
<span className="font-18">开发能力</span>
|
||||
<RangePicker
|
||||
disabledDate={disabledDate}
|
||||
|
@ -128,44 +130,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}
|
||||
|
@ -173,10 +178,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}
|
||||
|
@ -184,7 +192,10 @@ function Index(props) {
|
|||
format={dateFormat}
|
||||
/>
|
||||
</FlexAJ>
|
||||
<Cloud data={cloudData}/>
|
||||
<div className="echartBox">
|
||||
<p>展示你擅长、关注、感兴趣的专业范围,通过你参与项目、收藏项目、关注项目、复刻项目等数据来统计。</p>
|
||||
<Cloud data={cloudData}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.boxes{
|
||||
padding:20px 30px;
|
||||
padding:15px 0px;
|
||||
.roundBox{
|
||||
margin:20px auto;
|
||||
display: flex;
|
||||
|
|
Loading…
Reference in New Issue