diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js index c9d49e542..e4926e02c 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js @@ -69,7 +69,7 @@ class PackageIndexNEIBannerConcent extends Component { componentDidUpdate = (prevProps) => { if(prevProps.current_user.username!=this.props.current_user.username){ this.setState({ - contact_name:this.props.current_user.username + contact_name:this.props.current_user&&this.props.current_user.username }) } } @@ -100,7 +100,7 @@ class PackageIndexNEIBannerConcent extends Component { }) }else{ this.setState({ - contact_name:this.props.current_user.username + contact_name:this.props.current_user&&this.props.current_user.username }) } diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 1798bfca8..79b0aa443 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -816,7 +816,7 @@ submittojoinclass=(value)=>{
  • 我的实训
  • 我的实践课程
  • 我的项目
  • -
  • 我的众包
  • +
  • 我的众包
  • 账号管理
  • {/*
  • this.educoderlogin()} >登入测试接口
  • */} {/*
  • this.trialapplications()} >试用申请
  • */} diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 3b58681da..5286c5797 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -17,6 +17,12 @@ import "../../courses/css/Courses.css" import Trialapplication from '../../login/Trialapplication' + +const InfosPackage = Loadable({ + loader: () => import('./InfosPackage'), + loading:Loading, +}) + const InfosCourse = Loadable({ loader: () => import('./InfosCourse'), loading:Loading, @@ -373,11 +379,17 @@ class Infos extends Component{ to={`/users/${username}/paths`}>实践课程
  • - this.setState({moduleName: 'projects'})} to={`/users/${username}/projects`}>项目
  • - + +
  • + this.setState({moduleName: 'package'})} + to={`/users/${username}/package`}>众包 +
  • + {/*{ data && data.identity!="学生" &&
  • 题库
  • }*/} @@ -389,6 +401,15 @@ class Infos extends Component{ {/* --------------------------------------------------------------------- */} + + {/* 众包 */} + {/* http://localhost:3007/courses/1309/homework/9300/setting */} + () + } + > + {/* 课堂 */} {/* http://localhost:3007/courses/1309/homework/9300/setting */} () } > + + () diff --git a/public/react/src/modules/user/usersInfo/InfosPackage.js b/public/react/src/modules/user/usersInfo/InfosPackage.js new file mode 100644 index 000000000..8222c951b --- /dev/null +++ b/public/react/src/modules/user/usersInfo/InfosPackage.js @@ -0,0 +1,197 @@ +import React, { Component } from 'react'; +import { SnackbarHOC } from 'educoder'; +import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import {Tooltip,Menu,Pagination,Spin} from 'antd'; +import Loadable from 'react-loadable'; +import Loading from '../../../Loading'; +import axios from 'axios'; +import NoneData from '../../courses/coursesPublic/NoneData' +import {getImageUrl} from 'educoder'; +import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; +import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import "./usersInfo.css" +import Create from './publicCreatNew' + +class InfosCourse 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}/courses.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 is_current=this.props.is_current; + + console.log(this.props.current_user&&this.props.current_user.user_identity==="学生") + return( +
    + +
    +
  • this.changeCategory()}>全部
  • +
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • +
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • +
    + +

    + 共{totalCount}个 + 发布时间 +

    +
    + { + page == 1 && is_current && + this.props.current_user && this.props.current_user.user_identity != "学生" ? : "" + } + { + (!data || data.courses.length==0) && (!is_current || (this.props.current_user && this.props.current_user.user_identity === "学生" )) && + } + { + data && data.courses && data.courses.map((item,key)=>{ + return( +
    this.turnToCourses(`${item.first_category_url}`,item.can_visited)} style={{"cursor": "pointer"}}> + { + item.is_public == 1 && + +
    + + 公开 +
    + } + { + item.can_visited ==false? +
    + +

    非成员不能访问

    +
    :"" + } + +
    +

    + {item.name} +

    + 用户 +

    {item.teacher && item.teacher.real_name}

    +

    {item.teacher && item.teacher.school_name}

    +
    +
    +
    + { + item.members_count > 0 && + + + {item.members_count} + + } + { + item.homework_commons_count > 0 && + + + {item.homework_commons_count} + + } + { + item.attachments_count > 0 && + + + {item.attachments_count} + + } +
    +
    +
    + ) + }) + } +
    + { + totalCount > 15 && +
    + +
    + } +
    +
    + ) + } +} +export default InfosCourse; \ No newline at end of file