render 内尽量不放方法

This commit is contained in:
caishi 2020-07-06 14:21:48 +08:00
parent 4534bfdd3d
commit 8e0f2ca2bb
27 changed files with 824 additions and 924 deletions

View File

@ -79,16 +79,6 @@ class CoderRootCommit extends Component{
const { branch , limit } = this.state;
this.getCommitList(branch , page , limit);
}
Paginations =(dataCount,limit,page)=> {
if(dataCount > limit){
return(
<div className="edu-txt-center pt30 mb30">
<Pagination simple defaultCurrent={page} total={dataCount} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>
)
}
}
render(){
const { branch , commitDatas , dataCount , limit , page , isSpining } = this.state;
const { branchs , projectDetail, commit_class } = this.props;

View File

@ -119,29 +119,6 @@ class UserSubmitComponent extends Component {
const { current_user, filepath, projectDetail } = this.props;
const { editor_type } = this.props;
const changeSubmitBranch = () => {
if (submitType === "1") {
return (
<div className="mt15">
<Form.Item style={{ paddingLeft: "24px" }}>
{getFieldDecorator("branchname", {
rules: [
{
required: true,
message: "请输入分支名称",
},
],
})(
<Input
placeholder={`请输入分支名称`}
style={{ width: "220px" }}
/>
)}
</Form.Item>
</div>
);
}
};
return (
<div>
<span className="df mt30" style={{ alignItems: "center" }}>
@ -216,7 +193,26 @@ class UserSubmitComponent extends Component {
并发起合并请求
</Radio>
</Radio.Group>
{changeSubmitBranch()}
{
submitType === "1" ?
<div className="mt15">
<Form.Item style={{ paddingLeft: "24px" }}>
{getFieldDecorator("branchname", {
rules: [
{
required: true,
message: "请输入分支名称",
},
],
})(
<Input
placeholder={`请输入分支名称`}
style={{ width: "220px" }}
/>
)}
</Form.Item>
</div>:""
}
</Form>
</div>
</div>

View File

@ -2,15 +2,10 @@
import React, { Component } from "react";
import OrderItem from './order_form'
class CopyDetail extends Component {
constructor(props) {
super(props);
}
render() {
return (
<OrderItem form_type="copy" {...this.props}></OrderItem>
)
}
}
export default CopyDetail;

View File

@ -3,13 +3,11 @@ import { Link } from "react-router-dom";
import axios from "axios";
import { getImageUrl } from "educoder";
import { Modal, Form, Tooltip, Popconfirm, Pagination, Spin, Tag } from "antd";
import { Form , Popconfirm , Tag } from "antd";
import Attachments from "../Upload/attachment";
// import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor";
import RenderHtml from "../../components/render-html";
import Comments from "../comments/comments";
import "./order.css";
// import AmplifyImg from "./AmplifyImg";
class Detail extends Component {
constructor(props) {
@ -55,7 +53,6 @@ class Detail extends Component {
this.setState({
data: result.data,
});
// this.getjournalslist();
}
})
.catch((error) => {

View File

@ -1,7 +1,6 @@
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Dropdown, Icon, Menu, Pagination, Typography, Popconfirm } from 'antd';
import Nav from './Nav';
import NoneData from '../Nodata';
import axios from 'axios';
@ -28,9 +27,6 @@ class Milepost extends Component {
this.getList(1, this.state.status, 'desc');
}
getList = (page, status, order_type, order_name) => {
const { projectsId } = this.props.match.params;
const { limit } = this.state;

View File

@ -6,7 +6,6 @@ import './order.css';
import NoneData from '../Nodata';
import OrderItem from './OrderItem';
import axios from 'axios';
/**
@ -249,7 +248,13 @@ class MilepostDetail extends Component {
}
}
Paginations = (search_count) => {
const { limit, page } = this.state;
if(search_count > limit)
return <div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>;
};
render() {
@ -265,17 +270,6 @@ class MilepostDetail extends Component {
<Menu.Item key={'updated_on'} value="asc">最早更新</Menu.Item>
</Menu>
)
const Paginations = (
<React.Fragment>
{
search_count > limit ?
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
</React.Fragment>
)
return (
<div className="main">
<div className="miledetail mb20">
@ -357,7 +351,7 @@ class MilepostDetail extends Component {
)
})
}
{Paginations}
{this.Paginations(search_count)}
</Spin>
</div>

View File

@ -21,84 +21,80 @@ class OrderItem extends Component {
const { data } = this.props;
const { projectsId } = this.props.match.params;
const renderList = () => {
data.versions.map((item, key) => {
return (
<div style={{ display: 'block' }}>
<div className="milepostdiv">
<div className="milepostwidth">
<div className="grid-item width100">
<i className="iconfont icon-lubiaosignpost3 font-12 mr3"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
</div>
</div>
</div>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="milepostrighe">
<div className="grid-item mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
item.effective_date ?
<span className="color-red">{item.effective_date}</span>
:
<span className="color-grey-c">暂无截止时间</span>
}
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-issue font-14 mr5"></i>
<span>
{item.open_issues_count}个开启
</span>
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-shanchudiao font-14 mr5"></i>
<span>
{item.close_issues_count}个关闭
</span>
</div>
</div>
{
data && data.user_admin_or_member ?
<div className="milepostleft">
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
<a onClick={() => this.updatestatusemile(this.state.status === "closed" ? "open" : "closed", item)} className="color-grey-9">{this.state.status === "closed" ? "开启" : "关闭"}</a>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-lajitong font-14 mr5" ></i>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={() => this.closemile(item)}>
<a className="color-grey-9">删除</a>
</Popconfirm>
</div>
</div>
: ''
}
</div>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="textwidth">
<Text
type="secondary"
ellipsis={{ rows: 30, expandable: false, onExpand: Function }}
>
{item.description}</Text>
</div>
</div>
</div>
)
})
}
return (
<div>
{renderList()}
{
data && data.versions && data.versions.length > 0 && data.versions.map((item, key) => {
return (
<div style={{ display: 'block' }}>
<div className="milepostdiv">
<div className="milepostwidth">
<div className="grid-item width100">
<i className="iconfont icon-lubiaosignpost3 font-12 mr3"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
</div>
</div>
</div>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="milepostrighe">
<div className="grid-item mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
item.effective_date ?
<span className="color-red">{item.effective_date}</span>
:
<span className="color-grey-c">暂无截止时间</span>
}
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-issue font-14 mr5"></i>
<span>
{item.open_issues_count}个开启
</span>
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-shanchudiao font-14 mr5"></i>
<span>
{item.close_issues_count}个关闭
</span>
</div>
</div>
{
data.user_admin_or_member ?
<div className="milepostleft">
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
<a onClick={() => this.updatestatusemile(this.state.status === "closed" ? "open" : "closed", item)} className="color-grey-9">{this.state.status === "closed" ? "开启" : "关闭"}</a>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-lajitong font-14 mr5" ></i>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={() => this.closemile(item)}>
<a className="color-grey-9">删除</a>
</Popconfirm>
</div>
</div>
: ''
}
</div>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="textwidth">
<Text
type="secondary"
ellipsis={{ rows: 30, expandable: false, onExpand: Function }}
>
{item.description}</Text>
</div>
</div>
</div>
)
})
}
</div>
)
}

View File

@ -8,7 +8,6 @@ class Nav extends Component{
projectTag: undefined
}
}
render(){
const { projectsId } = this.props.match.params;
return(

View File

@ -7,6 +7,5 @@ class New extends Component {
<OrderForm form_type="new" {...this.props}></OrderForm>
)
}
}
export default New;

View File

@ -48,74 +48,68 @@ class OrderItem extends Component {
const { projectsId } = this.props.match.params;
const { current_user } = this.props
const renderList = () => {
if (item) {
return (
<div className="issueItem" key={key}>
{current_user && current_user.login && checkbox}
<div className="flex-1">
<p className="mb15 df" style={{alignItems:"center"}}>
<Link to={`/projects/${projectsId}/orders/${item.id}/detail`} className="hide-1 font-16 color-grey-3 lineh-30 mr10" style={{maxWidth:"300px"}}>{item.name}</Link>
{TagInfo(item.priority,"mr10")}
</p>
<p className="color-grey-6 font-12">
<span>{item.format_time}</span><span className="ml5"></span>
{
item.updated_at === item.format_time ? "" :
<span className="ml20"><span>{item.updated_at}</span><span className="ml5"></span></span>
}
</p>
</div>
<ul className="topWrapper_select no-cursor" onMouseMove={() => this.onMouseMove(item.id)} onMouseOut={() => this.onMouseOut()} >
<li>{this.set_issue_tags(item.issue_tags)}</li>
<li>
{
item.author_name ?
<Link to={`/users/${item.author_login}`} className="show-user-link">
{item.author_name}
</Link>
: "--"
}
</li>
<li>
{
item.assign_user_name ?
<Link to={`/users/${item.assign_user_login}`} className="show-user-link">
{item.assign_user_name}
</Link>
: "--"
}
</li>
<li>{item.tracker || "--"}</li>
{ !mile ?<li>{item.version || "--"}</li>:""}
<li>{item.issue_status || "--"}</li>
<li style={{color:`${item.done_ratio === "100%"?"#28BD6C":"#F73030"}`}}>{item.done_ratio || "--"}</li>
<li>
<div className="milepostleft">
<Link to={`/projects/${projectsId}/orders/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
{
current_user && current_user.login ?
<div style={{ display: this.state.orderid === item.id && this.state.isdisplay ? 'flex' : 'none' }}>
<div className="mr8 ml8 color-grey-9">
<Link to={`/projects/${projectsId}/orders/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
</div>
<div className="color-grey-9">
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(item.id)}>
<i className="iconfont icon-yiguanbi1 font-14"></i>
</Popconfirm>
</div>
</div>
: ""
}
</div>
</li>
</ul>
</div>
)
}
}
return (
renderList()
item &&
<div className="issueItem" key={key}>
{current_user && current_user.login && checkbox}
<div className="flex-1">
<p className="mb15 df" style={{alignItems:"center"}}>
<Link to={`/projects/${projectsId}/orders/${item.id}/detail`} className="hide-1 font-16 color-grey-3 lineh-30 mr10" style={{maxWidth:"300px"}}>{item.name}</Link>
{TagInfo(item.priority,"mr10")}
</p>
<p className="color-grey-6 font-12">
<span>{item.format_time}</span><span className="ml5"></span>
{
item.updated_at === item.format_time ? "" :
<span className="ml20"><span>{item.updated_at}</span><span className="ml5"></span></span>
}
</p>
</div>
<ul className="topWrapper_select no-cursor" onMouseMove={() => this.onMouseMove(item.id)} onMouseOut={() => this.onMouseOut()} >
<li>{this.set_issue_tags(item.issue_tags)}</li>
<li>
{
item.author_name ?
<Link to={`/users/${item.author_login}`} className="show-user-link">
{item.author_name}
</Link>
: "--"
}
</li>
<li>
{
item.assign_user_name ?
<Link to={`/users/${item.assign_user_login}`} className="show-user-link">
{item.assign_user_name}
</Link>
: "--"
}
</li>
<li>{item.tracker || "--"}</li>
{ !mile ?<li>{item.version || "--"}</li>:""}
<li>{item.issue_status || "--"}</li>
<li style={{color:`${item.done_ratio === "100%"?"#28BD6C":"#F73030"}`}}>{item.done_ratio || "--"}</li>
<li>
<div className="milepostleft">
<Link to={`/projects/${projectsId}/orders/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
{
current_user && current_user.login ?
<div style={{ display: this.state.orderid === item.id && this.state.isdisplay ? 'flex' : 'none' }}>
<div className="mr8 ml8 color-grey-9">
<Link to={`/projects/${projectsId}/orders/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
</div>
<div className="color-grey-9">
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(item.id)}>
<i className="iconfont icon-yiguanbi1 font-14"></i>
</Popconfirm>
</div>
</div>
: ""
}
</div>
</li>
</ul>
</div>
)
}
}

View File

@ -5,6 +5,46 @@ import NoneData from '../Nodata';
import { SketchPicker } from 'react-color'
import reactCSS from 'reactcss'
import axios from 'axios';
const styles = reactCSS({
'default': {
color: {
width: '20px',
height: '20px',
borderRadius: '2px',
background: `rgba(${this.state.color.r}, ${this.state.color.g}, ${this.state.color.b}, ${this.state.color.a})`,
},
swatch: {
padding: '5px',
background: '#fff',
borderRadius: '1px',
width: '100px',
marginTop: '5px',
height: '28px',
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
display: 'flex',
cursor: 'pointer',
},
popover: {
position: 'absolute',
zIndex: '2',
},
cover: {
position: 'fixed',
top: '0px',
right: '0px',
bottom: '0px',
left: '0px',
},
modalcolor: {
width: '20px',
height: '20px',
borderRadius: '2px',
background: this.state.newcolor,
}
},
});
class Tags extends Component {
constructor(props) {
super(props);
@ -210,120 +250,18 @@ class Tags extends Component {
id: arr.id
});
};
menu =()=> (
<Menu onClick={this.arrayList}>
<Menu.Item key={'created_at'} value="desc">按创建时间降序排序</Menu.Item>
<Menu.Item key={'created_at'} value="asc">按创建时间升序排序</Menu.Item>
<Menu.Item key={'issues_count'} value="desc">按issue个数降序排序</Menu.Item>
<Menu.Item key={'issues_count'} value="asc">按issue个数升序排序</Menu.Item>
</Menu>
)
render() {
const { data, limit, page } = this.state;
const { getFieldDecorator } = this.props.form;
const menu = (
<Menu onClick={this.arrayList}>
<Menu.Item key={'created_at'} value="desc">按创建时间降序排序</Menu.Item>
<Menu.Item key={'created_at'} value="asc">按创建时间升序排序</Menu.Item>
<Menu.Item key={'issues_count'} value="desc">按issue个数降序排序</Menu.Item>
<Menu.Item key={'issues_count'} value="asc">按issue个数升序排序</Menu.Item>
</Menu>
)
const styles = reactCSS({
'default': {
color: {
width: '20px',
height: '20px',
borderRadius: '2px',
background: `rgba(${this.state.color.r}, ${this.state.color.g}, ${this.state.color.b}, ${this.state.color.a})`,
},
swatch: {
padding: '5px',
background: '#fff',
borderRadius: '1px',
width: '100px',
marginTop: '5px',
height: '28px',
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
display: 'flex',
cursor: 'pointer',
},
popover: {
position: 'absolute',
zIndex: '2',
},
cover: {
position: 'fixed',
top: '0px',
right: '0px',
bottom: '0px',
left: '0px',
},
modalcolor: {
width: '20px',
height: '20px',
borderRadius: '2px',
background: this.state.newcolor,
}
},
});
const Paginations = (
<React.Fragment>
{
data && data.issue_tags_count > limit ?
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={data && data.issue_tags_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
</React.Fragment>
)
const renderList = () => {
if (data && data.issue_tags && data.issue_tags.length > 0) {
return (
<div>
<div className="topWrapper">
<span>{data && data.issue_tags_count}个标签</span>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={menu} trigger={['click']} placement="bottomCenter">
<span>标签<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
</ul>
</div>
<div className="tagList">
{
data.issue_tags.map((item, key) => {
return (
<div key={key}>
<span className="width20 mr10">
<span style={{ backgroundColor: `${item.color}` }} className="tagColor"></span>
{item.name}
</span>
<span className="hide-1 width50 mr10">{item.description}</span>
<span className="width15 mr10">{item.issues_count}个开启的任务</span>
{
data && data.user_admin_or_member ?
<div className="width15 text-right">
<a onClick={() => this.editshow(item)} className="topWrapper_btn fr" >编辑</a>
<Popconfirm placement="bottom" title={'删除标签会将其从所有引用中删除。继续?'} okText="是" cancelText="否" onConfirm={() => this.deletetag(item.id)}>
<a className="a_btn delete_btn fr" >删除</a>
</Popconfirm>
</div>
: ''
}
</div>
)
})
}
</div>
</div>
)
} else {
return (
<NoneData _html="暂时还没有相关数据哦!" />
)
}
}
return (
<div className="main">
<div>
@ -363,7 +301,6 @@ class Tags extends Component {
)}
</Form.Item>
<div>
<div style={styles.swatch} onClick={this.handleClick}>
<div style={styles.color}>
@ -383,8 +320,56 @@ class Tags extends Component {
</div>
</Form>
</div>
{renderList()}
{Paginations}
{
data && data.issue_tags && data.issue_tags.length > 0 ?
<div>
<div className="topWrapper">
<span>{data && data.issue_tags_count}个标签</span>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.menu()} trigger={['click']} placement="bottomCenter">
<span>标签<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
</ul>
</div>
<div className="tagList">
{
data.issue_tags.map((item, key) => {
return (
<div key={key}>
<span className="width20 mr10">
<span style={{ backgroundColor: `${item.color}` }} className="tagColor"></span>
{item.name}
</span>
<span className="hide-1 width50 mr10">{item.description}</span>
<span className="width15 mr10">{item.issues_count}个开启的任务</span>
{
data && data.user_admin_or_member ?
<div className="width15 text-right">
<a onClick={() => this.editshow(item)} className="topWrapper_btn fr" >编辑</a>
<Popconfirm placement="bottom" title={'删除标签会将其从所有引用中删除。继续?'} okText="是" cancelText="否" onConfirm={() => this.deletetag(item.id)}>
<a className="a_btn delete_btn fr" >删除</a>
</Popconfirm>
</div>
: ''
}
</div>
)
})
}
</div>
</div>
:
<NoneData _html="暂时还没有相关数据哦!" />
}
{
data && data.issue_tags_count > limit ?
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={data && data.issue_tags_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:""
}
</div>
<Modal
title="编辑标签"

View File

@ -1,17 +1,11 @@
import React, { Component } from "react";
import OrderItem from './order_form'
import OrderForm from './order_form'
class UpdateDetail extends Component {
constructor(props) {
super(props);
}
render() {
return (
<OrderItem form_type="edit" {...this.props}></OrderItem>
<OrderForm form_type="edit" {...this.props}></OrderForm>
)
}
}
export default UpdateDetail;

View File

@ -58,9 +58,6 @@ class UpdateMilepost extends Component {
}).catch((error) => {
console.log(error);
})
}
submit = () => {

View File

@ -81,7 +81,6 @@ class NewMilepost extends Component {
render() {
const { getFieldDecorator } = this.props.form;
const { projectsId } = this.props.match.params;
const { isSpin } = this.state
return (
<div className="main">
@ -208,7 +207,6 @@ class NewMilepost extends Component {
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" >创建里程碑</a>
</Spin>
</div>
</Form>
</div>

View File

@ -46,9 +46,9 @@ class order extends Component {
status_ids: "状态",
done_ratios: "完成度",
paix: "排序",
update_author_ids:"更换负责人",
update_fixed_version_ids:'更换里程碑',
update_status_ids:"修改状态",
update_author_ids: "更换负责人",
update_fixed_version_ids: '更换里程碑',
update_status_ids: "修改状态",
begin: '',
end: '',
checkedValue: [],
@ -65,9 +65,9 @@ class order extends Component {
order_name: undefined,
order_type: undefined,
search: undefined,
update_author_id:undefined,
update_fixed_version_id:undefined,
update_status_id:undefined,
update_author_id: undefined,
update_fixed_version_id: undefined,
update_status_id: undefined,
page: 1,
limit: 15,
},
@ -100,7 +100,7 @@ class order extends Component {
};
// 获取列表数据
getIssueList = (status_type , begin, end) => {
getIssueList = (status_type, begin, end) => {
this.setState({
isSpin: true
})
@ -169,7 +169,7 @@ class order extends Component {
this.getIssueList(status_type);
};
getOption = (e, id, name,toGet) => {
getOption = (e, id, name, toGet) => {
const { current_user } = this.props;
let option_id = e.key === "all" ? undefined : e.key;
@ -182,26 +182,26 @@ class order extends Component {
if (current_user) {
author_id = (select_params.author_id && select_params.author_id === current_user.user_id) ? current_user.user_id : undefined;
assigned_to_id = (select_params.assigned_to_id && select_params.assigned_to_id === current_user.user_id) ? current_user.user_id : undefined;
}
this.setState({
[`${id}s`] : name,
[`${id}s`]: name,
select_params,
author_id,
assigned_to_id
});
if(!toGet){
if (!toGet) {
const { status_type } = this.state;
this.getIssueList(status_type);
}
};
renderMenu = (array, name, id,toGet) => {
renderMenu = (array, name, id, toGet) => {
return (
<Menu>
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name,toGet)}>
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name, toGet)}>
{name}
</Menu.Item>
{array &&
@ -210,7 +210,7 @@ class order extends Component {
return (
<Menu.Item
key={item.id}
onClick={(e) => this.getOption(e, id, item.name,toGet)}
onClick={(e) => this.getOption(e, id, item.name, toGet)}
>
{item.name}
</Menu.Item>
@ -351,14 +351,14 @@ class order extends Component {
this.setState({
begin: value
})
this.getIssueList(status_type,value, this.state.end);
this.getIssueList(status_type, value, this.state.end);
}
changeEndTime = (data, value) => {
const { status_type } = this.state;
this.setState({
end: value
})
this.getIssueList(status_type,this.state.begin, value);
this.getIssueList(status_type, this.state.begin, value);
}
// 选择列表里面的checkbox
@ -371,15 +371,15 @@ class order extends Component {
all: allValue && value && value.length === allValue.length,
})
// 不勾选数据时清除右上角选择的项
if(value.length === 0){
if (value.length === 0) {
this.setState({
update_author_ids:"更换负责人",
update_fixed_version_ids:"更换里程碑",
update_status_ids:"修改状态",
select_params:{
update_author_id:undefined,
update_fixed_version_id:undefined,
update_status_id:undefined
update_author_ids: "更换负责人",
update_fixed_version_ids: "更换里程碑",
update_status_ids: "修改状态",
select_params: {
update_author_id: undefined,
update_fixed_version_id: undefined,
update_status_id: undefined
}
})
}
@ -402,79 +402,94 @@ class order extends Component {
}
// 批量修改
updateIssues=()=>{
const {checkedValue , select_params} = this.state;
updateIssues = () => {
const { checkedValue, select_params } = this.state;
const { projectsId } = this.props.match.params;
if(!select_params.update_author_id && !select_params.update_fixed_version_id &&!select_params.update_status_id ){
if (!select_params.update_author_id && !select_params.update_fixed_version_id && !select_params.update_status_id) {
this.resetSelectParams();
return;
}
this.setState({
isSpin:true
isSpin: true
})
const url = `/projects/${projectsId}/issues/series_update.json`;
axios.post(url,{
ids:checkedValue,
assigned_to_id:select_params.update_author_id,
fixed_version_id:select_params.update_fixed_version_id,
status_id:select_params.update_status_id
}).then(result=>{
if(result){
axios.post(url, {
ids: checkedValue,
assigned_to_id: select_params.update_author_id,
fixed_version_id: select_params.update_fixed_version_id,
status_id: select_params.update_status_id
}).then(result => {
if (result) {
this.props.showNotification("修改成功!");
this.successFunc();
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
successFunc=()=>{
successFunc = () => {
this.resetSelectParams();
const { status_type } = this.state;
this.getIssueList(status_type);
}
resetSelectParams=()=>{
resetSelectParams = () => {
let select_params = this.state.select_params;
select_params.update_author_id = undefined;
select_params.update_fixed_version_id = undefined;
select_params.update_status_id = undefined;
this.setState({
all:false,
checkedValue:[],
update_author_ids:"更换负责人",
update_fixed_version_ids:"更换里程碑",
update_status_ids:"修改状态",
all: false,
checkedValue: [],
update_author_ids: "更换负责人",
update_fixed_version_ids: "更换里程碑",
update_status_ids: "修改状态",
select_params
})
}
// 批量删除
deleteIssues=()=>{
deleteIssues = () => {
this.props.confirm({
content: "是否确认删除所有选中的任务?",
onOk:()=>{
onOk: () => {
this.setState({
isSpin:true
isSpin: true
})
const { checkedValue } = this.state;
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/clean.json`;
axios.post(url,{
ids:checkedValue
}).then(result=>{
if(result){
axios.post(url, {
ids: checkedValue
}).then(result => {
if (result) {
this.props.showNotification("删除成功!");
this.successFunc();
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
})
}
menu =()=> (
<Menu onClick={(e) => this.getMenu(e)}>
<Menu.Item key={"created_on-desc"} value="desc">
最新创建
</Menu.Item>
<Menu.Item key={"created_on-asc"} value="asc">
最早创建
</Menu.Item>
<Menu.Item key={"updated_on-desc"} value="desc">
最新更新
</Menu.Item>
<Menu.Item key={"updated_on-asc"} value="asc">
最早更新
</Menu.Item>
</Menu>
);
render() {
const { current_user } = this.props;
@ -490,40 +505,7 @@ class order extends Component {
select_params,
begin, end, checkedValue, all
} = this.state;
const menu = (
<Menu onClick={(e) => this.getMenu(e)}>
<Menu.Item key={"created_on-desc"} value="desc">
最新创建
</Menu.Item>
<Menu.Item key={"created_on-asc"} value="asc">
最早创建
</Menu.Item>
<Menu.Item key={"updated_on-desc"} value="desc">
最新更新
</Menu.Item>
<Menu.Item key={"updated_on-asc"} value="asc">
最早更新
</Menu.Item>
</Menu>
);
const Paginations = (
<React.Fragment>
{search_count > select_params.limit ? (
<div className="mt30 mb50 edu-txt-center">
<Pagination
simple
defaultCurrent={select_params.page}
total={search_count}
pageSize={select_params.limit}
onChange={this.ChangePage}
></Pagination>
</div>
) : (
""
)}
</React.Fragment>
);
return (
<div className="main">
<div className="topWrapper" style={{ paddingTop: "10px" }}>
@ -577,7 +559,7 @@ class order extends Component {
{
current_user && current_user.login ?
<Checkbox value="0" style={{ lineHeight: "50px", marginRight: "15px" }} checked={all} onChange={this.changeAll}></Checkbox>
:""
: ""
}
{checkedValue && checkedValue.length > 0 ?
<span style={{ lineHeight: "50px" }}>选中{checkedValue.length}个issue</span>
@ -616,199 +598,199 @@ class order extends Component {
}
</div>
{
checkedValue && checkedValue.length>0 ?
<ul className="topWrapper_select">
<li className="mr20">
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"更换负责人",
"update_author_id",true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_author_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li className="mr20">
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_version,
"更换里程碑",
"update_fixed_version_id",true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_fixed_version_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li className="mr20">
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_status,
"修改状态",
"update_status_id",true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_status_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<a onClick={this.updateIssues} className="updateBtn blue mr20">确定</a>
<a onClick={this.deleteIssues} className="updateBtn red mr20">删除</a>
</ul>
:
<ul className="topWrapper_select">
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_tag,
"标签",
"issue_tag_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.issue_tag_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"发布人",
"author_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.author_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"负责人",
"assigned_to_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.assigned_to_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.tracker,
"类型",
"tracker_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.tracker_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_version,
"里程碑",
"fixed_version_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.fixed_version_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_status,
"状态",
"status_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.status_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.done_ratio,
"完成度",
"done_ratio"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.done_ratios}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={menu}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.paix}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
</ul>
checkedValue && checkedValue.length > 0 ?
<ul className="topWrapper_select">
<li className="mr20">
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"更换负责人",
"update_author_id", true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_author_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li className="mr20">
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_version,
"更换里程碑",
"update_fixed_version_id", true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_fixed_version_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li className="mr20">
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_status,
"修改状态",
"update_status_id", true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_status_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<a onClick={this.updateIssues} className="updateBtn blue mr20">确定</a>
<a onClick={this.deleteIssues} className="updateBtn red mr20">删除</a>
</ul>
:
<ul className="topWrapper_select">
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_tag,
"标签",
"issue_tag_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.issue_tag_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"发布人",
"author_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.author_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"负责人",
"assigned_to_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.assigned_to_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.tracker,
"类型",
"tracker_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.tracker_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_version,
"里程碑",
"fixed_version_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.fixed_version_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_status,
"状态",
"status_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.status_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.done_ratio,
"完成度",
"done_ratio"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.done_ratios}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.menu()}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.paix}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
</ul>
}
</div>
{search_count === 0 ? (
<NoneData _html="暂时还没有相关数据哦!" />
@ -820,7 +802,7 @@ class order extends Component {
<OrderItem
key={key}
item={item}
checkbox={current_user ? <Checkbox value={item.id} key={item.id} style={{ margin: '4px 15px 0px 0px' }}></Checkbox>:""}
checkbox={current_user ? <Checkbox value={item.id} key={item.id} style={{ margin: '4px 15px 0px 0px' }}></Checkbox> : ""}
search_count={search_count}
page={select_params.page}
limit={select_params.limit}
@ -833,7 +815,20 @@ class order extends Component {
</Checkbox.Group>
</div>
)}
{Paginations}
{
search_count > select_params.limit ?
<div className="mt30 mb50 edu-txt-center">
<Pagination
simple
defaultCurrent={select_params.page}
total={search_count}
pageSize={select_params.limit}
onChange={this.ChangePage}
></Pagination>
</div>
:
""
}
</Spin>
</div>
);

View File

@ -51,7 +51,6 @@ class order_form extends Component {
get_detail = () => {
const { form_type } = this.props;
if (form_type === "new") {
this.InitData();
this.getSelectList();
} else {
this.state.isSpin = true;
@ -96,8 +95,7 @@ class order_form extends Component {
start_date: result.data.start_date,
due_date: result.data.due_date,
subject: result.data.subject,
},
() => this.InitData()
}
);
}
})

View File

@ -1,11 +1,8 @@
import React, { Component } from "react";
import axios from "axios";
//
import { Spin, Pagination } from "antd";
import "./list.css";
import NoneData from "../Nodata";
// import FocusButton from "./focus_button";
import UserList from "./user_list"
class CommonUsers extends Component {
constructor(props) {
@ -63,10 +60,10 @@ class CommonUsers extends Component {
const { limit } = this.state;
this.getUsersList(page, limit);
};
render() {
const { users, count, page, limit, isSpin, type_title } = this.state;
const Paginations = (
Paginations =() => {
const { count, page, limit } = this.state;
return(
<React.Fragment>
{count > limit ? (
<div className="mt50 mb30 edu-txt-center">
@ -82,7 +79,12 @@ class CommonUsers extends Component {
""
)}
</React.Fragment>
);
)
};
render() {
const { users, count , isSpin, type_title } = this.state;
return (
<div className="pbt15">
<div className="main background-f minH-670">
@ -97,7 +99,7 @@ class CommonUsers extends Component {
)}
</div>
</Spin>
{Paginations}
{this.Paginations()}
</div>
</div>
</div>

View File

@ -52,14 +52,14 @@ class FocusButton extends Component {
}
})
.catch((error) => {
this.setState({isSpin: false})
this.setState({ isSpin: false })
console.log(error);
});
};
render() {
const { is_watch, isSpin,fontClass,starText,is_block } = this.state;
const { is_watch, isSpin, fontClass, starText, is_block } = this.state;
return (
<Button type={is_watch ? "default" : "primary"} ghost={!is_watch} block={is_block} loading={isSpin} onClick={() => this.focusFunc(is_watch)}>
{is_watch ? (
@ -68,11 +68,11 @@ class FocusButton extends Component {
<span className={fontClass}>已关注</span>
</span>
) : (
<span className="">
<i className="iconfont icon-kongxing font-15"></i>
<span className={fontClass}>{starText}</span>
</span>
)}
<span className="">
<i className="iconfont icon-kongxing font-15"></i>
<span className={fontClass}>{starText}</span>
</span>
)}
</Button>
);
}

View File

@ -5,7 +5,6 @@ import { getImageUrl } from "educoder";
import { Spin, Pagination } from "antd";
import "./list.css";
import NoneData from "../Nodata";
// import FocusButton from "./focus_button";
class ForkUsers extends Component {
constructor(props) {
super(props);
@ -60,65 +59,64 @@ class ForkUsers extends Component {
this.getUsersList(page, limit);
};
render() {
const { users, count, page, limit, isSpin } = this.state;
const Paginations = (
<React.Fragment>
{count > limit ? (
<div className="mt50 mb30 edu-txt-center">
<Pagination
simple
defaultCurrent={page}
total={count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
) : (
""
)}
</React.Fragment>
);
const renderList = () => {
if (users && users.length > 0) {
return users.map((item, key) => {
return (
<div className="w-25 pull-left" key={key}>
<div className="pbt25 grid-item mlr10 border-b-line">
Paginations =()=> {
const { count, page, limit } = this.state;
if(count > limit){
return(
<div className="mt50 mb30 edu-txt-center">
<Pagination
simple
defaultCurrent={page}
total={count}
pageSize={limit}
onChange={this.ChangePage}
></Pagination>
</div>
)
}
};
renderList = (users) => {
if (users && users.length > 0) {
return users.map((item, key) => {
return (
<div className="w-25 pull-left" key={key}>
<div className="pbt25 grid-item mlr10 border-b-line">
<div>
<Link
to={`/users/${item.login}`}
className="show-user-link"
>
<img
className="avatar-60"
src={getImageUrl(`images/${item.image_url}`)}
alt=""
/>
</Link>
</div>
<div className="ml12">
<div>
<Link
to={`/users/${item.login}`}
className="show-user-link"
to={`/projects/${item.id}`}
className="font-16 text-primary hide-1 task-hide max-w-200"
>
<img
className="avatar-60"
src={getImageUrl(`images/${item.image_url}`)}
alt=""
/>
{item.name}
</Link>
</div>
<div className="ml12">
<div>
<Link
to={`/projects/${item.id}`}
className="font-16 text-primary hide-1 task-hide max-w-200"
>
{item.name}
</Link>
</div>
<div className="font-12 text-gray grid-item pb5">
<i className="iconfont icon-shijian user-join-time"></i>
<span className="ml4">fork时间{item.format_time}</span>
</div>
{/* <FocusButton is_watch={item.is_watch} id={item.login} /> */}
<div className="font-12 text-gray grid-item pb5">
<i className="iconfont icon-shijian user-join-time"></i>
<span className="ml4">fork时间{item.format_time}</span>
</div>
</div>
</div>
);
});
}
};
</div>
);
});
}
}
render() {
const { users, count, isSpin } = this.state;
return (
<div className="pbt15">
<div className="main background-f minH-670">
@ -129,11 +127,11 @@ class ForkUsers extends Component {
{count === 0 ? (
<NoneData _html="暂时还没有相关数据哦!" />
) : (
renderList()
this.renderList(users)
)}
</div>
</Spin>
{Paginations}
{this.Paginations()}
</div>
</div>
</div>

View File

@ -24,7 +24,6 @@ class PraiseUsers extends Component {
<div >
{projectId && <CommonUsers user_type="praise_users" type_title="点赞列表" project_id={projectId} current_user={this.props.current_user} />}
</div>
);
}
}

View File

@ -4,58 +4,56 @@ import FocusButton from "./focus_button";
import { Button } from "antd";
import "./list.css";
class UserList extends Component {
constructor(props) {
super(props);
}
render() {
const { users, userClass, current_user } = this.props;
const renderList = () => {
if (users && users.length > 0) {
return users.map((item, key) => {
return (
<div className={`pull-left ${userClass}`} key={key}>
<div className="pbt25 grid-item mlr10 border-b-line">
renderList = (users, userClass, current_user) => {
if (users && users.length > 0) {
return users.map((item, key) => {
return (
<div className={`pull-left ${userClass}`} key={key}>
<div className="pbt25 grid-item mlr10 border-b-line">
<div>
<a
href={`/users/${item.login}`}
className="show-user-link"
>
<img
className="avatar-60"
src={getImageUrl(`images/${item.image_url}`)}
alt=""
/>
</a>
</div>
<div className="ml12">
<div>
<a
href={`/users/${item.login}`}
className="show-user-link"
className="font-16 text-primary hide-1 task-hide max-w-200"
>
<img
className="avatar-60"
src={getImageUrl(`images/${item.image_url}`)}
alt=""
/>
{item.name}
</a>
</div>
<div className="ml12">
<div>
<a
href={`/users/${item.login}`}
className="font-16 text-primary hide-1 task-hide max-w-200"
>
{item.name}
</a>
</div>
<div className="font-12 text-gray grid-item pb5">
<i className="iconfont icon-shijian user-join-time"></i>
<span className="ml4">加入时间{item.format_time}</span>
</div>
{
current_user && current_user.login === item.login ?
<Button type="default">当前用户</Button>
:
<FocusButton is_watch={item.is_watch} id={item.login} />
}
<div className="font-12 text-gray grid-item pb5">
<i className="iconfont icon-shijian user-join-time"></i>
<span className="ml4">加入时间{item.format_time}</span>
</div>
{
current_user && current_user.login === item.login ?
<Button type="default">当前用户</Button>
:
<FocusButton is_watch={item.is_watch} id={item.login} />
}
</div>
</div>
);
});
}
};
</div>
);
});
}
}
render() {
const { users, userClass, current_user } = this.props;
return (
renderList()
this.renderList(users, userClass, current_user)
);
}
}

View File

@ -20,12 +20,10 @@ class WatchUsers extends Component {
render() {
const { projectId } = this.state;
console.log("watcher_users", this.props.current_user)
return (
<div>
{projectId && <CommonUsers user_type="watch_users" type_title="关注列表" project_id={projectId} current_user={this.props.current_user} />}
</div>
);
}
}

View File

@ -55,55 +55,56 @@ class version extends Component {
})
}
renderList = (releases) => {
const { projectsId } = this.props.match.params;
if (releases && releases.length > 0) {
return (
<div>
{
releases.map((item, key) => {
return (
<div className="versionInfo" key={key}>
<span className="versionInfo_left">
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag yellow"}`}>{item.draft}</span>
<span className="mt10">{item.created_at}</span>
<span className="color-grey-8">
<i className="iconfont icon-biaoqian3 mr3 font-14"></i>
{item.tag_name}
</span>
</span>
<div className="versionInfo_right">
<span className="versionName">
<span className="task-hide">{item.name}</span>
<Link to={`/projects/${projectsId}/coders/version/${item.version_id}/update`} className="color-blue ml3 font-12">编辑</Link>
</span>
<span className="color-grey-3">
<i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>this.showBody(key,item.bodyshow)}></i>
{item.user_name}:<span className="color-grey-8">发布了这个版本并在发布后提交给{item.target_commitish}</span>
</span>
{
item.bodyshow && <p className="mt10">{item.body}</p>
}
<p className="mt10 pl3">
<a href={item.tarball_url} style={{color:"#4CC1DA"}} className="mr30"><i className="iconfont icon-TAR font-18 mr5"></i>TAR</a>
<a href={item.zipball_url} style={{color:"#28BD6C"}}><i className="iconfont icon-ZIP font-18 mr5"></i>ZIP</a>
</p>
</div>
</div>
)
})
}
</div>
)
} else {
return (
<NoneData _html="暂时还没有相关数据哦!" />
)
}
}
render() {
const { projectsId } = this.props.match.params;
const { data , releases } = this.state
const renderList = () => {
if (releases && releases.length > 0) {
return (
<div>
{
releases.map((item, key) => {
return (
<div className="versionInfo" key={key}>
<span className="versionInfo_left">
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag yellow"}`}>{item.draft}</span>
<span className="mt10">{item.created_at}</span>
<span className="color-grey-8">
<i className="iconfont icon-biaoqian3 mr3 font-14"></i>
{item.tag_name}
</span>
</span>
<div className="versionInfo_right">
<span className="versionName">
<span className="task-hide">{item.name}</span>
<Link to={`/projects/${projectsId}/coders/version/${item.version_id}/update`} className="color-blue ml3 font-12">编辑</Link>
</span>
<span className="color-grey-3">
<i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>this.showBody(key,item.bodyshow)}></i>
{item.user_name}:<span className="color-grey-8">发布了这个版本并在发布后提交给{item.target_commitish}</span>
</span>
{
item.bodyshow && <p className="mt10">{item.body}</p>
}
<p className="mt10 pl3">
{/* <span className="commitKey mr20">{item.commit_id}</span> */}
<a href={item.tarball_url} style={{color:"#4CC1DA"}} className="mr30"><i className="iconfont icon-TAR font-18 mr5"></i>TAR</a>
<a href={item.zipball_url} style={{color:"#28BD6C"}}><i className="iconfont icon-ZIP font-18 mr5"></i>ZIP</a>
</p>
</div>
</div>
)
})
}
</div>
)
} else {
return (
<NoneData _html="暂时还没有相关数据哦!" />
)
}
}
return (
<div className="main">
@ -116,7 +117,7 @@ class version extends Component {
}
</div>
<div className="releasesVersion">
{renderList()}
{this.renderList(releases)}
</div>
</div>

View File

@ -99,147 +99,147 @@ class InfosUser extends Component {
})
this.get_projects(is_public);
}
menu =()=> (
<Menu onClick={this.ChangeSoryBy}>
<Menu.Item key="updated_on">更新时间排序</Menu.Item>
<Menu.Item key="created_on">创建时间排序</Menu.Item>
<Menu.Item key="forked_count">fork数据排序</Menu.Item>
<Menu.Item key="praises_count">点赞数量排序</Menu.Item>
</Menu>
);
newItem =()=> (
<Menu>
<Menu.Item key="created_mirror">
<Link to={`/projects/mirror/new`}>新建镜像项目</Link>
</Menu.Item>
<Menu.Item key="created_deposit">
<Link to={`/projects/deposit/new`}>新建托管项目</Link>
</Menu.Item>
</Menu>
);
category_button=(category)=>{
const { current_user, user } = this.props;
const button_lists =
user && current_user && user.login === current_user.login
? [
{ type: undefined, name: "所有" },
{ type: "manage", name: "我创建的" },
{ type: "join", name: "我参与的" },
{ type: "watched", name: "我关注的" },
{ type: "forked", name: "我Fork的" },
]
:
[
{ type: undefined, name: "所有" },
{ type: "manage", name: "TA创建的" },
{ type: "join", name: "TA参与的" },
{ type: "watched", name: "TA关注的" },
{ type: "forked", name: "TAFork的" },
];
let list = button_lists.map((item, key) => {
return (
<span key={key} className="pr15">
<Button
type={
(category && category === item.type) || (!category && !item.type)
? "primary"
: "default"
}
ghost={
(category && category === item.type) || (!category && !item.type)
}
value={item.type}
onClick={this.changeCategory}
>
{item.name}
</Button>
</span>
);
})
return list;
}
render() {
const { current_user, user } = this.props;
const { category , is_public } = this.state;
const menu = (
<Menu onClick={this.ChangeSoryBy}>
<Menu.Item key="updated_on">更新时间排序</Menu.Item>
<Menu.Item key="created_on">创建时间排序</Menu.Item>
<Menu.Item key="forked_count">fork数据排序</Menu.Item>
<Menu.Item key="praises_count">点赞数量排序</Menu.Item>
</Menu>
);
const newItem = (
<Menu>
<Menu.Item key="created_mirror">
<Link to={`/projects/mirror/new`}>新建镜像项目</Link>
</Menu.Item>
<Menu.Item key="created_deposit">
<Link to={`/projects/deposit/new`}>新建托管项目</Link>
</Menu.Item>
</Menu>
);
const button_lists =
user && current_user && user.login === current_user.login
? [
{ type: undefined, name: "所有" },
{ type: "manage", name: "我创建的" },
{ type: "join", name: "我参与的" },
{ type: "watched", name: "我关注的" },
{ type: "forked", name: "我Fork的" },
// { type: "public", name: "公开的" },
// { type: "private", name: "私有的" },
]
: [
{ type: undefined, name: "所有" },
{ type: "manage", name: "TA创建的" },
{ type: "join", name: "TA参与的" },
{ type: "watched", name: "TA关注的" },
{ type: "forked", name: "TAFork的" },
// { type: "public", name: "公开的" },
];
const category_button = button_lists.map((item, key) => {
return (
<span key={key} className="pr15">
<Button
type={
(category && category === item.type) || (!category && !item.type)
? "primary"
: "default"
}
ghost={
(category && category === item.type) || (!category && !item.type)
}
value={item.type}
onClick={this.changeCategory}
>
{item.name}
</Button>
</span>
);
});
const { projectsList, isSpin, total, search, limit, page } = this.state;
const pagination =
total && total > limit ? (
<div className="edu-txt-center pt30 mb30">
<Pagination
simple
defaultCurrent={page}
total={total}
pageSize={limit}
onChange={this.changePage}
></Pagination>
</div>
) : (
""
);
return (
<Spin spinning={isSpin}>
<div className="list-r-operation">
<Search
placeholder="输入项目名称关键字进行搜索"
enterButton="搜索"
size="large"
onSearch={this.get_projects}
className="list-r-Search"
value={search}
onChange={this.changeSearchValue}
/>
<div>
{current_user && user && current_user.login === user.login && (
<Popover
content={newItem}
trigger={["click"]}
placement="bottom"
className="mr50"
>
<a className="ant-dropdown-link">
<span className="color-blue font-16">
<img src={img_new} alt="" width="13px" /> 新建
</span>
</a>
</Popover>
)}
<Popover content={menu} trigger={["click"]} placement="bottom">
<Search
placeholder="输入项目名称关键字进行搜索"
enterButton="搜索"
size="large"
onSearch={this.get_projects}
className="list-r-Search"
value={search}
onChange={this.changeSearchValue}
/>
<div>
{current_user && user && current_user.login === user.login && (
<Popover
content={this.newItem()}
trigger={["click"]}
placement="bottom"
className="mr50"
>
<a className="ant-dropdown-link">
<span className="color-blue font-16">
排序 <img src={img_array} alt="" width="10px" />
<img src={img_new} alt="" width="13px" /> 新建
</span>
</a>
</Popover>
</div>
</div>
<div className="infosType">
<div>{category_button}</div>
{
user && current_user && user.login === current_user.login ?
<p className="infoStatus">
<span className={is_public === "public" ? "active" : "" } onClick={()=>this.changeStatus("public")}>公有</span>
<span className={is_public === "private" ? "active" : "" } onClick={()=>this.changeStatus("private")}>私有</span>
</p>
:""
}
</div>
)}
{projectsList && projectsList.length > 0 ? (
<div>
<ListItem
{...this.props}
{...this.state}
projects={projectsList}
></ListItem>
<Popover content={this.menu()} trigger={["click"]} placement="bottom">
<a className="ant-dropdown-link">
<span className="color-blue font-16">
排序 <img src={img_array} alt="" width="10px" />
</span>
</a>
</Popover>
</div>
</div>
<div className="infosType">
<div>{this.category_button(category)}</div>
{
user && current_user && user.login === current_user.login ?
<p className="infoStatus">
<span className={is_public === "public" ? "active" : "" } onClick={()=>this.changeStatus("public")}>公有</span>
<span className={is_public === "private" ? "active" : "" } onClick={()=>this.changeStatus("private")}>私有</span>
</p>
:""
}
</div>
{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>
) : (
<Nodata _html={`暂时没有项目`} />
)}
{pagination}
""
)
}
</Spin>
);
}

View File

@ -1,20 +1,13 @@
import React, { Component } from "react";
// import { Input, Spin, Pagination } from "antd";
import CommonLists from "./common_lists"
class FanUsers extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
const {user, current_user} = this.props
return (
<div>
{user && user.login && <CommonLists userType="fan_users" login={user.login} current_user={current_user} />}
</div>
{user && user.login && <CommonLists userType="fan_users" login={user.login} current_user={current_user} />}
</div>
);
}
}

View File

@ -1,11 +1,6 @@
import React, { Component } from "react";
import Nodata from "../Nodata";
class UndoEvents extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (

View File

@ -1,13 +1,6 @@
import React, { Component } from "react";
import CommonLists from "./common_lists"
class WatcherUsers extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
const {user, current_user} = this.props
return (