同上=issue修改

This commit is contained in:
caishi 2021-06-02 18:22:29 +08:00
parent 6105df55a0
commit 8a968fbf04
7 changed files with 170 additions and 148 deletions

View File

@ -10,7 +10,7 @@ function Calendar({ userLogin , time , chooseTime }) {
useEffect(()=>{ useEffect(()=>{
if(time){ if(time){
let e,b = ""; let e,b = "";
if(time === "0"){ if(parseInt(time,0) === parseInt(moment().get('year'),0)){
let y = moment().get('year'); let y = moment().get('year');
let m = moment().get('month'); let m = moment().get('month');
let d = moment().get('date'); let d = moment().get('date');
@ -52,13 +52,30 @@ function Calendar({ userLogin , time , chooseTime }) {
} }
function getVirtulData(data) { function getVirtulData(data) {
var date = +echarts.number.parseDate(baginT);
var end = +echarts.number.parseDate(endT);
var dayTime = 3600 * 24 * 1000;
var array = []; var array = [];
for(var i=0;i<data.length;i++){ for (var time = date; time <= end; time += dayTime) {
array.push([data[i].date,data[i].contributions]); 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; 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) { function Init(data,max) {
var huan_val = document.getElementById("Calendar"); var huan_val = document.getElementById("Calendar");
var myEcharts = echarts.init(huan_val); var myEcharts = echarts.init(huan_val);
@ -66,7 +83,11 @@ function Calendar({ userLogin , time , chooseTime }) {
title: { title: {
show:false show:false
}, },
tooltip: {}, tooltip: {
formatter:function(params){
return params.data[0] + ': ' + params.data[1] + '个贡献';
}
},
visualMap: { visualMap: {
min: 0, min: 0,
max: max, max: max,
@ -75,15 +96,23 @@ function Calendar({ userLogin , time , chooseTime }) {
left: 'center', left: 'center',
bottom: 40, bottom: 40,
inRange:{ inRange:{
color:['#C7DBFF', '#5291FF'] color:['#fafafa', '#216e39']
} }
}, },
calendar: { calendar: {
top: 60, top: 50,
left: 30, left: 40,
right: 0, right: 30,
cellSize: ['auto', 13], cellSize: ['auto', 13],
range: [baginT, endT], range: [baginT, endT],
splitLine:{
show:false,
lineStyle:{
color:"#fff",
width:1,
type:"solid"
}
},
itemStyle: { itemStyle: {
borderWidth: 0.5 borderWidth: 0.5
}, },
@ -92,7 +121,8 @@ function Calendar({ userLogin , time , chooseTime }) {
nameMap:"cn" nameMap:"cn"
}, },
dayLabel:{ dayLabel:{
nameMap:"cn" nameMap:"cn",
firstDay:1
} }
}, },
series: { series: {
@ -108,7 +138,7 @@ function Calendar({ userLogin , time , chooseTime }) {
} }
return( return(
<div id="Calendar" style={{height:"230px"}}></div> <div id="Calendar" style={{height:"210px"}}></div>
) )
} }
export default Calendar; export default Calendar;

View File

@ -15,22 +15,20 @@ function Line({data}) {
let option = { let option = {
color: ["#f8e367", "#58c0f0", "#ff9e48"], color: ["#f8e367", "#58c0f0", "#ff9e48"],
title: { title: {
text: '近期活动统计', show:false
left: '3%',
top:"3%"
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
}, },
legend: { legend: {
data: ['commits', 'issues', 'pull_requests'], data: ['提交数', '易修数', '合并请求数'],
right: 'center', right: 'center',
bottom: '0', bottom: '4%',
}, },
grid: { grid: {
left: '4%', left: '4%',
right: '4%', right: '5%',
bottom: '12%', bottom: '16%',
containLabel: true containLabel: true
}, },
toolbox: { toolbox: {
@ -53,21 +51,23 @@ function Line({data}) {
}, },
axisTick:{ axisTick:{
show:false show:false
} },
minInterval:1,
splitNumber: 5,
}, },
series: [ series: [
{ {
name: 'commits', name: '提交数',
type: 'line', type: 'line',
data: d.commits_count data: d.commits_count
}, },
{ {
name: 'issues', name: '易修数',
type: 'line', type: 'line',
data: d.issues_count data: d.issues_count
}, },
{ {
name: 'pull_requests', name: '合并请求数',
type: 'line', type: 'line',
data: d.pull_requests_count data: d.pull_requests_count
} }

View File

@ -14,6 +14,7 @@ import ConcentrateProject from './ConcentrateProject';
import Activity from './Activity'; import Activity from './Activity';
import moment from 'moment'; import moment from 'moment';
import Axios from 'axios'; import Axios from 'axios';
import Nodata from '../../Nodata';
const { Option } = Select; const { Option } = Select;
const aLimit = 5; const aLimit = 5;
@ -22,7 +23,7 @@ function Index(props) {
const [ total , setTotal ] = useState(0); const [ total , setTotal ] = useState(0);
const [ projectTrends , setProjectTrends ] = useState(undefined); const [ projectTrends , setProjectTrends ] = useState(undefined);
const [ year , setYear ] = useState("0"); const [ year , setYear ] = useState(moment().get('year'));
const [ yearList , setYearList ] = useState(undefined); const [ yearList , setYearList ] = useState(undefined);
const [ activityDate , setActivityDate ] = useState(undefined); const [ activityDate , setActivityDate ] = useState(undefined);
@ -100,21 +101,24 @@ function Index(props) {
<ConcentrateProject userLogin={username} current={current_user && (current_user.login === username)}/> <ConcentrateProject userLogin={username} current={current_user && (current_user.login === username)}/>
</div> </div>
<div className="recentStatic"> <div className="recentStatic">
<Line data={statisticData}/> <p className="font-18 mb15">近期活动统计</p>
<div className="echartBox"><Line data={statisticData}/></div>
</div> </div>
<div className="calendarStatic"> <div className="calendarStatic">
<FlexAJ> <FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">贡献度</span> <span className="font-18">贡献度</span>
<Select style={{width:"200px"}} placeholder="选择年份" value={year} onSelect={(e)=>setYear(e)}> <Select style={{width:"200px"}} placeholder="选择年份" value={year} onSelect={(e)=>{setYear(e);setActivityDate(undefined)}}>
<Option key={"0"}>选择年份</Option>
{ yearList && renderYear(yearList) } { yearList && renderYear(yearList) }
</Select> </Select>
</FlexAJ> </FlexAJ>
<Calendar time={year} userLogin={username} chooseTime={chooseTime}/> <div className="echartBox">
<Calendar time={year} userLogin={username} chooseTime={chooseTime}/>
</div>
</div> </div>
<div className="activeStatic"> <div className="activeStatic">
<span className="font-18">动态</span> <span className="font-18">动态</span>
{ projectTrends && projectTrends.length > 0 && <Activity list = {projectTrends}/> } { 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> } { total > aLimit && <div style={{textAlign:'center',paddingBottom:"30px"}}><Pagination pageSize={aLimit} current={page} total={total} onChange={(p)=>setPage(p)}/></div> }
</div> </div>
</div> </div>

View File

@ -45,7 +45,7 @@
} }
} }
.ConcentrateTip{ .ConcentrateTip{
margin:20px 30px 0px; margin:0px 30px;
padding:5px 20px; padding:5px 20px;
border:1px solid rgb(248, 56, 56); border:1px solid rgb(248, 56, 56);
border-radius: 4px; border-radius: 4px;

View File

@ -1,6 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { Link } from "react-router-dom"; 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 FocusButton from "../UsersList/focus_button";
import axios from "axios"; import axios from "axios";
@ -14,10 +14,7 @@ import './Index.scss';
import Loadable from "react-loadable"; import Loadable from "react-loadable";
import Loading from "../../Loading"; import Loading from "../../Loading";
const UpdateInfo = Loadable({
loader: () => import("./Material/Index"),
loading: Loading,
});
const InfosDevOps = Loadable({ const InfosDevOps = Loadable({
loader: () => import("./devOpsCI"), loader: () => import("./devOpsCI"),
loading: Loading, loading: Loading,
@ -89,8 +86,6 @@ class Infos extends Component {
this.setState({menuKey:undefined,route_type:"watchers"}); this.setState({menuKey:undefined,route_type:"watchers"});
}else if(pathname === `/users/${username}/fan_users`){ }else if(pathname === `/users/${username}/fan_users`){
this.setState({menuKey:undefined,route_type:"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; const { notice } = this.state;
let url = `/users/${username || (current_user && current_user.login)}.json`; let url = `/users/${username || (current_user && current_user.login)}.json`;
axios.get(url).then((result) => { axios
let e = result.data && result.data.undo_events; .get(url)
let p = result.data && result.data.undo_messages; .then((result) => {
let n = notice || pathname === `/users/${username}/notice` ; let e = result.data && result.data.undo_events;
this.setState({ let p = result.data && result.data.undo_messages;
user: result.data, let n = notice || pathname === `/users/${username}/notice` ;
isSpin: false, this.setState({
undo_events:n ? (e-p) : e, user: result.data,
undo_messages:0, isSpin: false,
notice:n 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)=>{ change_devops_type=(type)=>{
const {user} = this.state; const {user} = this.state;
this.setState({ this.setState({
@ -183,51 +194,39 @@ class Infos extends Component {
this.props.history.push(`/users/${user && user.login}/organizes`) this.props.history.push(`/users/${user && user.login}/organizes`)
} }
resetUser=(data)=>{
this.setState({
user:data
})
}
render() { render() {
const { current_user, mygetHelmetapi } = this.props; const { current_user, mygetHelmetapi } = this.props;
const { username } = this.props.match.params; 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 ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
<div className="new-content-flex"> <div className="new-content-flex">
<div className="list-left" style={{border:"none"}}> <div className="list-left" style={{border:"none"}}>
<div className="bgcF"> <div className="bgcF">
<div className="list-l-Menu text-center" style={{padding:"20px 25px"}}> <div className="list-l-Menu text-center pd20">
<span className="headimg"> <Avatar size={110} src={getImageUrl(`/${user && user.image_url}`)} />
<img src={getImageUrl(`/${user && user.image_url}`)} alt=""/> {user && user.user_identity && (
<span> <div className="mt-n15 position-relative">
{ <Tag color="#FF6E21" style={{marginRight:"0px"}}>{user && user.user_identity}</Tag>
user && user.gender===1? </div>
<i className="iconfont icon-nan"></i> )}
:
<i className="iconfont icon-nv"></i>
}
</span>
</span>
<div className="text-center mt15 font-16 fwb"> <div className="text-center mt15 font-16 fwb">
{user && user.username} {user && user.username}
</div> </div>
<div className="userDescription">
{user && user.description}
</div>
<div> <div>
{user && current_user && user.login === current_user.login && ( {user && current_user && user.login === current_user.login && (
<div className="user-info-star-button "> <div className="user-info-star-button ">
<Button <Button
block block
className="text-button-grey" className="text-button-grey"
onClick={()=>this.props.history.push(`/users/${user.login}/info`)} href={`${
type="primary" mygetHelmetapi &&mygetHelmetapi.new_course&&
mygetHelmetapi.new_course.edit_account
}`}
target="_blank"
> >
{" "} {" "}
<i className="iconfont icon-shezhi4 font-15 mr5"></i> <i className="iconfont icon-shezhi4 font-15 mr5"></i>
@ -247,7 +246,7 @@ class Infos extends Component {
</div> </div>
)} )}
</div> </div>
<div className="focusBox"> <div className="width100 inline-block mt20">
<Link <Link
to={`/users/${user && user.login}/watchers`} to={`/users/${user && user.login}/watchers`}
className={`with50 text-center pull-left ${route_type === "watchers" ? "text-primary" : ""}`} 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> <span>{user && user.watched_count}</span>
</Link> </Link>
</div> </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>
</div> </div>
<div className="list-right"> <div className="list-right">
{ !route_type && menuKey && { !route_type &&
<Menu selectedKeys={[menuKey]} mode={`horizontal`} className="infosRightMenu"> <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="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> <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} />; return <Organize {...this.props} {...this.state} />;
}} }}
></Route> ></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 <Route
path="/users/:username/statistics" path="/users/:username/statistics"
render={(props) => { render={(props) => {

View File

@ -70,14 +70,16 @@ function Index(props) {
if(result && result.data){ if(result && result.data){
setRadarData(result.data); setRadarData(result.data);
let score = result.data.user && result.data.user.each_language_score; let score = result.data.user && result.data.user.each_language_score;
var sortData = [] if(score){
for (var item in score) { var sortData = [];
sortData.push([item, score[item]]) 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 percent = result.data.user && result.data.user.languages_percent;
let arr = []; let arr = [];
@ -107,8 +109,8 @@ function Index(props) {
const url = `/users/${username}/statistics/major.json`; const url = `/users/${username}/statistics/major.json`;
Axios.get(url,{ Axios.get(url,{
params:{ params:{
start_time:rDates && rDates[0], start_time:cData && cData[0],
end_time:rDates && rDates[1] end_time:cData && cData[1]
} }
}).then(result=>{ }).then(result=>{
if(result && result.data){ if(result && result.data){
@ -120,7 +122,7 @@ function Index(props) {
return( return(
<div> <div>
<div className="boxes"> <div className="boxes">
<FlexAJ> <FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">开发能力</span> <span className="font-18">开发能力</span>
<RangePicker <RangePicker
disabledDate={disabledDate} disabledDate={disabledDate}
@ -128,44 +130,47 @@ function Index(props) {
format={dateFormat} format={dateFormat}
/> />
</FlexAJ> </FlexAJ>
<Radar data={radarData}/> <div className="echartBox">
{ <p>从五个维度刻画你的开发能力语言能力影响力贡献度活跃度项目经验同时可以查看社区平均数据</p>
topThree && <Radar data={radarData}/>
<div className="roundBox"> {
<Round num={topThree[0][1]} color="#FF7F69" name={topThree[0][0]}/> topThree && topThree.length > 0 &&
<Round num={topThree[1][1]} color="#99dfff" name={topThree[1][0]}/> <div className="roundBox">
<Round num={topThree[2][1]} color="#ff9e48" name={topThree[2][0]}/> <Round num={topThree[0][1]} color="#FF7F69" name={topThree[0][0]}/>
</div> <Round num={topThree[1][1]} color="#99dfff" name={topThree[1][0]}/>
} <Round num={topThree[2][1]} color="#ff9e48" name={topThree[2][0]}/>
{
percentData &&
<div className="pBox">
<div class="progress">
{
percentData.map((i,k)=>{
return(
<span style={{width: `${i.p}%`, backgroundColor:`${i.color}`}}></span>
)
})
}
</div> </div>
<div className="progresstip"> }
{ {
percentData.map((i,k)=>{ percentData &&
return( <div className="pBox">
<span> <div class="progress">
<i class="zero" style={{backgroundColor: `${i.color}`}}></i><span>{i.name}</span> {
<span>{`${i.p}%`}</span> percentData.map((i,k)=>{
</span> 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> </div>
<div className="boxes"> <div className="boxes">
<FlexAJ> <FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">角色定位</span> <span className="font-18">角色定位</span>
<RangePicker <RangePicker
disabledDate={disabledDate} disabledDate={disabledDate}
@ -173,10 +178,13 @@ function Index(props) {
format={dateFormat} format={dateFormat}
/> />
</FlexAJ> </FlexAJ>
<Pie data={pieData}/> <div className="echartBox">
<p>根据你在项目开发过程中的工作对你在项目中扮演的角色进行定位包括创建者管理者开发者测试者文档工作者等</p>
<Pie data={pieData}/>
</div>
</div> </div>
<div className="boxes"> <div className="boxes">
<FlexAJ> <FlexAJ style={{marginBottom:"15px"}}>
<span className="font-18">专业定位</span> <span className="font-18">专业定位</span>
<RangePicker <RangePicker
disabledDate={disabledDate} disabledDate={disabledDate}
@ -184,7 +192,10 @@ function Index(props) {
format={dateFormat} format={dateFormat}
/> />
</FlexAJ> </FlexAJ>
<Cloud data={cloudData}/> <div className="echartBox">
<p>展示你擅长关注感兴趣的专业范围通过你参与项目收藏项目关注项目复刻项目等数据来统计</p>
<Cloud data={cloudData}/>
</div>
</div> </div>
</div> </div>
) )

View File

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