|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import { SnackbarHOC } from 'educoder';
|
|
|
|
|
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
|
|
|
|
|
import {Tooltip,Pagination,Spin} from 'antd';
|
|
|
|
|
import {Tooltip, Pagination, Spin, Dropdown, Menu} from 'antd';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import NoneData from '../../courses/coursesPublic/NoneData'
|
|
|
|
|
import {getImageUrl} from 'educoder';
|
|
|
|
@ -16,7 +16,8 @@ class InfosProject extends Component{
|
|
|
|
|
status:undefined,
|
|
|
|
|
page:1,
|
|
|
|
|
per_page:16,
|
|
|
|
|
|
|
|
|
|
sort_by: "updated_on",
|
|
|
|
|
sort_direction: "desc",
|
|
|
|
|
totalCount:undefined,
|
|
|
|
|
data:undefined,
|
|
|
|
|
isSpin:false
|
|
|
|
@ -27,16 +28,18 @@ class InfosProject extends Component{
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
let{category,status,page}=this.state;
|
|
|
|
|
this.getCourses(category,status,page);
|
|
|
|
|
let {category, status, page, sort_by, sort_direction} = this.state;
|
|
|
|
|
this.getCourses(category, status, page, sort_by, sort_direction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCourses=(category,status,page)=>{
|
|
|
|
|
getCourses = (category, status, page, sort_by, sort_direction) => {
|
|
|
|
|
let url=`/users/${this.props.match.params.username}/projects.json`;
|
|
|
|
|
axios.get((url),{params:{
|
|
|
|
|
category,
|
|
|
|
|
status,
|
|
|
|
|
page,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
per_page:this.props.is_current && category && page ==1?17:16
|
|
|
|
|
}}).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
@ -49,6 +52,8 @@ class InfosProject extends Component{
|
|
|
|
|
this.setState({
|
|
|
|
|
totalCount:result.data.count,
|
|
|
|
|
data:result.data,
|
|
|
|
|
sort_by: sort_by,
|
|
|
|
|
sort_direction: sort_direction,
|
|
|
|
|
isSpin:false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -56,6 +61,9 @@ class InfosProject extends Component{
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpin: false
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -66,8 +74,9 @@ class InfosProject extends Component{
|
|
|
|
|
page:1,
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
let{status}=this.state;
|
|
|
|
|
this.getCourses(cate,status,1);
|
|
|
|
|
let {status, sort_by, sort_direction} = this.state;
|
|
|
|
|
this.getCourses(cate, status, 1, sort_by,
|
|
|
|
|
sort_direction);
|
|
|
|
|
}
|
|
|
|
|
//切换状态
|
|
|
|
|
changeStatus=(status)=>{
|
|
|
|
@ -76,8 +85,12 @@ class InfosProject extends Component{
|
|
|
|
|
page:1,
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
let{category}=this.state;
|
|
|
|
|
this.getCourses(category,status,1);
|
|
|
|
|
let {
|
|
|
|
|
category, sort_by,
|
|
|
|
|
sort_direction
|
|
|
|
|
} = this.state;
|
|
|
|
|
this.getCourses(category, status, 1, sort_by,
|
|
|
|
|
sort_direction);
|
|
|
|
|
}
|
|
|
|
|
//切换页数
|
|
|
|
|
changePage=(page)=>{
|
|
|
|
@ -85,8 +98,12 @@ class InfosProject extends Component{
|
|
|
|
|
page,
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
let{category,status}=this.state;
|
|
|
|
|
this.getCourses(category,status,page);
|
|
|
|
|
let {
|
|
|
|
|
category, status, sort_by,
|
|
|
|
|
sort_direction
|
|
|
|
|
} = this.state;
|
|
|
|
|
this.getCourses(category, status, page, sort_by,
|
|
|
|
|
sort_direction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 进入项目
|
|
|
|
@ -96,6 +113,27 @@ class InfosProject extends Component{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//切换种类
|
|
|
|
|
updatedlist(sort_by) {
|
|
|
|
|
//按照什么样子排序
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpin: true
|
|
|
|
|
});
|
|
|
|
|
let {category, status, page, sort_direction} = this.state;
|
|
|
|
|
this.getCourses(category, status, 1, sort_by, "desc");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//排序
|
|
|
|
|
updatedlists(sort_direction) {
|
|
|
|
|
//是否是倒序
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpin: true
|
|
|
|
|
});
|
|
|
|
|
let {category, status, page, sort_by} = this.state;
|
|
|
|
|
this.getCourses(category, status, page, sort_by, sort_direction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
let{
|
|
|
|
|
category,
|
|
|
|
@ -103,12 +141,24 @@ class InfosProject extends Component{
|
|
|
|
|
page,
|
|
|
|
|
data,
|
|
|
|
|
totalCount,
|
|
|
|
|
isSpin
|
|
|
|
|
isSpin,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction
|
|
|
|
|
} = this.state;
|
|
|
|
|
let isStudent = this.props.isStudent();
|
|
|
|
|
let is_current=this.props.is_current;
|
|
|
|
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
const menu = (
|
|
|
|
|
<Menu>
|
|
|
|
|
<Menu.Item onClick={() => this.updatedlist("updated_on")}>
|
|
|
|
|
最新动态
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
<Menu.Item onClick={() => this.updatedlist("created_on")}>
|
|
|
|
|
最新创建
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
|
|
|
|
|
</Menu>
|
|
|
|
|
);
|
|
|
|
|
return(
|
|
|
|
|
<div className="educontent">
|
|
|
|
|
<Spin size="large" spinning={isSpin}>
|
|
|
|
@ -118,21 +168,76 @@ class InfosProject extends Component{
|
|
|
|
|
<li className={category=="study" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("study")}>{is_current ? "我":"TA"}学习的</a></li>
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
is_current &&
|
|
|
|
|
is_current &&
|
|
|
|
|
<div className="edu-back-white padding20-30 clearfix secondNav bor-top-greyE">
|
|
|
|
|
<li className={status ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeStatus()}>全部</a></li>
|
|
|
|
|
<li className={status=="publicly" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("publicly")}>公开</a></li>
|
|
|
|
|
<li className={status=="personal" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("personal")}>私有</a></li>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
<p className="pl25 pr25 clearfix font-12 mb20 mt20">
|
|
|
|
|
<p className="pl25 pr25 clearfix font-12 " style={{
|
|
|
|
|
lineHeight: "41px",
|
|
|
|
|
}}>
|
|
|
|
|
<span className="fl color-grey-9">共参与{totalCount}个{category?category=="manage"?"发布":"学习":"项目"}</span>
|
|
|
|
|
<span className="fr color-grey-9">时间最新</span>
|
|
|
|
|
<sapn className="relativef fr"
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
height: "40px",
|
|
|
|
|
lineHeight: "40px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
height: "10px",
|
|
|
|
|
lineHeight: "10px",
|
|
|
|
|
display: "table",
|
|
|
|
|
marginTop: "9px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<i className={sort_direction === "asc" ?
|
|
|
|
|
"iconfont icon-sanjiaoxing-up font-12 color-blue h10 " : "iconfont icon-sanjiaoxing-up font-12 h10"}
|
|
|
|
|
onClick={() => this.updatedlists("asc")}></i>
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
height: "10px",
|
|
|
|
|
lineHeight: "10px",
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
display: "table",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<i className={sort_direction === "desc" ?
|
|
|
|
|
"iconfont icon-sanjiaoxing-down font-12 yslbottomsj color-blue h10" : "iconfont icon-sanjiaoxing-down font-12 yslbottomsj h10"}
|
|
|
|
|
onClick={() => this.updatedlists("desc")}></i>
|
|
|
|
|
</span>
|
|
|
|
|
</sapn>
|
|
|
|
|
<Dropdown overlay={menu}>
|
|
|
|
|
<span className="fr color-grey-9 mr10 pointer " style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "initial",
|
|
|
|
|
}}>
|
|
|
|
|
<span>{sort_by === "updated_on" ? '最近更新' : sort_by === "created_on" ? '最新创建' : ""}</span>
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</p>
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
.square-list{width: 100%;box-sizing: border-box;margin-top:10px}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<div className="square-list clearfix">
|
|
|
|
|
{/* 289 */}
|
|
|
|
|
{
|
|
|
|
|
page == 1 && is_current && this.props.current_user && !category && this.props.current_user.user_identity != "学生" ?
|
|
|
|
|
page == 1 && is_current && this.props.current_user && !category && this.props.current_user.user_identity != "学生" ?
|
|
|
|
|
<Create href={`${this.props.Headertop && this.props.Headertop.old_url}/projects/new`} name={"新建开发项目"} index="4" Createtype={"projects"}
|
|
|
|
|
{...this.props} {...this.state}
|
|
|
|
|
></Create>:""
|
|
|
|
@ -174,17 +279,17 @@ class InfosProject extends Component{
|
|
|
|
|
<div className="edu-txt-center course-bottom">
|
|
|
|
|
<div className="inline color-grey-6">
|
|
|
|
|
{
|
|
|
|
|
item.members_count> 0 &&
|
|
|
|
|
item.members_count > 0 &&
|
|
|
|
|
<span className="mr10 ml10 fl squareIconSpan">
|
|
|
|
|
<i className="iconfont icon-chengyuan fl mr3" data-tip-down="成员"></i>{item.members_count}</span>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
item.issues_count> 0 &&
|
|
|
|
|
item.issues_count > 0 &&
|
|
|
|
|
<span className="mr10 ml10 fl squareIconSpan">
|
|
|
|
|
<i className="iconfont icon-issue fl mr3" data-tip-down="issues数"></i>{item.issues_count}</span>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
item.changesets_count> 0 &&
|
|
|
|
|
item.changesets_count > 0 &&
|
|
|
|
|
<span className="mr10 ml10 fl squareIconSpan">
|
|
|
|
|
<i className="iconfont icon-banbenku fl mr3" data-tip-down="版本库"></i>{item.changesets_count}</span>
|
|
|
|
|
}
|
|
|
|
@ -196,7 +301,7 @@ class InfosProject extends Component{
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
totalCount > 15 &&
|
|
|
|
|
totalCount > 15 &&
|
|
|
|
|
<div className="mt30 mb50 edu-txt-center">
|
|
|
|
|
<Pagination showQuickJumper total={totalCount} onChange={this.changePage} pageSize={16} current={page}/>
|
|
|
|
|
</div>
|
|
|
|
@ -206,4 +311,4 @@ class InfosProject extends Component{
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
export default InfosProject;
|
|
|
|
|
export default InfosProject;
|
|
|
|
|