diff --git a/src/forge/Component/layout.jsx b/src/forge/Component/layout.jsx index 57b20c1e..adaf4dbf 100644 --- a/src/forge/Component/layout.jsx +++ b/src/forge/Component/layout.jsx @@ -28,6 +28,11 @@ export const AlignTop = styled.div`{ display:flex; align-items: flex-start; }` +export const AlignAJBottom = styled.div`{ + display:flex; + justify-content: space-between; + align-items: flex-end; +}` // 左右结构 export const Box = styled.div`{ display:flex; diff --git a/src/forge/Notice/Index.scss b/src/forge/Notice/Index.scss new file mode 100644 index 00000000..a50c3413 --- /dev/null +++ b/src/forge/Notice/Index.scss @@ -0,0 +1,60 @@ +.noticeMenu{ + padding:0px 30px; + display: flex; + border-bottom: 1px solid #eee; + li{ + font-size: 16px; + padding:0px; + margin-right:30px; + height: 70px; + line-height: 70px; + position: relative; + transform: none; + a{ + display: flex; + } + &.active a span{ + color: #1890ff; + } + .unNum{ + color: #d38900; + font-size: 12px; + border-radius: 13px; + height: 16px; + line-height: 16px; + padding:0px 4px; + min-width: 23px; + text-align: center; + background-color: #ffe4b3; + margin-top: 19px; + margin-left: 10px; + display: block; + } + } +} +.notifyList{ + padding:0px 30px; + li{ + display: flex; + border-bottom: 1px solid #eee; + padding:20px 0px; + .notifyImg{ + width: 48px; + height: 48px; + border-radius: 50%; + margin-right: 15px; + } + .notifyFlex{ + flex:1; + p{ + margin:0px; + } + .notifyInfos{ + margin-bottom: 8px; + } + } + &:last-child{ + border-bottom: none; + } + } +} \ No newline at end of file diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx new file mode 100644 index 00000000..c68271b3 --- /dev/null +++ b/src/forge/Notice/Notify.jsx @@ -0,0 +1,95 @@ +import React, { useEffect, useState } from "react"; +import Nodata from '../Nodata'; +import { Pagination , Spin } from 'antd'; +import { Link } from 'react-router-dom'; +import { getImageUrl } from 'educoder'; +import Axios from "axios"; + +const limit = 15; +function Notify(props){ + const username = props.match.params.username; + const [ list , setList ] = useState(undefined); + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + const [ isSpin , setIsSpin ] = useState(true); + + useEffect(()=>{ + if(username){ + setIsSpin(true); + getList(); + } + },[username,page]) + + function getList(){ + const url = `/users/${username}/applied_messages.json`; + Axios.get(url,{ + params:{ + page,per_page:limit + } + }).then(result=>{ + if(result){ + setList(result.data.applied_messages); + setTotal(result.data.total_count); + setIsSpin(false); + } + }).catch(error=>{}) + } + + function renderStatus(status,applied){ + let { project , owner} = applied + if(status){ + switch(status){ + case 'canceled': + return

取消转移【{project && project.name}】仓库

+ case 'common': + return

正在将【{project && project.name}】仓库转移给【{owner && owner.name}】

+ case 'successed': + return

{project && project.name}】仓库成功转移给【{owner && owner.name}】

+ default: + return

拒绝转移【{project && project.name}】仓库

