diff --git a/public/react/src/common/mediator.js b/public/react/src/common/mediator.js new file mode 100644 index 000000000..464a5cbf8 --- /dev/null +++ b/public/react/src/common/mediator.js @@ -0,0 +1,46 @@ +function Mediator(obj) { + const channels = {} + + const mediator = { + subscribe: function (channel, cb) { + if (!channels[channel]) { + channels[channel] = [] + } + channels[channel].push(cb) + return this.unsubscribe.bind(null, channel, cb) + }, + + unsubscribe: function (channel, cb) { + let rs = channels[channel] + let index = -1 + if (rs) { + for (let i = 0; i < rs.length; i++) { + if (rs[i].name === cb.name) { + index = i + break + } + } + if (index >= 0) { + channels[channel].splice(index, 1) + return true + } + } + return false + }, + + publish: function (channel) { + if (!channels[channel]) { + return false + } + const args = Array.prototype.slice.call(arguments, 1) + channels[channel].forEach(subscription => { + subscription.apply(null, args) + }) + return this + }, + } + + return obj ? Object.assign(obj, mediator) : mediator +} +const mediator = new Mediator() +export default mediator diff --git a/public/react/src/modules/courses/coursesHome/CoursesHome.js b/public/react/src/modules/courses/coursesHome/CoursesHome.js index 586465849..c96426446 100644 --- a/public/react/src/modules/courses/coursesHome/CoursesHome.js +++ b/public/react/src/modules/courses/coursesHome/CoursesHome.js @@ -1,11 +1,14 @@ -import React, { Component } from 'react'; +import React, { Component, Fragment } from 'react'; import { getImageUrl } from 'educoder'; import CoursesHomeCard from "./CoursesHomeCard.js" import axios from 'axios'; -import { Input, Pagination } from 'antd'; +import { Pagination } from 'antd'; import LoadingSpin from '../../../common/LoadingSpin'; import UpgradeModals from '../../modals/UpgradeModals'; import './css/CoursesHome.css'; +import '../../tpm/shixuns/shixun-keyword-list.scss'; +import btnNew from './btn-new.png' +import btnJoin from './btn-join.png' class CoursesHome extends Component { constructor(props) { @@ -51,7 +54,7 @@ class CoursesHome extends Component { } componentDidMount() { - document.title = "翻转课堂"; + document.title = "教学课堂"; const upsystem = `/users/system_update.json`; axios.get(upsystem).then((response) => { let updata = response.data; @@ -116,7 +119,9 @@ class CoursesHome extends Component { } render() { - let { order, search, page, coursesHomelist } = this.state; + const { order, page, coursesHomelist } = this.state; + const { user, tojoinclass } = this.props + console.log(tojoinclass, '--------------s') return (
{this.state.updata === undefined ? "" : - {/*{*/} - {/* Periofters===true?*/} - {/*
  • */} - {/* */} - {/*
    */} - {/*
    */} - {/* 题库*/} - {/*
    */} - {/*
    */} - {/*
    */} - {/*
  • */} - {/* :""*/} - {/*}*/} - - -
  • 工程认证
  • - -
  • 0 ? 'block' : 'none'}}> - 职业路径 -
    0 ? 'block' : 'none'}}> -
      - {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { - return( -
    • {item.name}
    • - ) - }) - } -
    -
    -
  • - -
    - : -
    - - -
    - } - - - - - - - + {/*{*/} + {/* Periofters===true?*/} + {/*
  • */} + {/* */} + {/*
    */} + {/*
    */} + {/* 题库*/} + {/*
    */} + {/*
    */} + {/*
    */} + {/*
  • */} + {/* :""*/} + {/*}*/} + + +
  • 工程认证
  • + +
  • 0 ? 'block' : 'none' }}> + 职业路径 +
    0 ? 'block' : 'none' }}> + +
    +
  • + + + : +
    + + +
    + } + + + + + + +