diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index cf16252ed..7e84e4186 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -27,7 +27,6 @@ const ARRAY = [ name:'1个月' } ] -// const dataformat="YYYY-MM-DD HH:mm"; class Activity extends Component{ constructor(props){ @@ -97,27 +96,22 @@ class Activity extends Component{ const { time,type,status } = this.state; this.getInfo(time,type,status,page); } + menu =()=> ( + + { + ARRAY && ARRAY.map((item,key)=>{ + return( + {item.name} + ) + }) + } + + ) render(){ const { time , data , page , project_trends , isSpin } = this.state; - const menu = ( - - { - ARRAY && ARRAY.map((item,key)=>{ - return( - {item.name} - ) - }) - } - - ); - let name = time && ARRAY.filter(item=>item.id === parseInt(time)) ; - // console.log(name); - - const second_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%'; - const third_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%'; const fourth_per = (parseInt(data && data.open_issues_count)/parseInt(data && data.issues_count)*100)+'%'; return( @@ -162,7 +156,7 @@ class Activity extends Component{
- + 周期: {name && name.length>0 && name[0].name} diff --git a/src/forge/Activity/ActivityItem.js b/src/forge/Activity/ActivityItem.js index 90e5e83da..ba0ff5d79 100644 --- a/src/forge/Activity/ActivityItem.js +++ b/src/forge/Activity/ActivityItem.js @@ -1,46 +1,45 @@ -import React , { Component } from 'react'; -import {Link} from 'react-router-dom'; +import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; import './activity.css'; import { getImageUrl } from 'educoder'; -class ActivityItem extends Component{ - render(){ +class ActivityItem extends Component { + render() { const { projectsId } = this.props.match.params; const { item } = this.props; - return( - - + return ( +
+
{/* 如果是版本发布 */} - { item.trend_type==="VersionRelease"?  - - {item.name} - {item.trend_type} + {item.trend_type === "VersionRelease" ? +

+ {item.name} + {item.trend_type}

: // 如果是任务 - item.trend_type==="Issue"? - - {item.name} - {item.trend_type} -

- : - // 如果是合并请求 - - {item.name} - {item.trend_type} -

- } - - - - {item.user_name} - - - { item.created_at && 创建于{item.created_at}} + item.trend_type === "Issue" ? +

+ {item.name} + {item.trend_type}

-
-
+ : + // 如果是合并请求 +

+ {item.name} + {item.trend_type} +

+ } +

+ + + {item.user_name} + + {item.created_at && 创建于{item.created_at}} +

+
+
) } } diff --git a/src/forge/Index.js b/src/forge/Index.js index b18cc0a60..74b214489 100644 --- a/src/forge/Index.js +++ b/src/forge/Index.js @@ -14,7 +14,7 @@ import Loading from "../Loading"; import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC"; const ProjectNew = Loadable({ - loader: () => import("./New/Index"), + loader: () => import("./New/Index"), loading: Loading, }); const ProjectIndex = Loadable({ diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index bf2c14638..7eb4fe7d2 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -30,6 +30,9 @@ class CoderRootCommit extends Component{ } getCommitList=(branch , page , limit)=>{ + this.setState({ + isSpining:true + }) const { projectsId } = this.props.match.params; const url = `/repositories/${projectsId}/commits.json`; axios.get(url,{ @@ -76,6 +79,7 @@ class CoderRootCommit extends Component{ } ChangePage=(page)=>{ + const { branch , limit } = this.state; this.getCommitList(branch , page , limit); } diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 5a56a0e1c..521288884 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -1,13 +1,13 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; -import { Input, Form, Select, Checkbox, Button, Divider, Spin, AutoComplete } from 'antd'; +import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete } from 'antd'; import { Base64 } from 'js-base64'; import '../css/index.scss'; import './new.css' import axios from 'axios'; -const Option = Select.Option +const Option = Select.Option; class Index extends Component { constructor(props) { super(props); @@ -41,22 +41,7 @@ class Index extends Component { ignore_name: undefined } } - // getUserInfo = () => { - // const url = `/users/me.json`; - // axios.get(url).then(result => { - // if (result && result.data.login) { - // this.setState({ - // current_user: result.data - // }) - // this.getDetail(); - // } - // }).catch(error => { - // console.log(error) - // }) - // } componentDidMount = () => { - // this.getUserInfo(); - this.check_is_login() // 获取项目类别 this.getCategory(); // 获取项目语言 @@ -65,10 +50,9 @@ class Index extends Component { this.getGitignore(); // 获取开源许可证 this.getLicenses(); - } - check_is_login =() =>{ - if(!this.props.checkIfLogin()){ + componentDidUpdate=(prevPros)=>{ + if(prevPros && this.props && !this.props.checkIfLogin()){ this.props.history.push("/403") return } @@ -243,6 +227,7 @@ class Index extends Component { const { getFieldDecorator } = this.props.form; // 项目类型:deposit-托管项目,mirror-镜像项目 const { projectsType } = this.props.match.params; + const { preType, languageValue, @@ -417,7 +402,6 @@ class Index extends Component { className="plateAutoComplete" onBlur={(value) => this.blurCategory(value, GitignoreList, "ignore")} > - {/* {this.setOptionsList(GitignoreList,ignore_name)} */} {ignore_list} )} @@ -438,7 +422,6 @@ class Index extends Component { className="plateAutoComplete" onBlur={(value) => this.blurCategory(value, LicensesList, "license")} > - {/* {this.setOptionsList(LicensesList,license_name)} */} {license_list} )} diff --git a/src/forge/comments/children_comments.js b/src/forge/comments/children_comments.js index 2fa321658..aca7b83c7 100644 --- a/src/forge/comments/children_comments.js +++ b/src/forge/comments/children_comments.js @@ -89,100 +89,92 @@ class children_comments extends Component { return ; }; - render() { - const { - journalsdata, - page, - limit, - search_count, - isSpin, - parent_id, - } = this.state; + Paginations =()=> { + const { page, limit, search_count } = this.state; + if(search_count > limit){ + return( +
+ +
+ ) + } + } + + renderList = (item) => { const { current_user } = this.props; - const Paginations = ( - - {search_count > limit ? ( -
- -
- ) : ( - "" - )} -
- ); - - const renderList = (item) => { - return ( -
-
- - - - - {item && item.user_name} - -
-
- {this.commentCtx(item.content)} - {item && item.attachments && item.attachments.length > 0 ? ( - - ) : ( - "" - )} -
- {item.created_at} - - {current_user && - (current_user.admin || - current_user.login === item.user_login) ? ( - this.deleteorder(item.id)} - > - - - ) : ( - "" - )} - -
-
+ return ( +
+
+ + + + + {item && item.user_name} +
- ); - }; +
+ {this.commentCtx(item.content)} + {item && item.attachments && item.attachments.length > 0 ? ( + + ) : ( + "" + )} +
+ {item.created_at} + + {current_user && + (current_user.admin || + current_user.login === item.user_login) ? ( + this.deleteorder(item.id)} + > + + + ) : ( + "" + )} + +
+
+
+ ); + } + render() { + const { journalsdata , search_count , isSpin } = this.state; return (
{search_count > 0 && ( @@ -191,9 +183,9 @@ class children_comments extends Component { size="large" loading={isSpin} dataSource={journalsdata.issue_journals} - renderItem={(item) => {renderList(item)}} + renderItem={(item) => {this.renderList(item)}} /> - {Paginations} + {this.Paginations()}
)}
diff --git a/src/forge/comments/children_journals.js b/src/forge/comments/children_journals.js index b3a29fb72..92ecde737 100644 --- a/src/forge/comments/children_journals.js +++ b/src/forge/comments/children_journals.js @@ -1,11 +1,9 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; - import axios from "axios"; import { getImageUrl } from "educoder"; import { List, Popconfirm, Pagination, Button } from "antd"; import Attachments from "../Upload/attachment"; -// import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor"; import RenderHtml from "../../components/render-html"; import "../Order/order.css"; @@ -25,7 +23,7 @@ class children_journals extends Component { //删除评论 deleteorder = (id) => { - const { orderId, parent_id, page, limit } = this.state; + const { orderId, parent_id , limit } = this.state; const url = `/issues/${orderId}/journals/${id}.json`; axios .delete(url, { @@ -37,7 +35,6 @@ class children_journals extends Component { .then((result) => { if (result) { this.props.getChildrenJournals(orderId,parent_id,1,limit); - // this.getChildrenJournals(); } }) .catch((error) => { @@ -51,108 +48,99 @@ class children_journals extends Component { this.state.page = page this.state.isSpin = true this.props.getChildrenJournals(orderId,parent_id,page,limit); - // this.getChildrenJournals(); }; commentCtx = (v) => { return ; }; - render() { - const { - journalsdata, - page, - limit, - search_count, - isSpin - } = this.state; - const { current_user } = this.props; - - const Paginations = ( - - {search_count > limit ? ( -
- -
- ) : ( - "" - )} -
- ); - - const renderList = (item) => { - return ( -
-
- - - - - - - {item && item.user_name} - - {item.created_at} - - - - {current_user && - (current_user.admin || - current_user.login === item.user_login) ? ( - this.deleteorder(item.id)} - > - - - ) : ( - "" - )} - - -
-
- {this.commentCtx(item.content)} - {item && item.attachments && item.attachments.length > 0 ? ( - - ) : ( - "" - )} -
+ Paginations =()=> { + const { page, limit, search_count } = this.state; + if(search_count > limit){ + return( +
+
- ); - }; + ) + } + } + renderList = (item) => { + const { current_user } = this.props; + return ( +
+
+ + + + + + + {item && item.user_name} + + {item.created_at} + + + + {current_user && + (current_user.admin || + current_user.login === item.user_login) ? ( + this.deleteorder(item.id)} + > + + + ) : ( + "" + )} + + +
+
+ {this.commentCtx(item.content)} + {item && item.attachments && item.attachments.length > 0 ? ( + + ) : ( + "" + )} +
+
+ ); + } + + render() { + const { journalsdata , search_count , isSpin } = this.state; return (
{ @@ -162,13 +150,13 @@ class children_journals extends Component { size="large" loading={isSpin} dataSource={journalsdata.issue_journals} - renderItem={(item) => {renderList(item)}} + renderItem={(item) => {this.renderList(item)}} /> - {Paginations} + {this.Paginations()}
}
- ); + ) } } diff --git a/src/forge/comments/comments.js b/src/forge/comments/comments.js index c1a037bc5..5791d77af 100644 --- a/src/forge/comments/comments.js +++ b/src/forge/comments/comments.js @@ -265,7 +265,22 @@ class comments extends Component { commentCtx = (v) => { return ; }; - + Paginations = ()=>{ + const { page, limit, search_count } = this.state; + if(search_count > limit){ + return( +
+ +
+ ) + } + } render() { const { journalsdata, @@ -285,24 +300,6 @@ class comments extends Component { } = this.state; const { current_user, only_show_content } = this.props; - const Paginations = ( - - {search_count > limit ? ( -
- -
- ) : ( - "" - )} -
- ); - const new_comment = (is_reply, item_id) => { return (
@@ -501,7 +498,7 @@ class comments extends Component { renderItem={(item) => {renderList(item)}} /> )} - {Paginations} + {this.Paginations()}
) : (
@@ -562,7 +559,7 @@ class comments extends Component { )} - {Paginations} + {this.Paginations()}
)} diff --git a/src/forge/comments/new.js b/src/forge/comments/new.js index 52979f7e3..d37423b1c 100644 --- a/src/forge/comments/new.js +++ b/src/forge/comments/new.js @@ -1,23 +1,14 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; - import axios from "axios"; -// import Upload from "../Upload/Index"; -// import UploadImg from "../Images/upload.png"; import { getImageUrl } from "educoder"; -// import { List } from "antd"; import Attachments from "../Upload/attachment"; import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor"; import RenderHtml from "../../components/render-html"; -// import new_comment from "./new" import "./order.css"; +import { Popconfirm , Tooltip , Spin } from 'antd'; class comments extends Component { - constructor(props) { - super(props); - this.state = { - }; - } componentDidMount = () => { this.getjournalslist(); @@ -285,37 +276,15 @@ class comments extends Component { }; render() { - const { projectsId, orderId } = this.props.match.params; const { - data, journalsdata, - page, - limit, - search_count, - isSpin, isedit, quillFlag, countvalue, edit_spin, } = this.state; const { current_user } = this.props; - const Paginations = ( - - {search_count > limit ? ( -
- -
- ) : ( - "" - )} -
- ); + const renderList = () => { if ( journalsdata && diff --git a/src/forge/users/InfosUser.js b/src/forge/users/InfosUser.js index 88be56556..4f3764a18 100644 --- a/src/forge/users/InfosUser.js +++ b/src/forge/users/InfosUser.js @@ -194,7 +194,6 @@ class InfosUser extends Component {
)} - @@ -215,30 +214,28 @@ class InfosUser extends Component { :"" } - - {projectsList && projectsList.length > 0 ? ( - - ) : ( - - )} + {projectsList && projectsList.length > 0 ? + + : + + } { - total && total > limit ? ( -
- -
- ) : ( - "" - ) + total && total > limit ? +
+ +
+ : + "" } );