diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index dc60f4499..4884a3c33 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -175,6 +175,7 @@ class IssuesController < ApplicationController unless attachment.blank? attachment.container = @issue attachment.author_id = current_user.id + attachment.description = "" attachment.save end end @@ -244,6 +245,7 @@ class IssuesController < ApplicationController unless attachment.blank? attachment.container = @issue attachment.author_id = current_user.id + attachment.description = "" attachment.save end end diff --git a/public/react/src/forge/Order/Nav.js b/public/react/src/forge/Order/Nav.js index 6afd7043e..af7072eef 100644 --- a/public/react/src/forge/Order/Nav.js +++ b/public/react/src/forge/Order/Nav.js @@ -6,7 +6,7 @@ class Nav extends Component{ return(

标签 - 里程 + 里程碑

) } diff --git a/public/react/src/forge/Order/New.js b/public/react/src/forge/Order/New.js index 8ced05c0e..8f73e107d 100644 --- a/public/react/src/forge/Order/New.js +++ b/public/react/src/forge/Order/New.js @@ -75,7 +75,6 @@ class New extends Component{ if(!err){ const { projectsId } = this.props.match.params; const { fileList } = this.state; - const { current_user } = this.props; const url = `/projects/${projectsId}/issues.json`; axios.post(url,{ ...values, diff --git a/public/react/src/forge/Order/OrderItem.js b/public/react/src/forge/Order/OrderItem.js index e69de29bb..6538d633e 100644 --- a/public/react/src/forge/Order/OrderItem.js +++ b/public/react/src/forge/Order/OrderItem.js @@ -0,0 +1,46 @@ +import React , { Component } from 'react'; + + +class OrderItem extends Component{ + render(){ + const { issues , search_count , page , limit } = this.props; + const renderList =()=>{ + if(issues && issues.length > 0){ + return( + issues.map((item,key)=>{ + return( +
+
+

+ # {search_count - (key + (page-1) * limit)} + {item.name} +

+

+ {item.created_at} + { item.journals_count ? {item.journals_count} : "" } +

+
+ +
+ ) + }) + ) + } + } + return( +
+ {renderList()} +
+ ) + } +} + +export default OrderItem; \ No newline at end of file diff --git a/public/react/src/forge/Order/order.js b/public/react/src/forge/Order/order.js index 165c51198..d2e002916 100644 --- a/public/react/src/forge/Order/order.js +++ b/public/react/src/forge/Order/order.js @@ -1,19 +1,44 @@ import React , { Component } from "react"; import {Link} from 'react-router-dom'; -import { Input ,Dropdown , Menu , Icon } from 'antd'; +import { Input ,Dropdown , Menu , Icon , Pagination , Spin } from 'antd'; import './order.css'; +import NoneData from '../../modules/courses/coursesPublic/NoneData'; import Nav from './Nav'; +import OrderItem from './OrderItem'; + import axios from 'axios'; const Search = Input.Search; - +/** + * issue_chosen:下拉的筛选列表, + * data:列表接口返回的所有数据, + * issues:列表数组, + * isSpin:加载中, + * search:搜索关键字, + * author_id:发布者id, + * assigned_to_id:指派给。。。的id, + * limit:每页条数, + * page:当前页, + * search_count:列表总条数 + * issue_type:搜索条件 + */ class order extends Component{ constructor(props){ super(props); this.state={ - issue_chosen:undefined + issue_chosen:undefined, + data:undefined, + issues:undefined, + isSpin:false, + search:undefined, + author_id:undefined, + assigned_to_id:undefined, + limit:15, + page:1, + search_count:undefined, + issue_type:undefined } } @@ -37,43 +62,120 @@ class order extends Component{ }) } - getIssueList=()=>{ + // 获取列表数据 + getIssueList=(page,limit,search,author_id,assigned_to_id,issue_type)=>{ const { projectsId } = this.props.match.params; const url = `/projects/${projectsId}/issues.json`; axios.get(url,{ - params:{} + params:{ + page,limit,search,author_id,assigned_to_id,issue_type + } }).then((result)=>{ if(result){ - + this.setState({ + data:result.data, + issues:result.data.issues, + search_count:result.data.search_count, + isSpin:false + }) } }).catch((error)=>{ console.log(error); }) } - getOption=(e)=>{ - console.log(e); + getOption=(e,id)=>{ + this.setState({ + [id]:e.key + }) + const { page,limit,search,author_id,assigned_to_id } = this.state; + this.getIssueList(page,limit,search,author_id,assigned_to_id,e.key); } - renderMenu =(array,name)=>{ + + renderMenu =(array,name,id)=>{ return( - {name} + this.getOption(e,id)}>{name} { array && array.length > 0 && array.map((item,key)=>{ return( - {item.name} + this.getOption(e,id)}>{item.name} ) }) } ) } + + // 翻页 + ChangePage=(page)=>{ + this.setState({ + page, + isSpin:true + }) + const {limit,search} = this.state; + this.getIssueList(page,limit,search); + } + + // 搜索 + searchFunc=(value)=>{ + this.setState({ + search:value, + isSpin:true + }) + const {page,limit} = this.state; + this.getIssueList(page,limit,value); + } + + // 筛选:全部、指派给我、由我创建 + ChangeAssign=(type)=>{ + const { limit, search} = this.state; + this.setState({ + isSpin:true + }) + if(type){ + const { current_user } = this.props; + if(type===1){ + this.setState({ + page:1, + author_id:current_user.user_id, + assigned_to_id:undefined + }) + this.getIssueList(1,limit,search,current_user.user_id,undefined); + }else{ + this.setState({ + page:1, + author_id:undefined, + assigned_to_id:current_user.user_id + }) + this.getIssueList(1,limit,search,undefined,current_user.user_id); + } + }else{ + this.setState({ + page:1, + author_id:undefined, + assigned_to_id:undefined + }) + this.getIssueList(1,limit,search,undefined,undefined); + } + } + render(){ - const { issue_chosen } = this.state; + const { issue_chosen , issues , limit , page , search_count , data , assigned_to_id , author_id , isSpin } = this.state; const { projectsId } = this.props.match.params; + const Paginations = ( + + { + search_count > limit ? +
+ +
:"" + } +
+ ) return(
@@ -82,86 +184,73 @@ class order extends Component{

- 2个开启中 - 100个已关闭 + {data && data.open_count}个开启中 + {data && data.close_count}个已关闭

console.log(value)} + onSearch={this.searchFunc} style={{ width: 300 }} />
-
- - -
-
-
-
-

- #10 - forge重构:issue列表issue列表issue列表issue列表 -

-

- 1小时前创建 - 3 -

-
+ +
+
    +
  • this.ChangeAssign()}>全部
  • +
  • this.ChangeAssign(1)}>指派给我
  • +
  • this.ChangeAssign(2)}>由我创建
  • + {/*
  • @我的
  • */} +
    -
  • release
  • -
  • 普通
  • -
  • 缺陷
  • -
  • 猜猜
  • -
  • 猜猜猜
  • -
  • -
  • 0%
  • +
  • + + 标签 + +
  • +
  • + + 类型 + +
  • +
  • + + 分类 + +
  • +
  • + + 发布人 + +
  • +
  • + + 指派人 + +
  • +
  • + + 优先度 + +
  • +
  • + + 完成度 + +
-
+ { + search_count === 0 ? + + : + + } + { Paginations } + +
) } diff --git a/public/react/src/modules/courses/coursesPublic/NoneData.js b/public/react/src/modules/courses/coursesPublic/NoneData.js index e039fd0d0..c29070e74 100644 --- a/public/react/src/modules/courses/coursesPublic/NoneData.js +++ b/public/react/src/modules/courses/coursesPublic/NoneData.js @@ -1,10 +1,9 @@ import React, { Component } from 'react'; -import { getImageUrl , getUrl } from 'educoder'; +import { getUrl } from 'educoder'; class NoneData extends Component{ - constructor(props) { - super(props) - } + + render(){ const { style } = this.props; return(