diff --git a/public/react/public/index.html b/public/react/public/index.html index e38beda7c..95a27fc22 100755 --- a/public/react/public/index.html +++ b/public/react/public/index.html @@ -148,16 +148,30 @@ */} { data && data.college_identifier && - + @@ -342,7 +364,7 @@ class Infos extends Component{ to={`/users/${username}/projects`}>项目 - { data && data.identity!="学生" &&
  • 题库
  • } + {/*{ data && data.identity!="学生" &&
  • 题库
  • }*/} diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index cfd2bc443..06076a3cd 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -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( -
    - -
    -
  • this.changeCategory()}>全部
  • -
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • -
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • -
    - { - is_current && -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("publicly")}>公开
  • -
  • this.changeStatus("personal")}>私有
  • -
    - } -

    - 共参与{totalCount}个{category?category=="manage"?"发布":"学习":"项目"} - 时间最新 -

    -
    - { - !isStudent && page == 1 && !category && is_current && - - } - { - (!data || data.projects.length==0) && (isStudent || category) && - } - { - data && data.projects && data.projects.map((item,key)=>{ - return( -
    this.turnToCourses(`${this.props.Headertop && this.props.Headertop.old_url}/projects/${item.id}`,item.can_visited)} style={{"cursor": "pointer"}}> - { - item.is_public==1 && - -
    - - 公开 -
    - } - { - item.can_visited ==false? -
    - -

    非成员不能访问

    -
    :"" - } -
    -

    - {item.name} -

    - 用户 -

    {item.owner.real_name}

    -

    {item.owner.school_name}

    -
    -
    -
    - { - item.members_count> 0 && - - {item.members_count} - } - { - item.issues_count> 0 && - - {item.issues_count} - } - { - item.changesets_count> 0 && - - {item.changesets_count} - } -
    -
    -
    - ) - }) - } -
    - { - totalCount > 15 && -
    - -
    - } -
    -
    - ) - } -} +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( +
    + +
    +
  • this.changeCategory()}>全部
  • +
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • +
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • +
    + { + is_current && +
    +
  • this.changeStatus()}>全部
  • +
  • this.changeStatus("publicly")}>公开
  • +
  • this.changeStatus("personal")}>私有
  • +
    + } +

    + 共参与{totalCount}个{category?category=="manage"?"发布":"学习":"项目"} + 时间最新 +

    +
    + { + !isStudent && page == 1 && !category && is_current && + + } + { + (!data || data.projects.length==0) && (isStudent || category) && + } + { + data && data.projects && data.projects.map((item,key)=>{ + return( +
    this.turnToCourses(`/projects/${item.id}`,item.can_visited)} style={{"cursor": "pointer"}}> + { + item.is_public==1 && + +
    + + 公开 +
    + } + { + item.can_visited ==false? +
    + +

    非成员不能访问

    +
    :"" + } +
    +

    + {item.name} +

    + 用户 +

    {item.owner.real_name}

    +

    {item.owner.school_name}

    +
    +
    +
    + { + item.members_count> 0 && + + {item.members_count} + } + { + item.issues_count> 0 && + + {item.issues_count} + } + { + item.changesets_count> 0 && + + {item.changesets_count} + } +
    +
    +
    + ) + }) + } +
    + { + totalCount > 15 && +
    + +
    + } +
    +
    + ) + } +} export default InfosProject; \ No newline at end of file diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index 990700983..59fee95e9 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -94,6 +94,7 @@ class SearchPage extends Component{ //获取数据 getdata=(pages,type,keywords)=>{ let url = "/search.json"; + this.setState({ loading: true }) axios.get(url,{params:{ keyword:keywords, type:type, @@ -101,6 +102,8 @@ class SearchPage extends Component{ per_page:this.state.perpages, } }).then((response) => { + this.setState({ loading: false }) + if(response === undefined){ return @@ -118,11 +121,19 @@ class SearchPage extends Component{ } render(){ - let {tab,count,data,page,perpages}=this.state; + let {tab,count,data,page,perpages, type }=this.state; return(
    +
    { - JSON.stringify(data) === "[]" ? + JSON.stringify(data) === "[]" && this.state.loading != true ?
    @@ -227,11 +238,75 @@ class SearchPage extends Component{ }
    +
    - 主讲:{item.author_name}{item.author_school_name} 任务:{item.challenges_count===undefined?0:item.challenges_count} 学习人数:{item.study_count===undefined?0:item.study_count} -
    + {/* + 主讲:{item.author_name} + + {item.author_school_name} + + + 任务: + {item.challenges_count===undefined?0:item.challenges_count} + + + + + 学习人数: + {item.study_count===undefined?0:item.study_count} + + */} + + + {/* */} + {item.author_name} + {item.author_school_name} + + {!!item.challenges_count && + + 任务: + {item.challenges_count} + + } + {!!item.study_count && + + 学习人数: + {item.study_count} + + } + + {!!item.stage_shixuns_count && + + 实训数: + {item.stage_shixuns_count} + + } + {type == 'subject' && !!item.visits_count && + + 访问数: + {item.visits_count} + + } + + {!!item.members_count && + + 成员数: + {item.members_count} + + } + + {!!item.all_replies_count && + + 回复数:{item.all_replies_count} + } + + {/* + + + 学习人数:{item.study_count===undefined?0:item.study_count} */} +
    diff --git a/public/react/src/search/searchc.css b/public/react/src/search/searchc.css index c73680ecb..4b31e7c5d 100644 --- a/public/react/src/search/searchc.css +++ b/public/react/src/search/searchc.css @@ -126,4 +126,9 @@ .ziticor{ color: #777777; font-size: 13px; +} +.foohter{ + margin-top: 20px; + display: flex; + flex-direction:row; } \ No newline at end of file