+ } + }else{ + return "" + } + } + + return( +
+ +
+ { + list && list.length > 0 ? +
    + { + list.map((i,k)=>{ + return( +
  • + +
    +

    + {i.applied_user && i.applied_user.name} + {i.time_ago} +

    + {renderStatus(i.status,i.applied)} +
    +
  • + ) + }) + } +
+ : + "" + } +
+
+ {list && list.length === 0 && } + { + total > limit && +
+ {setPage(p)}}/> +
+ } +
+ ) +} +export default Notify; \ No newline at end of file diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx new file mode 100644 index 00000000..0e2c6323 --- /dev/null +++ b/src/forge/Notice/UndoEvent.jsx @@ -0,0 +1,123 @@ +import React, { useEffect, useState } from "react"; +import Nodata from '../Nodata'; +import { FlexAJ } from '../Component/layout'; +import { Pagination , Popconfirm , Spin } from 'antd'; +import { Link } from 'react-router-dom'; +import { getImageUrl } from 'educoder'; +import Axios from 'axios'; + +const limit = 15; +function UndoEvent(props){ + const username = props.match.params.username; + const [ list , setList ] = useState(undefined); + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + const [ isSpin , setIsSpin ] = useState(true); + + useEffect(()=>{ + if(username){ + setIsSpin(true); + getList(); + } + },[username,page]) + + function getList(){ + const url = `/users/${username}/applied_transfer_projects.json`; + Axios.get(url,{ + params:{ + page,per_page:limit + } + }).then(result=>{ + if(result){ + setList(result.data.applied_transfer_projects); + setTotal(result.data.total_count); + setIsSpin(false); + } + }).catch(error=>{}) + } + + // 接受 + function acceptDivert(id){ + const url = `/users/${username}/applied_transfer_projects/${id}/accept.json`; + Axios.post(url).then(result=>{ + if(result && result.data){ + getList(); + props && props.fetchUser(); + } + }).catch(error=>{}) + } + + // 拒绝 + function revertDivert(id){ + const url = `/users/${username}/applied_transfer_projects/${id}/refuse.json`; + Axios.post(url).then(result=>{ + if(result && result.data){ + getList(); + props && props.fetchUser(); + } + }).catch(error=>{}) + } + + return( +
+ +
+ { + list && list.length > 0 ? +
    + { + list.map((i,k)=>{ + return( +
  • + +
    +

    + {i.user && i.user.name} + {i.time_ago} +

    + +

    请求将仓库【{i.project && i.project.name}】 + 转移给【{i.owner && i.owner.name}】,是否接受?

    + { + i.status === "common" && + + acceptDivert(i.id)}> + 接受 + + revertDivert(i.id)}> + 拒绝 + + + } + { + i.status === "canceled" && 对方已取消转移 + } + { + i.status === "accepted" && 已接受 + } + { + i.status === "refused" && 已拒绝 + } +
    +
    +
  • + ) + }) + } +
