diff --git a/public/react/src/App.js b/public/react/src/App.js index e713cd0fd..47e471767 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -123,6 +123,12 @@ const SearchPage = Loadable({ loading: Loading, }) +//教学案例 +const MoopCases = Loadable({ + loader: () => import('./modules/moop_cases/index'), + loading: Loading, +}) + // 课堂讨论 // const BoardIndex = Loadable({ // loader: () => import('./modules/courses/boards/BoardIndex'), @@ -387,6 +393,11 @@ class App extends Component { + {/* 教学案例 */} + () + }/> + {/* */} {/*列表页*/} {/**/} diff --git a/public/react/src/images/moop_cases/teach_ex.jpg b/public/react/src/images/moop_cases/teach_ex.jpg new file mode 100644 index 000000000..eef1f7ce6 Binary files /dev/null and b/public/react/src/images/moop_cases/teach_ex.jpg differ diff --git a/public/react/src/modules/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index 2408e95bb..57b1e37f9 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -683,8 +683,9 @@ a.white-btn.use_scope-btn:hover{ } .colorBlue { + padding: 0px 7px; background-color: #fff; - color: #4CACFF; + color: #4CACFF!important; border: 1px solid #4CACFF; } .greyBack{ diff --git a/public/react/src/modules/moop_cases/CaseItem.js b/public/react/src/modules/moop_cases/CaseItem.js new file mode 100644 index 000000000..45be0b3cb --- /dev/null +++ b/public/react/src/modules/moop_cases/CaseItem.js @@ -0,0 +1,47 @@ +import React,{ Component } from "react"; +import { Spin } from "antd"; +import './css/moopCases.css' +import '../courses/css/Courses.css' + +import { getUrl } from 'educoder'; + +import Tags from './CaseTags' + +class CaseItem extends Component{ + constructor(props){ + super(props); + } + + render(){ + let { libraries } = this.props; + console.log(libraries) + return( +
+ { + libraries && libraries.map((item,key)=>{ + return( +
  • + {item.id} +
    +

    + {item.title} + +

    +

    + {item.author_name} + {item.author_school_name} + {item.download_count} 下载 + {item.praise_count} 赞 + {item.visited_count} 浏览 +

    +
    +
  • + ) + }) + } + +
    + ) + } +} +export default CaseItem; \ No newline at end of file diff --git a/public/react/src/modules/moop_cases/CaseTags.js b/public/react/src/modules/moop_cases/CaseTags.js new file mode 100644 index 000000000..0826b8645 --- /dev/null +++ b/public/react/src/modules/moop_cases/CaseTags.js @@ -0,0 +1,26 @@ +import React,{ Component } from "react"; +import './css/moopCases.css' +import '../courses/css/Courses.css' + +class CaseTags extends Component{ + constructor(props){ + super(props); + } + + render(){ + let { tags } = this.props; + return( + + { + tags && tags.map((item,key)=>{ + return( + {item} + ) + }) + } + + + ) + } +} +export default CaseTags; \ No newline at end of file diff --git a/public/react/src/modules/moop_cases/css/moopCases.css b/public/react/src/modules/moop_cases/css/moopCases.css new file mode 100644 index 000000000..95e539c7b --- /dev/null +++ b/public/react/src/modules/moop_cases/css/moopCases.css @@ -0,0 +1,50 @@ +.winput-300-35{ + width: 300px; + height: 35px; + padding: 5px; + box-sizing: border-box; +} +.library_nav li { + float: left; + cursor: pointer; + margin-right: 30px; + position: relative; + color: #05101A; + height: 40px; + line-height: 20px; + font-size: 16px; +} +.library_nav li.active a, .library_nav li:hover a{ + color: #4cacff!important; +} +.library_list { + margin-bottom: 30px; +} +.library_list_item:hover { + box-shadow: 0px 4px 8px rgba(158,158,158,0.16); +} +.library_list_item { + background: #fff; + padding: 20px 30px; + margin-bottom: 30px; + display: flex; +} +.library_list_item .library_l_name { + max-width: 600px; + float: left; +} + +.edu-activity-red { + background-color: #FC2B6A; + color: #fff!important; + cursor: pointer; + border: 1px solid #FC2B6A; + line-height: 17px; +} +.edu-activity-blue { + background-color: #4CACFF; + color: #fff!important; + cursor: pointer; + border: 1px solid #4CACFF; + line-height: 17px; +} \ No newline at end of file diff --git a/public/react/src/modules/moop_cases/index.js b/public/react/src/modules/moop_cases/index.js new file mode 100644 index 000000000..f35925388 --- /dev/null +++ b/public/react/src/modules/moop_cases/index.js @@ -0,0 +1,135 @@ +import React,{ Component } from "react"; +import { Input , Spin , Pagination } from "antd"; +import './css/moopCases.css' +import '../courses/css/Courses.css' + +import { SnackbarHOC , ActionBtn , WordsBtn } from 'educoder'; +import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import { CNotificationHOC } from '../courses/common/CNotificationHOC' + +import axios from 'axios' + +import NoneData from '../courses/coursesPublic/NoneData' + +import mainImg from '../../images/moop_cases/teach_ex.jpg' +import CaseItem from './CaseItem' + +const Search = Input.Search; +class Index extends Component{ + constructor(props){ + super(props); + this.state={ + type:0, + search:undefined, + page:1, + pageSize:20, + libraries:undefined, + totalCount:undefined + } + } + + componentDidMount = () =>{ + let { type , search , page , pageSize } = this.state; + this.InitList(type,search,page,pageSize); + } + + // 列表 + InitList = (type,search,page,pageSize) =>{ + let url = `/libraries.json`; + axios.get(url,{params:{ + type:type == 0 ? undefined : "mine", + keyword:search, + page, + per_page:pageSize + }}).then((result)=>{ + if(result){ + this.setState({ + libraries:result.data.libraries, + totalCount:result.data.count + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + // tab切换 + changeType = (type) =>{ + this.setState({ + type, + page:1 + }) + let { search , page , pageSize } = this.state; + this.InitList(type,search,page,pageSize); + } + + // 输入搜索内容 + inputStudent=(e)=>{ + this.setState({ + search:e.target.value + }) + } + + // 搜索 + searchInfo = () =>{ + let { type , search , pageSize } = this.state; + this.InitList( type , search , 1 , pageSize ); + } + + // 切换分页 + onChangePage =(pageNumber)=>{ + this.setState({ + page:pageNumber + }) + let { type , search , pageSize } = this.state; + this.InitList( type , search , pageNumber , pageSize ); + } + + render(){ + let { type , search ,libraries , totalCount ,pageSize ,page } = this.state; + return( +
    + +
    +
    +

    + 教学案例 + this.addQuestion(null, Q_TYPE_SINGLE)}>发布案例 +

    +
    +
      +
    • this.changeType(0)}> + 全部 +
    • +
    • this.changeType(1)}> + 我的 +
    • +
    +
    + +
    +
    +
    + { + libraries && libraries.length > 0 && + } + { + libraries && libraries.length == 0 &&
    + } + { + totalCount && totalCount > pageSize && +
    + +
    + } +
    +
    + ) + } +} +export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(Index) )); \ No newline at end of file