Merge branch 'master' of https://bdgit.educoder.net/Hjqreturn/educoder
commit
5a2ee2c046
@ -1,24 +1,29 @@
|
||||
.editormd-html-preview, .editormd-preview-container {
|
||||
width: 95% !important;
|
||||
}
|
||||
.Finish_button{
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
margin-top: -8px;
|
||||
}
|
||||
.startbtnModal .ant-modal-content{
|
||||
background: transparent;
|
||||
box-shadow: 0 4px 12px transparent;
|
||||
}
|
||||
|
||||
.startbtnModal .ant-modal-content .ant-modal-body .ant-spin-spinning{
|
||||
margin-left: 45%;
|
||||
}
|
||||
|
||||
.color05101a{
|
||||
color:#05101a;
|
||||
}
|
||||
|
||||
.mtf3{
|
||||
margin-top: -3px;
|
||||
.editormd-html-preview, .editormd-preview-container {
|
||||
width: 95% !important;
|
||||
}
|
||||
.Finish_button{
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
margin-top: -8px;
|
||||
}
|
||||
.startbtnModal .ant-modal-content{
|
||||
background: transparent;
|
||||
box-shadow: 0 4px 12px transparent;
|
||||
}
|
||||
|
||||
.startbtnModal .ant-modal-content .ant-modal-body .ant-spin-spinning{
|
||||
margin-left: 45%;
|
||||
}
|
||||
|
||||
.color05101a{
|
||||
color:#05101a;
|
||||
}
|
||||
|
||||
.mtf3{
|
||||
margin-top: -3px;
|
||||
}
|
||||
.ysltable{
|
||||
overflow:hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space:nowrap
|
||||
}
|
@ -1,207 +1,207 @@
|
||||
import React,{ Component } from "react";
|
||||
import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd";
|
||||
import axios from 'axios';
|
||||
import { SnackbarHOC } from 'educoder';
|
||||
import Modals from '../../modals/Modals';
|
||||
const Option = Select.Option;
|
||||
const CheckboxGroup = Checkbox.Group;
|
||||
class sendPanel extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
sentShixunPath:false,
|
||||
sendToCourseList:undefined,
|
||||
openSearch:false,
|
||||
sendToCourseId:undefined,
|
||||
sendToShixunArray:[],
|
||||
shixunNum:0,
|
||||
Modalstype:false,
|
||||
cardsModalcancel:this.cardsModalcancel,
|
||||
cardsModalsave:this.cardsModalsave,
|
||||
modalsTopval:'',
|
||||
Modalsbottomval:'',
|
||||
courseurl:''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发送至
|
||||
SentToLesson =() =>{
|
||||
this.setState({
|
||||
sentShixunPath:true
|
||||
})
|
||||
}
|
||||
//隐藏发送至弹框
|
||||
hideSenttothevalue =()=>{
|
||||
this.setState({
|
||||
sentShixunPath:false
|
||||
})
|
||||
}
|
||||
//打开课堂列表下拉框
|
||||
openList=()=>{
|
||||
this.setState({
|
||||
openSearch:true
|
||||
})
|
||||
}
|
||||
//关闭课堂列表下拉框
|
||||
closeList=()=>{
|
||||
this.setState({
|
||||
openSearch:false
|
||||
})
|
||||
}
|
||||
|
||||
// 选择课堂获取选中的Id
|
||||
selectCloseList=(e)=>{
|
||||
this.setState({
|
||||
openSearch:false,
|
||||
sendToCourseId:e
|
||||
})
|
||||
}
|
||||
|
||||
//选择checkbox
|
||||
changeCheckBoxs=(list)=>{
|
||||
this.setState({
|
||||
sendToShixunArray:list,
|
||||
shixunNum:list.length
|
||||
})
|
||||
}
|
||||
|
||||
//确认提交
|
||||
submitInfo=()=>{
|
||||
let {sendToCourseId,sendToShixunArray}=this.state;
|
||||
if(sendToCourseId===undefined){
|
||||
this.props.showSnackbar("您还未选择发送的课堂");
|
||||
}else if(parseInt(sendToShixunArray.length)==0){
|
||||
this.props.showSnackbar("您还未选择实训");
|
||||
}else{
|
||||
let id=this.props.detailInfoList.id;
|
||||
let url="/paths/"+id+"/send_to_course.json";
|
||||
axios.post(url,{
|
||||
shixun_ids:sendToShixunArray,
|
||||
course_id:sendToCourseId
|
||||
}).then((result)=>{
|
||||
if(result.data.status===1){
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
sentShixunPath:false,
|
||||
Modalstopval:result.data.message,
|
||||
courseurl:result.data.url
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
let id=this.props.detailInfoList.id;
|
||||
let url="/paths/"+id+"/choose_course.json";
|
||||
axios.get(url).then((result)=>{
|
||||
if(result.status==200){
|
||||
this.setState({
|
||||
sendToCourseList:result.data
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
cardsModalcancel=()=>{
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
})
|
||||
}
|
||||
cardsModalsave=()=>{
|
||||
let {courseurl}=this.state;
|
||||
window.location.href = "https://www.educoder.net/"+courseurl;
|
||||
}
|
||||
render(){
|
||||
let{sentShixunPath,sendToCourseList,openSearch,shixunNum,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state;
|
||||
return(
|
||||
<div>
|
||||
|
||||
<Modals
|
||||
modalsType={Modalstype}
|
||||
modalsTopval={Modalstopval}
|
||||
modalsBottomval={Modalsbottomval}
|
||||
modalCancel={cardsModalcancel}
|
||||
modalSave={cardsModalsave}
|
||||
>
|
||||
</Modals>
|
||||
{
|
||||
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
|
||||
<Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂">
|
||||
<a onClick = {this.SentToLesson} className="user_default_btn edu-greenline-btn fr font-18 mr20">
|
||||
发送至
|
||||
</a>
|
||||
</Tooltip>:''
|
||||
}
|
||||
|
||||
<Modal
|
||||
keyboard={false}
|
||||
title="发送至课堂"
|
||||
visible={sentShixunPath}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
>
|
||||
<div className="newupload_conbox">
|
||||
<div className="mb20" onMouseLeave={this.closeList}>
|
||||
<Select
|
||||
placeholder="请选择您要发送的课堂"
|
||||
style={{"width":"100%"}}
|
||||
onSelect={this.selectCloseList}
|
||||
onMouseEnter={this.openList}
|
||||
defaultOpen={false}
|
||||
open={openSearch}
|
||||
optionLabelProp="name"
|
||||
>
|
||||
{
|
||||
sendToCourseList === undefined ? "": sendToCourseList.courses.map((item,key)=>{
|
||||
return(
|
||||
<Option key={item.course_id} id={key} name={item.course_name}>
|
||||
<Row>
|
||||
<Col className="fl with70 task-hide">{item.course_name}</Col>
|
||||
<Col className="fl color-grey-9 with30 edu-txt-center">{item.created_at}</Col>
|
||||
</Row>
|
||||
</Option>
|
||||
)
|
||||
})
|
||||
}
|
||||
</Select>
|
||||
</div>
|
||||
<div className="edu-back-skyblue pl15 pr15 clearfix over280 pt5">
|
||||
<CheckboxGroup onChange={this.changeCheckBoxs}>
|
||||
|
||||
{
|
||||
sendToCourseList && sendToCourseList.stages.map((item,key)=>{
|
||||
return(
|
||||
item.shixuns.map((items,keys)=>{
|
||||
return(
|
||||
<div className="mt5" key={keys}>
|
||||
<Checkbox name={key} value={items.shixun_id}>{items.shixun_name}</Checkbox>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
</CheckboxGroup>
|
||||
</div>
|
||||
<p className="color-grey-9 pl15 font-12 mt10">已选择 {shixunNum} 个实训</p>
|
||||
<div className="mt20 clearfix edu-txt-center">
|
||||
<a onClick={this.hideSenttothevalue} className="pop_close task-btn mr30">取消</a>
|
||||
<a className="task-btn task-btn-orange" onClick={this.submitInfo}>确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
import React,{ Component } from "react";
|
||||
import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd";
|
||||
import axios from 'axios';
|
||||
import { SnackbarHOC } from 'educoder';
|
||||
import Modals from '../../modals/Modals';
|
||||
const Option = Select.Option;
|
||||
const CheckboxGroup = Checkbox.Group;
|
||||
class sendPanel extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
sentShixunPath:false,
|
||||
sendToCourseList:undefined,
|
||||
openSearch:false,
|
||||
sendToCourseId:undefined,
|
||||
sendToShixunArray:[],
|
||||
shixunNum:0,
|
||||
Modalstype:false,
|
||||
cardsModalcancel:this.cardsModalcancel,
|
||||
cardsModalsave:this.cardsModalsave,
|
||||
modalsTopval:'',
|
||||
Modalsbottomval:'',
|
||||
courseurl:''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发送至
|
||||
SentToLesson =() =>{
|
||||
this.setState({
|
||||
sentShixunPath:true
|
||||
})
|
||||
}
|
||||
//隐藏发送至弹框
|
||||
hideSenttothevalue =()=>{
|
||||
this.setState({
|
||||
sentShixunPath:false
|
||||
})
|
||||
}
|
||||
//打开课堂列表下拉框
|
||||
openList=()=>{
|
||||
this.setState({
|
||||
openSearch:true
|
||||
})
|
||||
}
|
||||
//关闭课堂列表下拉框
|
||||
closeList=()=>{
|
||||
this.setState({
|
||||
openSearch:false
|
||||
})
|
||||
}
|
||||
|
||||
// 选择课堂获取选中的Id
|
||||
selectCloseList=(e)=>{
|
||||
this.setState({
|
||||
openSearch:false,
|
||||
sendToCourseId:e
|
||||
})
|
||||
}
|
||||
|
||||
//选择checkbox
|
||||
changeCheckBoxs=(list)=>{
|
||||
this.setState({
|
||||
sendToShixunArray:list,
|
||||
shixunNum:list.length
|
||||
})
|
||||
}
|
||||
|
||||
//确认提交
|
||||
submitInfo=()=>{
|
||||
let {sendToCourseId,sendToShixunArray}=this.state;
|
||||
if(sendToCourseId===undefined){
|
||||
this.props.showSnackbar("您还未选择发送的课堂");
|
||||
}else if(parseInt(sendToShixunArray.length)==0){
|
||||
this.props.showSnackbar("您还未选择实训");
|
||||
}else{
|
||||
let id=this.props.detailInfoList.id;
|
||||
let url="/paths/"+id+"/send_to_course.json";
|
||||
axios.post(url,{
|
||||
shixun_ids:sendToShixunArray,
|
||||
course_id:sendToCourseId
|
||||
}).then((result)=>{
|
||||
if(result.data.status===1){
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
sentShixunPath:false,
|
||||
Modalstopval:result.data.message,
|
||||
courseurl:result.data.url
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
let id=this.props.detailInfoList.id;
|
||||
let url="/paths/"+id+"/choose_course.json";
|
||||
axios.get(url).then((result)=>{
|
||||
if(result.status==200){
|
||||
this.setState({
|
||||
sendToCourseList:result.data
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
cardsModalcancel=()=>{
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
})
|
||||
}
|
||||
cardsModalsave=()=>{
|
||||
let {courseurl}=this.state;
|
||||
window.location.href =courseurl;
|
||||
}
|
||||
render(){
|
||||
let{sentShixunPath,sendToCourseList,openSearch,shixunNum,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state;
|
||||
return(
|
||||
<div>
|
||||
|
||||
<Modals
|
||||
modalsType={Modalstype}
|
||||
modalsTopval={Modalstopval}
|
||||
modalsBottomval={Modalsbottomval}
|
||||
modalCancel={cardsModalcancel}
|
||||
modalSave={cardsModalsave}
|
||||
>
|
||||
</Modals>
|
||||
{
|
||||
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
|
||||
<Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂">
|
||||
<a onClick = {this.SentToLesson} className="user_default_btn edu-greenline-btn fr font-18 mr20">
|
||||
发送至
|
||||
</a>
|
||||
</Tooltip>:''
|
||||
}
|
||||
|
||||
<Modal
|
||||
keyboard={false}
|
||||
title="发送至课堂"
|
||||
visible={sentShixunPath}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
>
|
||||
<div className="newupload_conbox">
|
||||
<div className="mb20" onMouseLeave={this.closeList}>
|
||||
<Select
|
||||
placeholder="请选择您要发送的课堂"
|
||||
style={{"width":"100%"}}
|
||||
onSelect={this.selectCloseList}
|
||||
onMouseEnter={this.openList}
|
||||
defaultOpen={false}
|
||||
open={openSearch}
|
||||
optionLabelProp="name"
|
||||
>
|
||||
{
|
||||
sendToCourseList === undefined ? "": sendToCourseList.courses.map((item,key)=>{
|
||||
return(
|
||||
<Option key={item.course_id} id={key} name={item.course_name}>
|
||||
<Row>
|
||||
<Col className="fl with70 task-hide">{item.course_name}</Col>
|
||||
<Col className="fl color-grey-9 with30 edu-txt-center">{item.created_at}</Col>
|
||||
</Row>
|
||||
</Option>
|
||||
)
|
||||
})
|
||||
}
|
||||
</Select>
|
||||
</div>
|
||||
<div className="edu-back-skyblue pl15 pr15 clearfix over280 pt5">
|
||||
<CheckboxGroup onChange={this.changeCheckBoxs}>
|
||||
|
||||
{
|
||||
sendToCourseList && sendToCourseList.stages.map((item,key)=>{
|
||||
return(
|
||||
item.shixuns.map((items,keys)=>{
|
||||
return(
|
||||
<div className="mt5" key={keys}>
|
||||
<Checkbox name={key} value={items.shixun_id}>{items.shixun_name}</Checkbox>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
</CheckboxGroup>
|
||||
</div>
|
||||
<p className="color-grey-9 pl15 font-12 mt10">已选择 {shixunNum} 个实训</p>
|
||||
<div className="mt20 clearfix edu-txt-center">
|
||||
<a onClick={this.hideSenttothevalue} className="pop_close task-btn mr30">取消</a>
|
||||
<a className="task-btn task-btn-orange" onClick={this.submitInfo}>确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
export default SnackbarHOC()(sendPanel);
|
After Width: | Height: | Size: 720 B |
@ -1,192 +1,192 @@
|
||||
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 axios from 'axios';
|
||||
import NoneData from '../../courses/coursesPublic/NoneData'
|
||||
import {getImageUrl} from 'educoder';
|
||||
import "./usersInfo.css"
|
||||
import Create from './publicCreatNew'
|
||||
|
||||
class InfosProject extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
category:undefined,
|
||||
status:undefined,
|
||||
page:1,
|
||||
per_page:16,
|
||||
|
||||
totalCount:undefined,
|
||||
data:undefined,
|
||||
isSpin:false
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount=()=>{
|
||||
this.setState({
|
||||
isSpin:true
|
||||
})
|
||||
let{category,status,page}=this.state;
|
||||
this.getCourses(category,status,page);
|
||||
}
|
||||
|
||||
getCourses=(category,status,page)=>{
|
||||
let url=`/users/${this.props.match.params.username}/projects.json`;
|
||||
axios.get((url),{params:{
|
||||
category,
|
||||
status,
|
||||
page,
|
||||
per_page:this.props.is_current && category && page ==1?17:16
|
||||
}}).then((result)=>{
|
||||
if(result){
|
||||
this.setState({
|
||||
totalCount:result.data.count,
|
||||
data:result.data,
|
||||
isSpin:false
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
//切换种类
|
||||
changeCategory=(cate)=>{
|
||||
this.setState({
|
||||
category:cate,
|
||||
page:1,
|
||||
isSpin:true
|
||||
})
|
||||
let{status}=this.state;
|
||||
this.getCourses(cate,status,1);
|
||||
}
|
||||
//切换状态
|
||||
changeStatus=(status)=>{
|
||||
this.setState({
|
||||
status:status,
|
||||
page:1,
|
||||
isSpin:true
|
||||
})
|
||||
let{category}=this.state;
|
||||
this.getCourses(category,status,1);
|
||||
}
|
||||
//切换页数
|
||||
changePage=(page)=>{
|
||||
this.setState({
|
||||
page,
|
||||
isSpin:true
|
||||
})
|
||||
let{category,status}=this.state;
|
||||
this.getCourses(category,status,page);
|
||||
}
|
||||
|
||||
// 进入项目
|
||||
turnToCourses=(url,flag)=>{
|
||||
if(flag){
|
||||
this.props.history.push(url);
|
||||
}
|
||||
}
|
||||
|
||||
render(){
|
||||
let{
|
||||
category,
|
||||
status,
|
||||
page,
|
||||
data,
|
||||
totalCount,
|
||||
isSpin
|
||||
} = this.state;
|
||||
let isStudent = this.props.isStudent();
|
||||
let is_current=this.props.is_current;
|
||||
return(
|
||||
<div className="educontent">
|
||||
<Spin size="large" spinning={isSpin}>
|
||||
<div className="white-panel edu-back-white pt25 pb25 clearfix ">
|
||||
<li className={category ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeCategory()}>全部</a></li>
|
||||
<li className={category=="manage" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的</a></li>
|
||||
<li className={category=="study" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("study")}>{is_current ? "我":"TA"}学习的</a></li>
|
||||
</div>
|
||||
{
|
||||
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">
|
||||
<span className="fl color-grey-9">共参与{totalCount}个{category?category=="manage"?"发布":"学习":"项目"}</span>
|
||||
<span className="fr color-grey-9">时间最新</span>
|
||||
</p>
|
||||
<div className="square-list clearfix">
|
||||
{
|
||||
!isStudent && page == 1 && !category && is_current &&
|
||||
<Create href={`${this.props.Headertop && this.props.Headertop.old_url}/projects/new`} name={"新建项目"} index="4"></Create>
|
||||
}
|
||||
{
|
||||
(!data || data.projects.length==0) && (isStudent || category) && <NoneData></NoneData>
|
||||
}
|
||||
{
|
||||
data && data.projects && data.projects.map((item,key)=>{
|
||||
return(
|
||||
<div className="square-Item" onClick={()=>this.turnToCourses(`${this.props.Headertop && this.props.Headertop.old_url}/projects/${item.id}`,item.can_visited)} style={{"cursor": "pointer"}}>
|
||||
{
|
||||
item.is_public==1 &&
|
||||
<React.Fragment>
|
||||
<div className="publicpart"></div>
|
||||
<span className="smalltrangle"></span>
|
||||
<span className="publicword">公开</span>
|
||||
</React.Fragment>
|
||||
}
|
||||
{
|
||||
item.can_visited ==false?
|
||||
<div className="closeSquare">
|
||||
<img src={getImageUrl("/images/educoder/icon/lockclose.svg")} className="mt80 mb25"/>
|
||||
<p className="font-14 color-white">非成员不能访问</p>
|
||||
</div>:""
|
||||
}
|
||||
<div className="substance">
|
||||
<p className="subName font-16">
|
||||
<span>{item.name}</span>
|
||||
</p>
|
||||
<span><img alt="用户" className="radius mt15" height="60" src={getImageUrl(`images/${item.owner.avatar_url}`)} width="60"/></span>
|
||||
<p className="font-14 mt10"><span>{item.owner.real_name}</span></p>
|
||||
<p className="font-16 mb15 mt10 task-hide"><span className="color-grey-9">{item.owner.school_name}</span></p>
|
||||
</div>
|
||||
<div className="edu-txt-center course-bottom">
|
||||
<div className="inline color-grey-6">
|
||||
{
|
||||
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 &&
|
||||
<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 &&
|
||||
<span className="mr10 ml10 fl squareIconSpan">
|
||||
<i className="iconfont icon-banbenku fl mr3" data-tip-down="版本库"></i>{item.changesets_count}</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
{
|
||||
totalCount > 15 &&
|
||||
<div className="mt30 mb50 edu-txt-center">
|
||||
<Pagination showQuickJumper total={totalCount} onChange={this.changePage} pageSize={16} current={page}/>
|
||||
</div>
|
||||
}
|
||||
</Spin>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
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 axios from 'axios';
|
||||
import NoneData from '../../courses/coursesPublic/NoneData'
|
||||
import {getImageUrl} from 'educoder';
|
||||
import "./usersInfo.css"
|
||||
import Create from './publicCreatNew'
|
||||
|
||||
class InfosProject extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
category:undefined,
|
||||
status:undefined,
|
||||
page:1,
|
||||
per_page:16,
|
||||
|
||||
totalCount:undefined,
|
||||
data:undefined,
|
||||
isSpin:false
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount=()=>{
|
||||
this.setState({
|
||||
isSpin:true
|
||||
})
|
||||
let{category,status,page}=this.state;
|
||||
this.getCourses(category,status,page);
|
||||
}
|
||||
|
||||
getCourses=(category,status,page)=>{
|
||||
let url=`/users/${this.props.match.params.username}/projects.json`;
|
||||
axios.get((url),{params:{
|
||||
category,
|
||||
status,
|
||||
page,
|
||||
per_page:this.props.is_current && category && page ==1?17:16
|
||||
}}).then((result)=>{
|
||||
if(result){
|
||||
this.setState({
|
||||
totalCount:result.data.count,
|
||||
data:result.data,
|
||||
isSpin:false
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
//切换种类
|
||||
changeCategory=(cate)=>{
|
||||
this.setState({
|
||||
category:cate,
|
||||
page:1,
|
||||
isSpin:true
|
||||
})
|
||||
let{status}=this.state;
|
||||
this.getCourses(cate,status,1);
|
||||
}
|
||||
//切换状态
|
||||
changeStatus=(status)=>{
|
||||
this.setState({
|
||||
status:status,
|
||||
page:1,
|
||||
isSpin:true
|
||||
})
|
||||
let{category}=this.state;
|
||||
this.getCourses(category,status,1);
|
||||
}
|
||||
//切换页数
|
||||
changePage=(page)=>{
|
||||
this.setState({
|
||||
page,
|
||||
isSpin:true
|
||||
})
|
||||
let{category,status}=this.state;
|
||||
this.getCourses(category,status,page);
|
||||
}
|
||||
|
||||
// 进入项目
|
||||
turnToCourses=(url,flag)=>{
|
||||
if(flag){
|
||||
window.location.href=url;
|
||||
}
|
||||
}
|
||||
|
||||
render(){
|
||||
let{
|
||||
category,
|
||||
status,
|
||||
page,
|
||||
data,
|
||||
totalCount,
|
||||
isSpin
|
||||
} = this.state;
|
||||
let isStudent = this.props.isStudent();
|
||||
let is_current=this.props.is_current;
|
||||
return(
|
||||
<div className="educontent">
|
||||
<Spin size="large" spinning={isSpin}>
|
||||
<div className="white-panel edu-back-white pt25 pb25 clearfix ">
|
||||
<li className={category ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeCategory()}>全部</a></li>
|
||||
<li className={category=="manage" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的</a></li>
|
||||
<li className={category=="study" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("study")}>{is_current ? "我":"TA"}学习的</a></li>
|
||||
</div>
|
||||
{
|
||||
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">
|
||||
<span className="fl color-grey-9">共参与{totalCount}个{category?category=="manage"?"发布":"学习":"项目"}</span>
|
||||
<span className="fr color-grey-9">时间最新</span>
|
||||
</p>
|
||||
<div className="square-list clearfix">
|
||||
{
|
||||
!isStudent && page == 1 && !category && is_current &&
|
||||
<Create href={`${this.props.Headertop && this.props.Headertop.old_url}/projects/new`} name={"新建项目"} index="4"></Create>
|
||||
}
|
||||
{
|
||||
(!data || data.projects.length==0) && (isStudent || category) && <NoneData></NoneData>
|
||||
}
|
||||
{
|
||||
data && data.projects && data.projects.map((item,key)=>{
|
||||
return(
|
||||
<div className="square-Item" onClick={()=>this.turnToCourses(`/projects/${item.id}`,item.can_visited)} style={{"cursor": "pointer"}}>
|
||||
{
|
||||
item.is_public==1 &&
|
||||
<React.Fragment>
|
||||
<div className="publicpart"></div>
|
||||
<span className="smalltrangle"></span>
|
||||
<span className="publicword">公开</span>
|
||||
</React.Fragment>
|
||||
}
|
||||
{
|
||||
item.can_visited ==false?
|
||||
<div className="closeSquare">
|
||||
<img src={getImageUrl("/images/educoder/icon/lockclose.svg")} className="mt80 mb25"/>
|
||||
<p className="font-14 color-white">非成员不能访问</p>
|
||||
</div>:""
|
||||
}
|
||||
<div className="substance">
|
||||
<p className="subName font-16">
|
||||
<span>{item.name}</span>
|
||||
</p>
|
||||
<span><img alt="用户" className="radius mt15" height="60" src={getImageUrl(`images/${item.owner.avatar_url}`)} width="60"/></span>
|
||||
<p className="font-14 mt10"><span>{item.owner.real_name}</span></p>
|
||||
<p className="font-16 mb15 mt10 task-hide"><span className="color-grey-9">{item.owner.school_name}</span></p>
|
||||
</div>
|
||||
<div className="edu-txt-center course-bottom">
|
||||
<div className="inline color-grey-6">
|
||||
{
|
||||
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 &&
|
||||
<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 &&
|
||||
<span className="mr10 ml10 fl squareIconSpan">
|
||||
<i className="iconfont icon-banbenku fl mr3" data-tip-down="版本库"></i>{item.changesets_count}</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
{
|
||||
totalCount > 15 &&
|
||||
<div className="mt30 mb50 edu-txt-center">
|
||||
<Pagination showQuickJumper total={totalCount} onChange={this.changePage} pageSize={16} current={page}/>
|
||||
</div>
|
||||
}
|
||||
</Spin>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default InfosProject;
|
Loading…
Reference in new issue