+ : + "" + } +
+
+ {list && list.length === 0 && } + { + total > limit && +
+ {setPage(p)}}/> +
+ } +
+ ) +} +export default UndoEvent; \ No newline at end of file diff --git a/src/forge/users/Echart/Calendar.jsx b/src/forge/users/Echart/Calendar.jsx new file mode 100644 index 00000000..811a3ae4 --- /dev/null +++ b/src/forge/users/Echart/Calendar.jsx @@ -0,0 +1,113 @@ +import React ,{ useEffect, useState } from 'react'; +import * as echarts from 'echarts'; +import moment from 'moment'; +import Axios from 'axios'; + +function Calendar({ userLogin , time , chooseTime }) { + const [ endT, setEndT ] = useState(""); + const [ baginT, setBaginT ] = useState(""); + + useEffect(()=>{ + if(time){ + let e = `${time}-12-31`; + let b = `${time}-01-01`; + setEndT(e); + setBaginT(b); + }else if(time === ""){ + let y = moment().get('year'); + let m = moment().get('month'); + let d = moment().get('date'); + let e = `${y}-${m+1}-${d}`; + let b = `${y-1}-${m+1}-${d}`; + setEndT(e); + setBaginT(b); + } + },[time]) + + useEffect(()=>{ + if(baginT && endT){ + getData(); + } + },[baginT,endT]) + + function getData() { + const url = `/users/${userLogin}/headmaps.json`; + Axios.get(url).then(result=>{ + if(result && result.data){ + let m = result.data.headmaps; + m.sort(compare('contributions')); + let max = m[m.length -1].contributions; + Init(m,max); + } + }).catch(error=>{}) + } + + function compare(property){ + return function(a,b){ + var value1 = a[property]; + var value2 = b[property]; + return value1 - value2; + } + } + + function getVirtulData(data) { + var array = []; + for(var i=0;i + ) +} +export default Calendar; \ No newline at end of file diff --git a/src/forge/users/Echart/Cloud.jsx b/src/forge/users/Echart/Cloud.jsx index cbe182a2..3b53108a 100644 --- a/src/forge/users/Echart/Cloud.jsx +++ b/src/forge/users/Echart/Cloud.jsx @@ -9,30 +9,35 @@ function Cloud({data}) { function optionChart1(){ var div = new Js2WordCloud(document.getElementById('cloud')) - let textList=[ - ['服务'], ['细致'], ['意识'], ['踏实'],['开发'], ['反馈'], ['协助'],['使用'],['谈判'] - ] + let textList=['服务', '细致', '意识', '踏实','开发', '反馈'] let cyList=[] - for(let i=0;i<60;i++){ - cyList.push([textList[parseInt(Math.random()*textList.length)],Math.round(Math.random()*10)+1]) + for(let i=0;i=12 && fontSize<=20) { - return 'rgb(29,227,250,0.3)'; - } else if(fontSize>20 && fontSize<=30){ - return 'rgb(29,227,250,0.6)'; - }else if(fontSize>30 && fontSize<=40){ - return 'rgb(29,227,250)'; + switch(fontSize){ + case 21: + return "#f8e367" + case 20: + return "#99dfff" + case 19: + return "#ff9e48" + case 18: + return "#5ea6ff" + case 17: + return "#58c0f0" + default: + return "#bcbcbc" } }, }) diff --git a/src/forge/users/Echart/Line.jsx b/src/forge/users/Echart/Line.jsx index 2092b87c..20ea7590 100644 --- a/src/forge/users/Echart/Line.jsx +++ b/src/forge/users/Echart/Line.jsx @@ -19,19 +19,21 @@ function Line({data}) { color: ["#f8e367", "#99dfff", "#58c0f0", "#5ea6ff", "#ff9e48", "#bcbcbc"], title: { text: '近期活动统计', - left: '3%' + left: '3%', + top:"3%" }, tooltip: { trigger: 'axis' }, legend: { data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎'], - right: '3%' + right: 'center', + bottom: '0', }, grid: { - left: '3%', + left: '4%', right: '4%', - bottom: '3%', + bottom: '12%', containLabel: true }, toolbox: { @@ -42,7 +44,10 @@ function Line({data}) { xAxis: { type: 'category', boundaryGap: false, - data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] + data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], + axisTick:{ + show:false + } }, yAxis: { type: 'value', diff --git a/src/forge/users/GeneralView/Activity.jsx b/src/forge/users/GeneralView/Activity.jsx new file mode 100644 index 00000000..90c7e524 --- /dev/null +++ b/src/forge/users/GeneralView/Activity.jsx @@ -0,0 +1,25 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; +import { AlignCenter } from '../../Component/layout'; +import { TagInfo } from '../../Utils/TagColor'; +import { getImageUrl } from 'educoder'; + +function Activity() { + return( + + ) +} +export default Activity; \ No newline at end of file diff --git a/src/forge/users/GeneralView/ConcentrateBox.jsx b/src/forge/users/GeneralView/ConcentrateBox.jsx new file mode 100644 index 00000000..b3d987fe --- /dev/null +++ b/src/forge/users/GeneralView/ConcentrateBox.jsx @@ -0,0 +1,98 @@ +import React, { useEffect, useState } from 'react'; +import { Modal , Checkbox , Pagination , Button , Spin } from 'antd'; +import Axios from 'axios'; +import { Link } from 'react-router-dom'; +import { FlexAJ } from '../../Component/layout'; + +const limit = 20; +function ConcentrateBox({ visible , onCancel , onSure , username , choosed }) { + const [ page , setPage ]= useState(1); + const [ total , setTotal ]= useState(0); + const [ list , setList ]= useState(undefined); + const [ value , setValue ]= useState([]); + const [ isSpin , setIsSpin ]= useState(true); + const [ disable , setDisable ] = useState(false); + + useEffect(()=>{ + if(visible){ + setIsSpin(true); + getProjectList(); + } + },[visible,page]) + + useEffect(()=>{ + if(choosed && choosed.length >0 ){ + setValue(choosed); + } + },[choosed]) + + useEffect(()=>{ + if(value && value.length === 6){ + setDisable(true); + }else{ + setDisable(false); + } + },[value]) + + function getProjectList() { + const url = `/users/${username}/projects.json`; + Axios.get(url,{ + params:{ + page,limit,is_public: "public" + } + }).then(result=>{ + if(result && result.data){ + setTotal(result.data.count); + setList(result.data.projects); + setIsSpin(false); + } + }).catch(error=>{}) + } + + function onOk() { + onSure && onSure(value); + setValue([]); + } + + function chooseProject(params) { + setValue(params); + } + + return( + + {total > limit && + setPage(p)} total={total}/> + } + + + + + + } + > + + { + list && list.length > 0 && + + { + list.map((i,k)=>{ + return( + j === i.id).length===0)}>{i.name} + ) + }) + } + + } + { list && list.length === 0 &&
您还没有公开的项目,先去新建项目
} +
+
+ ) +} +export default ConcentrateBox; \ No newline at end of file diff --git a/src/forge/users/GeneralView/ConcentrateProject.jsx b/src/forge/users/GeneralView/ConcentrateProject.jsx new file mode 100644 index 00000000..bcd3249c --- /dev/null +++ b/src/forge/users/GeneralView/ConcentrateProject.jsx @@ -0,0 +1,86 @@ +import React, { useEffect, useState } from 'react'; +import { AlignAJBottom , AlignCenter } from '../../Component/layout'; +import { Link } from 'react-router-dom'; +import { Spin } from 'antd'; +import axios from 'axios'; + +import Box from './ConcentrateBox'; + +function ConcentrateProject({userLogin,current}) { + const [ list , setList ] = useState(undefined); + const [ visible , setVisible ] = useState(false); + const [ isSpin , setIsSpin ] = useState(false); + const [ value , setValue ] = useState([]); + + useEffect(()=>{ + setIsSpin(true); + getList(); + },[]) + + function getList() { + const url = `/users/${userLogin}/is_pinned_projects.json`; + axios.get(url).then(result=>{ + if(result && result.data){ + let p = result.data.projects; + setList(p); + setIsSpin(false); + if(p && p.length > 0){ + let array = p.map(i=>{ + return i.id + }) + setValue(array); + } + } + }).catch(erroer=>{}) + } + + function onSure(is_pinned_project_ids) { + const url = `/users/${userLogin}/is_pinned_projects/pin.json`; + axios.post(url,{ + is_pinned_project_ids + }).then(result=>{ + if(result && result.data){ + setVisible(false); + setIsSpin(true); + getList(); + } + }).catch(error=>{}) + } + return( + + setVisible(false)} onSure={onSure} username={userLogin} choosed={value}/> + { + list && list.length>0 && +
+ + 精选项目 + { current && setVisible(true)}>自定义精选项目 } + +
+
    + { + list.map((i,k)=>{ + return( +
  • + {i.name} +

    {i.description}

    + + { i.category && {i.category.name} } + {i.watchers_count} + {i.forked_count} + +
  • + ) + }) + } +
+
+
+ } + { + list && list.length === 0 && current &&
你还没有设置精选项目,setVisible(true)}>点击设置
+ } +
+ ) +} +export default ConcentrateProject; \ No newline at end of file diff --git a/src/forge/users/GeneralView/Index.jsx b/src/forge/users/GeneralView/Index.jsx index 9a76e9aa..5cf06032 100644 --- a/src/forge/users/GeneralView/Index.jsx +++ b/src/forge/users/GeneralView/Index.jsx @@ -1,22 +1,54 @@ -import React from 'react'; +import React, { useState } from 'react'; import './Index.scss'; import 'echarts/lib/component/tooltip'; import 'echarts/lib/component/title'; import 'echarts/lib/component/legend' import 'echarts/lib/component/markPoint'; -import Pie from '../Echart/Pie'; -import Line from '../Echart/Line'; -import Radar from '../Echart/Radar'; -import Cloud from '../Echart/Cloud'; +import { Select , Pagination } from 'antd'; +import { FlexAJ } from '../../Component/layout'; +import Line from '../Echart/Line'; +import Calendar from '../Echart/Calendar'; +import ConcentrateProject from './ConcentrateProject'; +import Activity from './Activity'; + +const aLimit = 5; function Index(props) { + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + const username = props.match.params.username; + const current_user = props.current_user; + + // 在贡献度日历表中选择一个时间 + function chooseTime(data) { + if(data){ + console.log(data); + } + } + return(
- - - - +
+ +
+
+ +
+
+ + 贡献度 + + + +
+
+ 动态 + + { total > aLimit &&
setPage(p)}/>
} +
) } diff --git a/src/forge/users/GeneralView/Index.scss b/src/forge/users/GeneralView/Index.scss index e69de29b..4a7659ee 100644 --- a/src/forge/users/GeneralView/Index.scss +++ b/src/forge/users/GeneralView/Index.scss @@ -0,0 +1,128 @@ +.concentrate{ + padding:20px 30px; + .concentrateUl{ + display: flex; + flex-wrap: wrap; + margin-top: 15px; + li{ + width: 48.5%; + margin-right: 3%; + margin-bottom: 20px; + display: flex; + flex-direction: column; + justify-content: flex-start; + background-color: #fafafa; + padding:15px 20px; + cursor: default ; + &:nth-child(2n){ + margin-right: 0px; + } + .name{ + font-size: 16px; + color: #4CACFF; + } + .desc{ + color: #999; + } + .tagName{ + display: block; + background-color: #f7f5f5; + border-radius: 3px; + color: #666; + padding:0px 10px; + height: 22px; + line-height: 22px; + font-size: 13px; + } + .pariseCount,.forkCount{ + i{ + font-size: 14px!important; + margin-right: 4px; + } + color: #999; + margin-left: 20px; + } + } + } +} +.ConcentrateTip{ + margin:20px 30px; + padding:5px 20px; + border:1px solid rgb(248, 56, 56); + border-radius: 4px; + background-color: rgba(248, 56, 56,0.1); + color: rgb(248, 56, 56); + display: flex; + align-items: center; + a{ + color: #4cacff; + } + i{ + font-size: 15px!important; + margin-right: 5px; + } +} +.ConcentrateBox{ + .ant-modal-body{ + min-height: 258px; + } + .ant-checkbox-group{ + display: flex; + flex-wrap: wrap; + .ant-checkbox-wrapper{ + width: 50%; + margin-left: 0px!important; + display: flex; + .ant-checkbox{ + padding-top: 3px; + } + span:last-child{ + flex:1; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + } + } +} + +.recentStatic{ + padding-bottom: 30px; +} +.calendarStatic,.activeStatic{ + padding:0px 30px; + .infosActivity{ + padding-bottom: 30px; + &>li{ + display: flex; + border-bottom:1px solid #eee; + align-items: center; + padding:20px 0px; + .aImg{ + width: 48px; + height: 48px; + margin-right: 20px; + border-radius: 50%; + } + .aInfos{ + flex: 1; + span{ + margin-left: 20px; + margin-right: 0px; + } + .name{ + font-size: 16px; + color:#333; + } + .time,.status{ + color: #999; + } + .aDesc{ + color: #666; + margin-top: 5px; + line-height: 20px; + } + } + } + } +} \ No newline at end of file diff --git a/src/forge/users/Index.scss b/src/forge/users/Index.scss index d8d4ecd4..7dba18e7 100644 --- a/src/forge/users/Index.scss +++ b/src/forge/users/Index.scss @@ -1,6 +1,6 @@ $flex:flex; .headerbox{ - padding:20px 40px; + padding:20px 30px; border-bottom: 1px solid #E0E0E0; display: $flex; align-items: center; @@ -25,7 +25,7 @@ $flex:flex; } } .contentBox{ - padding:20px 40px 0px 40px; + padding:20px 30px 0px 30px; & > div{ margin-bottom: 20px; display: $flex; @@ -97,6 +97,7 @@ ul.ant-menu.menuStyle{ line-height: 70px; padding:0px; margin-right: 30px!important; + border-bottom:transparent!important; } } .disposeInfo{ @@ -135,4 +136,31 @@ ul.ant-menu.menuStyle{ padding:28px 0px; border-bottom: 1px solid #eee; } +} + +.infosRightMenu{ + padding:0px 10px; + .ant-menu-item{ + padding:0px; + margin:0px 20px!important; + font-size: 17px; + height: 60px; + line-height: 60px; + border-bottom: 2px solid transparent!important; + position: relative; + .menuNum{ + font-size: 12px; + margin-left: 3px; + color: #FF6E21; + } + &.ant-menu-item-selected::before{ + position: absolute; + width: 16px; + bottom: 7px; + height: 2px; + left: 0px; + background-color: #1890ff; + content:""; + } + } } \ No newline at end of file diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 11b82db3..24c25f8f 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 { Avatar, Tag, Button, Spin } from "antd"; +import { Avatar, Tag, Button, Spin , Menu } from "antd"; import FocusButton from "../UsersList/focus_button"; import axios from "axios"; @@ -24,6 +24,10 @@ const InfosDevOpsCD = Loadable({ loading: Loading, }); +const Statistics = Loadable({ + loader: () => import("./Statistics/Index"), + loading: Loading, +}); const GeneralView = Loadable({ loader: () => import("./GeneralView/Index"), loading: Loading, @@ -46,8 +50,8 @@ const FanUser = Loadable({ loading: Loading, }) -const UndoEvents = Loadable({ - loader: () => import("./undo_events"), +const Notice = Loadable({ + loader: () => import("../Notice/Index"), loading: Loading, }) class Infos extends Component { @@ -57,19 +61,52 @@ class Infos extends Component { isSpin: false, user: undefined, project_type: undefined, - route_type: undefined + route_type: undefined, + undo_events:0, + undo_messages:0, + menuKey:"0" }; } + renderPath=(pathname)=>{ + const { username } = this.props.match.params; + if(pathname === `/users/${username}`){ + this.setState({menuKey:"0"}); + }else if(pathname === `/users/${username}/statistics`){ + this.setState({menuKey:"1"}); + }else if(pathname.indexOf(`/users/${username}/projects`)>-1){ + this.setState({menuKey:"2"}); + }else if(pathname === `/users/${username}/notice`){ + this.setState({menuKey:"3"}); + }else if(pathname.indexOf(`/users/${username}/devops`)>-1){ + this.setState({menuKey:"4"}); + }else if(pathname === `/users/${username}/organizes`){ + this.setState({menuKey:"5"}); + } + } + componentDidMount = () => { this.fetchUser(); + const { pathname } = this.props.location; + this.renderPath(pathname); }; + componentDidUpdate=(prevProps)=>{ const { username } = this.props.match.params; const prevUser = prevProps.match.params.username; if(prevUser && username && prevUser !== username){ this.fetchUser(); } + const { pathname } = this.props.location; + const prevPath = prevProps.location.pathname; + if(prevPath && pathname && prevPath !== pathname){ + this.renderPath(pathname); + } + this.props.history.listen(()=>{ + if (document.body.scrollTop || document.documentElement.scrollTop > 0) { + window.scrollTo(0, 0) + } + }) } fetchUser = () => { @@ -78,14 +115,22 @@ class Infos extends Component { }); const { current_user } = this.props; const { username } = this.props.match.params; + const { pathname } = this.props.location; + 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 }); }) .catch((error) => { @@ -95,19 +140,19 @@ class Infos extends Component { }); }; - 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_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; @@ -119,11 +164,15 @@ class Infos extends Component { } undo_link = () => { - const {user} = this.state + const {user } = this.state; this.setState({ - route_type: undefined + route_type: undefined, + project_type:"notice", + notice:true + },()=>{ + this.props.history.push(`/users/${user && user.login}/notice`); + this.fetchUser(); }) - this.props.history.push(`/users/${user && user.login}/undo_events`) } route_link = (type) => { @@ -135,7 +184,8 @@ class Infos extends Component { organize_link = () => { const {user} = this.state this.setState({ - route_type: undefined + route_type: undefined, + project_type:"organizes" }) this.props.history.push(`/users/${user && user.login}/organizes`) } @@ -145,18 +195,15 @@ class Infos extends Component { const { current_user, mygetHelmetapi } = this.props; const { username } = this.props.match.params; - const { user, isSpin, project_type, route_type } = this.state; + const { user, isSpin, project_type, route_type , undo_events , undo_messages , menuKey } = this.state; return (
-
- +
+ {user && user.user_identity && (
{user && user.user_identity} @@ -165,7 +212,6 @@ class Infos extends Component {
{user && user.username}
-
{user && current_user && user.login === current_user.login && (
@@ -216,85 +262,74 @@ class Infos extends Component {
- {/* {current_user && user && current_user.id === user.id && ( -
-
-

this.undo_link()}> + {/*

+
+
  • +

    this.undo_link()}> 待办事项 - {user.undo_events} + {undo_events}

    -
  • +
    - )} */} - +
    + +
    +
      +
    • this.change_project_type(undefined)}> + + 项目类型 + +
    • +
    • this.change_project_type("common")}> +

      + 开源托管项目 + + {user && user.common_projects_count} + +

      +
    • +
    • this.change_project_type("mirror")}> +

      + 开源镜像项目 + + {user && user.mirror_projects_count} + +

      +
    • +
    • this.change_project_type("sync_mirror")}> +

      + 镜像托管项目 + + {user && user.sync_mirror_projects_count} + +

      +
    • +
    +
    +
      -
    • this.change_project_type(undefined)}> - - 项目类型 +
    • + + DevOps工作流
    • -
    • this.change_project_type("common")}> +
    • this.change_devops_type("CIService")}>

      - 开源托管项目 - - {user && user.common_projects_count} - -

      -
    • -
    • this.change_project_type("mirror")}> -

      - 开源镜像项目 - - {user && user.mirror_projects_count} - -

      -
    • -
    • this.change_project_type("sync_mirror")}> -

      - 镜像托管项目 - - {user && user.sync_mirror_projects_count} - + CI服务

    - { - current_user && current_user.login && current_user.login === username && -
    -
      -
    • - - DevOps工作流 - -
    • -
    • this.change_devops_type("CIService")}> -

      - CI服务 -

      -
    • - {/*
    • this.change_devops_type("CDService")}> -

      - CD服务 - - {user && user.common_projects_count} - -

      -
    • */} -
    -
    - } - - -
    -
    -

    this.organize_link()} > +

    +
    +
  • +

    this.organize_link()} > 组织 @@ -303,72 +338,93 @@ class Infos extends Component { {user && user.user_org_count}

    -
  • +
    +
    */}
    + + 概览 + 数据统计 + 项目 + { + current_user && user && user.login === current_user.login ? + 待办事项({undo_events}) + :"" + } + { + current_user && current_user.login && current_user.login === username ? + DevOps工作流 + :"" + } + 组织({user && user.user_org_count}) + {user && ( -
    - + + { + return ; + }} + > { - return ; - }} - > - { - return ; - }} - > - { - return ; - }} - > - { - return ; - }} - > - { - return ; - }} - > - { - return ; - }} - > - { - return ; - }} - > - { - return ; - }} - > - { - return ; - }} - > - -
    + path="/users/:username/notice" + render={() => { + return ; + }} + > + { + return ; + }} + > + { + return ; + }} + > + { + return ; + }} + > + { + return ; + }} + > + { + return ; + }} + > + { + return ; + }} + > + { + return ; + }} + > + { + return ; + }} + > + )}
    -
    +
    ); diff --git a/src/forge/users/InfosUser.js b/src/forge/users/InfosUser.js index 3a185a78..b37df4b7 100644 --- a/src/forge/users/InfosUser.js +++ b/src/forge/users/InfosUser.js @@ -100,9 +100,6 @@ class InfosUser extends Component { const {is_public} = this.state const new_is_public = is_public === check_is_public ? undefined : check_is_public - // this.setState({ - // is_public: new_is_public - // }) this.state.is_public = new_is_public this.get_projects(new_is_public); } diff --git a/src/forge/users/Statistics/Index.jsx b/src/forge/users/Statistics/Index.jsx new file mode 100644 index 00000000..3b20ea1e --- /dev/null +++ b/src/forge/users/Statistics/Index.jsx @@ -0,0 +1,21 @@ +import React from 'react'; +import './Index.scss'; +import 'echarts/lib/component/tooltip'; +import 'echarts/lib/component/title'; +import 'echarts/lib/component/legend' +import 'echarts/lib/component/markPoint'; + +import Pie from '../Echart/Pie'; +import Cloud from '../Echart/Cloud'; +import Radar from '../Echart/Radar'; + +function Index() { + return( +
    + + + +
    + ) +} +export default Index; \ No newline at end of file diff --git a/src/forge/users/Statistics/Index.scss b/src/forge/users/Statistics/Index.scss new file mode 100644 index 00000000..e69de29b