This commit is contained in:
caishi 2020-07-06 16:11:44 +08:00
parent 8e0f2ca2bb
commit b92bdb275e
10 changed files with 267 additions and 344 deletions

View File

@ -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 =()=> (
<Menu>
{
ARRAY && ARRAY.map((item,key)=>{
return(
<Menu.Item key={item.id} onClick={this.changeTime}>{item.name}</Menu.Item>
)
})
}
</Menu>
)
render(){
const { time , data , page , project_trends , isSpin } = this.state;
const menu = (
<Menu>
{
ARRAY && ARRAY.map((item,key)=>{
return(
<Menu.Item key={item.id} onClick={this.changeTime}>{item.name}</Menu.Item>
)
})
}
</Menu>
);
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{
</div>
<div className="df trendsTop mt20">
<div className="branchDropdown f-wrap-alignCenter">
<Dropdown overlay={menu} trigger={['click']} placement="bottomLeft">
<Dropdown overlay={this.menu()} trigger={['click']} placement="bottomLeft">
<a className="ant-dropdown-link">
<span className="color-grey-9 mr3">周期:</span>
{name && name.length>0 && name[0].name} <Icon type="down" />

View File

@ -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(
<div className="activity_item">
<div className="flex1">
return (
<div className="activity_item">
<div className="flex1">
{/* 如果是版本发布 */}
{ item.trend_type==="VersionRelease"? 
<p className="itemLine">
<Link to={`/projects/${projectsId}/version`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
{item.trend_type === "VersionRelease" ?
<p className="itemLine">
<Link to={`/projects/${projectsId}/version`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
:
// 如果是任务
item.trend_type==="Issue"?
<p className="itemLine">
<Link to={`/projects/${projectsId}/orders/${item.trend_id}/detail`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
:
// 如果是合并请求
<p className="itemLine">
<Link to={`/projects/${projectsId}/merge/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
}
<p className="itemLine mt15">
<Link to={`/users/${item && item.login}`} className="show-user-link">
<img alt="" src={getImageUrl(`images/${item.user_avatar}`)} className="createImage"/>
<span className="mr20">{item.user_name}</span>
</Link>
{ item.created_at && <span className="color-grey-9">创建于<span className="ml2 color-grey-6">{item.created_at}</span></span>}
item.trend_type === "Issue" ?
<p className="itemLine">
<Link to={`/projects/${projectsId}/orders/${item.trend_id}/detail`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
</div>
</div>
:
// 如果是合并请求
<p className="itemLine">
<Link to={`/projects/${projectsId}/merge/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
}
<p className="itemLine mt15">
<Link to={`/users/${item && item.login}`} className="show-user-link">
<img alt="" src={getImageUrl(`images/${item.user_avatar}`)} className="createImage" />
<span className="mr20">{item.user_name}</span>
</Link>
{item.created_at && <span className="color-grey-9">创建于<span className="ml2 color-grey-6">{item.created_at}</span></span>}
</p >
</div>
</div>
)
}
}

View File

@ -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({

View File

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

View File

@ -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}
</AutoComplete>
)}
@ -438,7 +422,6 @@ class Index extends Component {
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LicensesList, "license")}
>
{/* {this.setOptionsList(LicensesList,license_name)} */}
{license_list}
</AutoComplete>
)}

View File

@ -89,100 +89,92 @@ class children_comments extends Component {
return <RenderHtml className="break_word_comments" value={v} />;
};
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(
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
)
}
}
renderList = (item) => {
const { current_user } = this.props;
const Paginations = (
<React.Fragment>
{search_count > limit ? (
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
) : (
""
)}
</React.Fragment>
);
const renderList = (item) => {
return (
<div className="width100">
<div className="grid-item pb5">
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link"
>
<img
className="radius"
src={getImageUrl(`images/${item && item.user_picture}`)}
alt=""
width="30"
height="30"
/>
</Link>
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link color-black ml10 fwb"
>
{item && item.user_name}
</Link>
</div>
<div className="ml40">
{this.commentCtx(item.content)}
{item && item.attachments && item.attachments.length > 0 ? (
<Attachments
attachments={item.attachments}
showNotification={this.props.showNotification}
canDelete={
current_user &&
(current_user.admin || current_user.login === item.user_login)
}
/>
) : (
""
)}
<div className="mt5">
<span className="color-grey-8">{item.created_at}</span>
<span className="ml20">
{current_user &&
(current_user.admin ||
current_user.login === item.user_login) ? (
<Popconfirm
placement="bottom"
title={"确定要删除当前评论吗?"}
okText="是"
cancelText="否"
onConfirm={() => this.deleteorder(item.id)}
>
<Button type="link">
<i className="iconfont icon-shanchu3 font-15 color-grey-6 mr5 ver-middle"></i>
<span className="font-12 color-grey-6">删除</span>
</Button>
</Popconfirm>
) : (
""
)}
</span>
</div>
</div>
return (
<div className="width100">
<div className="grid-item pb5">
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link"
>
<img
className="radius"
src={getImageUrl(`images/${item && item.user_picture}`)}
alt=""
width="30"
height="30"
/>
</Link>
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link color-black ml10 fwb"
>
{item && item.user_name}
</Link>
</div>
);
};
<div className="ml40">
{this.commentCtx(item.content)}
{item && item.attachments && item.attachments.length > 0 ? (
<Attachments
attachments={item.attachments}
showNotification={this.props.showNotification}
canDelete={
current_user &&
(current_user.admin || current_user.login === item.user_login)
}
/>
) : (
""
)}
<div className="mt5">
<span className="color-grey-8">{item.created_at}</span>
<span className="ml20">
{current_user &&
(current_user.admin ||
current_user.login === item.user_login) ? (
<Popconfirm
placement="bottom"
title={"确定要删除当前评论吗?"}
okText="是"
cancelText="否"
onConfirm={() => this.deleteorder(item.id)}
>
<Button type="link">
<i className="iconfont icon-shanchu3 font-15 color-grey-6 mr5 ver-middle"></i>
<span className="font-12 color-grey-6">删除</span>
</Button>
</Popconfirm>
) : (
""
)}
</span>
</div>
</div>
</div>
);
}
render() {
const { journalsdata , search_count , isSpin } = this.state;
return (
<div>
{search_count > 0 && (
@ -191,9 +183,9 @@ class children_comments extends Component {
size="large"
loading={isSpin}
dataSource={journalsdata.issue_journals}
renderItem={(item) => <List.Item>{renderList(item)}</List.Item>}
renderItem={(item) => <List.Item>{this.renderList(item)}</List.Item>}
/>
{Paginations}
{this.Paginations()}
</div>
)}
</div>

View File

@ -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 <RenderHtml className="break_word_comments" value={v} />;
};
render() {
const {
journalsdata,
page,
limit,
search_count,
isSpin
} = this.state;
const { current_user } = this.props;
const Paginations = (
<React.Fragment>
{search_count > limit ? (
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
) : (
""
)}
</React.Fragment>
);
const renderList = (item) => {
return (
<div className="width100">
<div className="grid-item pb10">
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link"
>
<img
className="radius"
src={getImageUrl(`images/${item && item.user_picture}`)}
alt=""
width="30"
height="30"
/>
</Link>
<span className="grid-item">
<span>
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link color-blue ml10"
>
{item && item.user_name}
</Link>
<span className="color-grey-8 ml20">{item.created_at}</span>
</span>
<span className="text-right">
{current_user &&
(current_user.admin ||
current_user.login === item.user_login) ? (
<Popconfirm
placement="bottom"
title={"确定要删除当前评论吗?"}
okText="是"
cancelText="否"
onConfirm={() => this.deleteorder(item.id)}
>
<Button type="link">
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</Button>
</Popconfirm>
) : (
""
)}
</span>
</span>
</div>
<div className="ml30">
{this.commentCtx(item.content)}
{item && item.attachments && item.attachments.length > 0 ? (
<Attachments
attachments={item.attachments}
showNotification={this.props.showNotification}
canDelete={
current_user &&
(current_user.admin || current_user.login === item.user_login)
}
/>
) : (
""
)}
</div>
Paginations =()=> {
const { page, limit, search_count } = this.state;
if(search_count > limit){
return(
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
);
};
)
}
}
renderList = (item) => {
const { current_user } = this.props;
return (
<div className="width100">
<div className="grid-item pb10">
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link"
>
<img
className="radius"
src={getImageUrl(`images/${item && item.user_picture}`)}
alt=""
width="30"
height="30"
/>
</Link>
<span className="grid-item">
<span>
<Link
to={`/users/${item && item.user_login}`}
className="show-user-link color-blue ml10"
>
{item && item.user_name}
</Link>
<span className="color-grey-8 ml20">{item.created_at}</span>
</span>
<span className="text-right">
{current_user &&
(current_user.admin ||
current_user.login === item.user_login) ? (
<Popconfirm
placement="bottom"
title={"确定要删除当前评论吗?"}
okText="是"
cancelText="否"
onConfirm={() => this.deleteorder(item.id)}
>
<Button type="link">
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</Button>
</Popconfirm>
) : (
""
)}
</span>
</span>
</div>
<div className="ml30">
{this.commentCtx(item.content)}
{item && item.attachments && item.attachments.length > 0 ? (
<Attachments
attachments={item.attachments}
showNotification={this.props.showNotification}
canDelete={
current_user &&
(current_user.admin || current_user.login === item.user_login)
}
/>
) : (
""
)}
</div>
</div>
);
}
render() {
const { journalsdata , search_count , isSpin } = this.state;
return (
<div>
{
@ -162,13 +150,13 @@ class children_journals extends Component {
size="large"
loading={isSpin}
dataSource={journalsdata.issue_journals}
renderItem={(item) => <List.Item>{renderList(item)}</List.Item>}
renderItem={(item) => <List.Item>{this.renderList(item)}</List.Item>}
/>
{Paginations}
{this.Paginations()}
</div>
}
</div>
);
)
}
}

View File

@ -265,7 +265,22 @@ class comments extends Component {
commentCtx = (v) => {
return <RenderHtml className="break_word_comments" value={v} />;
};
Paginations = ()=>{
const { page, limit, search_count } = this.state;
if(search_count > limit){
return(
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
)
}
}
render() {
const {
journalsdata,
@ -285,24 +300,6 @@ class comments extends Component {
} = this.state;
const { current_user, only_show_content } = this.props;
const Paginations = (
<React.Fragment>
{search_count > limit ? (
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
) : (
""
)}
</React.Fragment>
);
const new_comment = (is_reply, item_id) => {
return (
<div className="grid-item-top pb10">
@ -501,7 +498,7 @@ class comments extends Component {
renderItem={(item) => <List.Item>{renderList(item)}</List.Item>}
/>
)}
{Paginations}
{this.Paginations()}
</div>
) : (
<div className="mt20">
@ -562,7 +559,7 @@ class comments extends Component {
)}
</TabPane>
</Tabs>
{Paginations}
{this.Paginations()}
</div>
</div>
)}

View File

@ -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 = (
<React.Fragment>
{search_count > limit ? (
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination
simple
defaultCurrent={page}
total={search_count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
) : (
""
)}
</React.Fragment>
);
const renderList = () => {
if (
journalsdata &&

View File

@ -194,7 +194,6 @@ class InfosUser extends Component {
</a>
</Popover>
)}
<Popover content={this.menu()} trigger={["click"]} placement="bottom">
<a className="ant-dropdown-link">
<span className="color-blue font-16">
@ -215,30 +214,28 @@ class InfosUser extends Component {
:""
}
</div>
{projectsList && projectsList.length > 0 ? (
<ListItem
{...this.props}
{...this.state}
projects={projectsList}
></ListItem>
) : (
<Nodata _html={`暂时没有项目`} />
)}
{projectsList && projectsList.length > 0 ?
<ListItem
{...this.props}
{...this.state}
projects={projectsList}
></ListItem>
:
<Nodata _html={`暂时没有项目`} />
}
{
total && total > limit ? (
<div className="edu-txt-center pt30 mb30">
<Pagination
simple
defaultCurrent={page}
total={total}
pageSize={limit}
onChange={this.changePage}
></Pagination>
</div>
) : (
""
)
total && total > limit ?
<div className="edu-txt-center pt30 mb30">
<Pagination
simple
defaultCurrent={page}
total={total}
pageSize={limit}
onChange={this.changePage}
></Pagination>
</div>
:
""
}
</Spin>
);