|
|
@ -1,7 +1,7 @@
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { SnackbarHOC } from 'educoder';
|
|
|
|
import { SnackbarHOC } from 'educoder';
|
|
|
|
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
|
|
|
|
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
|
|
|
|
import {Tooltip,Menu,Pagination, Spin} from 'antd';
|
|
|
|
import {Tooltip, Menu, Pagination, Spin, Dropdown} from 'antd';
|
|
|
|
import Loadable from 'react-loadable';
|
|
|
|
import Loadable from 'react-loadable';
|
|
|
|
import Loading from '../../../Loading';
|
|
|
|
import Loading from '../../../Loading';
|
|
|
|
import NoneData from '../../courses/coursesPublic/NoneData'
|
|
|
|
import NoneData from '../../courses/coursesPublic/NoneData'
|
|
|
@ -19,11 +19,11 @@ class InfosPath extends Component{
|
|
|
|
this.state={
|
|
|
|
this.state={
|
|
|
|
category:undefined,
|
|
|
|
category:undefined,
|
|
|
|
page:1,
|
|
|
|
page:1,
|
|
|
|
sort_by:'time',
|
|
|
|
|
|
|
|
status:undefined,
|
|
|
|
status:undefined,
|
|
|
|
per_page:16,
|
|
|
|
per_page:16,
|
|
|
|
isSpin:false,
|
|
|
|
isSpin:false,
|
|
|
|
|
|
|
|
sort_by: "updated_at",
|
|
|
|
|
|
|
|
sort_direction: "desc",
|
|
|
|
totalCount:undefined,
|
|
|
|
totalCount:undefined,
|
|
|
|
data:undefined
|
|
|
|
data:undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -33,28 +33,34 @@ class InfosPath extends Component{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let{category,status,sort_by,page,per_page}=this.state;
|
|
|
|
let {category, status, sort_by, page, per_page, sort_direction} = this.state;
|
|
|
|
this.getCourses(category,status,sort_by,page,per_page);
|
|
|
|
this.getCourses(category, status, sort_by, page, sort_direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getCourses=(category,status,sort_by,page,per_page)=>{
|
|
|
|
getCourses = (category, status, sort_by, page, sort_direction) => {
|
|
|
|
let url=`/users/${this.props.match.params.username}/subjects.json`;
|
|
|
|
let url=`/users/${this.props.match.params.username}/subjects.json`;
|
|
|
|
axios.get((url),{params:{
|
|
|
|
axios.get((url),{params:{
|
|
|
|
category,
|
|
|
|
category,
|
|
|
|
status,
|
|
|
|
status,
|
|
|
|
sort_by,
|
|
|
|
sort_by,
|
|
|
|
page,
|
|
|
|
page,
|
|
|
|
|
|
|
|
sort_direction,
|
|
|
|
per_page:this.props.is_current && category && page ==1?17:16
|
|
|
|
per_page:this.props.is_current && category && page ==1?17:16
|
|
|
|
}}).then((result)=>{
|
|
|
|
}}).then((result)=>{
|
|
|
|
if(result){
|
|
|
|
if(result){
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
totalCount:result.data.count,
|
|
|
|
totalCount:result.data.count,
|
|
|
|
data:result.data,
|
|
|
|
data:result.data,
|
|
|
|
|
|
|
|
sort_by: sort_by,
|
|
|
|
|
|
|
|
sort_direction: sort_direction,
|
|
|
|
isSpin:false
|
|
|
|
isSpin:false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error)=>{
|
|
|
|
}).catch((error)=>{
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
isSpin: false
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -66,18 +72,18 @@ class InfosPath extends Component{
|
|
|
|
page:1,
|
|
|
|
page:1,
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let{sort_by}=this.state;
|
|
|
|
let {sort_by, sort_direction} = this.state;
|
|
|
|
this.getCourses(cate,undefined,sort_by,1);
|
|
|
|
this.getCourses(cate, undefined, sort_by, 1, sort_direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 切换状态
|
|
|
|
// 切换状态
|
|
|
|
changeStatus=(status)=>{
|
|
|
|
changeStatus=(status)=>{
|
|
|
|
let{category,sort_by}=this.state;
|
|
|
|
let {category, sort_by, sort_direction} = this.state;
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
status,
|
|
|
|
status,
|
|
|
|
page:1,
|
|
|
|
page:1,
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.getCourses(category,status,sort_by,1);
|
|
|
|
this.getCourses(category, status, sort_by, 1, sort_direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//切换页数
|
|
|
|
//切换页数
|
|
|
|
changePage=(page)=>{
|
|
|
|
changePage=(page)=>{
|
|
|
@ -85,8 +91,8 @@ class InfosPath extends Component{
|
|
|
|
page,
|
|
|
|
page,
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let{category,sort_by,status}=this.state;
|
|
|
|
let {category, sort_by, status, sort_direction} = this.state;
|
|
|
|
this.getCourses(category,status,sort_by,page);
|
|
|
|
this.getCourses(category, status, sort_by, page, sort_direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 进入课堂
|
|
|
|
// 进入课堂
|
|
|
@ -101,15 +107,38 @@ class InfosPath extends Component{
|
|
|
|
sort_by:sort,
|
|
|
|
sort_by:sort,
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let{category,status,page}=this.state;
|
|
|
|
let {category, status, page, sort_direction} = this.state;
|
|
|
|
this.getCourses(category,status,sort,page);
|
|
|
|
this.getCourses(category, status, sort, page, sort_direction);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//切换种类
|
|
|
|
|
|
|
|
updatedlist(sort_by) {
|
|
|
|
|
|
|
|
//按照什么样子排序
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
isSpin: true
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
let {category, status, page, sort_direction} = this.state;
|
|
|
|
|
|
|
|
this.getCourses(category, status, sort_by, 1, "desc");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//排序
|
|
|
|
|
|
|
|
updatedlists(sort_direction) {
|
|
|
|
|
|
|
|
//是否是倒序
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
isSpin: true
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
let {category, status, page, sort_by} = this.state;
|
|
|
|
|
|
|
|
this.getCourses(category, status, sort_by, page, sort_direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
render(){
|
|
|
|
let{
|
|
|
|
let{
|
|
|
|
category,
|
|
|
|
category,
|
|
|
|
status,
|
|
|
|
status,
|
|
|
|
sort_by,
|
|
|
|
sort_by,
|
|
|
|
|
|
|
|
sort_direction,
|
|
|
|
page,
|
|
|
|
page,
|
|
|
|
data,
|
|
|
|
data,
|
|
|
|
totalCount,
|
|
|
|
totalCount,
|
|
|
@ -117,6 +146,17 @@ class InfosPath extends Component{
|
|
|
|
} = this.state;
|
|
|
|
} = this.state;
|
|
|
|
let isStudent = this.props.isStudent();
|
|
|
|
let isStudent = this.props.isStudent();
|
|
|
|
let is_current=this.props.is_current;
|
|
|
|
let is_current=this.props.is_current;
|
|
|
|
|
|
|
|
const menu = (
|
|
|
|
|
|
|
|
<Menu>
|
|
|
|
|
|
|
|
<Menu.Item onClick={() => this.updatedlist("updated_at")}>
|
|
|
|
|
|
|
|
最近更新
|
|
|
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
|
|
|
<Menu.Item onClick={() => this.updatedlist("created_at")}>
|
|
|
|
|
|
|
|
最新创建
|
|
|
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Menu>
|
|
|
|
|
|
|
|
);
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
<div className="educontent">
|
|
|
|
<div className="educontent">
|
|
|
|
<Spin size="large" spinning={isSpin}>
|
|
|
|
<Spin size="large" spinning={isSpin}>
|
|
|
@ -142,10 +182,65 @@ class InfosPath extends Component{
|
|
|
|
<li className={status=="finished" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("finished")}>已完成</a></li>
|
|
|
|
<li className={status=="finished" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeStatus("finished")}>已完成</a></li>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
<div className="pl25 pr25 clearfix font-12 mb20 mt20">
|
|
|
|
<div className="pl25 pr25 clearfix font-12 " style={{
|
|
|
|
|
|
|
|
lineHeight: "41px",
|
|
|
|
|
|
|
|
}}>
|
|
|
|
<span className="fl color-grey-9">共参与{totalCount}个{category?category=="manage"?"发布":"学习":"实践课程"}</span>
|
|
|
|
<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_at" ? '最近更新' : sort_by === "created_at" ? '最新创建' : ""}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</Dropdown>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
.square-list{width: 100%;box-sizing: border-box;margin-top:10px}
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<div className="square-list clearfix">
|
|
|
|
<div className="square-list clearfix">
|
|
|
|
{/* 295 */}
|
|
|
|
{/* 295 */}
|
|
|
|
{
|
|
|
|
{
|
|
|
|