课堂加入

dev_aliyun2
harry 5 years ago
parent 273b40f1a0
commit 5dcfad2d72

@ -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

@ -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 (
<div>
{this.state.updata === undefined ? "" : <UpgradeModals
@ -125,7 +130,9 @@ class CoursesHome extends Component {
<div className="newMain clearfix">
<style>
{
`
` ::-webkit-scrollbar {
width: 0px !important;
}
.courses-head{
width: 100%;
height: 300px;
@ -145,13 +152,19 @@ class CoursesHome extends Component {
</div>
</div>
<div className="mt20 educontent mb20 clearfix">
<a className={order == "created_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={() => this.changeStatus("created_at")}>最新</a>
<a className={order == "visits" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={() => this.changeStatus("visits")}>最热</a>
{this.props.user && this.props.user.user_identity === "学生" ? "" : <span className={"fr font-16 bestChoose color-blue"} onClick={(url) => this.getUser("/courses/new")}>+新建翻转课堂</span>}
<div className="wrapper">
<div className="educontent search-keyword-container" style={{ padding: '20px 0 0 0' }}>
<div className="btn-groups">
<a id='new' className={order === 'created_at' ? 'active' : ''} onClick={() => this.changeStatus("created_at")} title='最新'>最新</a>
<a id='hot' className={order === 'visits' ? 'active' : ''} onClick={() => this.changeStatus("visits")} title='最热'>最热</a>
</div>
</div>
{user && user.user_identity !== '学生' ?
<Fragment>
<a className="btn-new" style={{ top: '67px' }} onClick={() => { this.getUser("/courses/new") }} > <img src={btnNew} width={40} alt="创建教学课堂" /> </a>
<a className="btn-join" style={{ top: '123px' }} onClick={() => { window._header_componentHandler.tojoinclass() }} > <img src={btnJoin} width={40} alt="加入教学课堂" /> </a>
</Fragment> : null
}
</div>
{coursesHomelist === undefined ? <LoadingSpin /> : <CoursesHomeCard {...this.props} {...this.state}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -2,7 +2,9 @@ import React, { Component } from 'react';
import { Link } from "react-router-dom";
import AccountProfile from "../user/AccountProfile";
import Certifiedprofessional from "../../modules/modals/Certifiedprofessional"
import { getImageUrl } from 'educoder'
import axios from 'axios';
import { Modal, Radio, Input, message, notification } from 'antd';
@ -100,9 +102,6 @@ class NewHeader extends Component {
}
}
componentDidUpdate = (prevProps) => {
}
openNotification = (messge) => {
notification.open({
message: "提示",
@ -115,6 +114,9 @@ class NewHeader extends Component {
this.setState({
user: newProps.user
})
if (newProps.Headertop != undefined) {
old_url = newProps.Headertop.old_url
}
}
getCookie = (key) => {
@ -343,6 +345,14 @@ class NewHeader extends Component {
})
return
}
// }else if(value===0){
// if(tojoinclasstitle.length<5){
// this.setState({
// code_notice:true
// })
// return
// }
// }
if (tojoinclasstitle === "" || tojoinclasstitle === undefined) {
this.setState({
code_notice: true
@ -410,7 +420,6 @@ class NewHeader extends Component {
}
this.hidetojoinclass()
}
// 关闭
cancelModulationModels = () => {
this.setState({ isRenders: false })
@ -568,6 +577,13 @@ class NewHeader extends Component {
document.head.appendChild(link);
}
getAppdata = () => {
try {
var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
// console.log("NewHeaderNewHeaderNewHeader");
// console.log(chromesettingArray);
// console.log(chromesettingresponseArray);
handleVisibleChanges = (boll) => {
this.setState({
@ -1248,8 +1264,6 @@ class NewHeader extends Component {
>
<i className="iconfont icon-xiaoxilingdang color-white"></i>
<span className="newslight" style={{ display: this.props.Headertop === undefined ? "none" : this.props.Headertop.new_message === true ? "block" : "none" }}>
{/*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*/}
{/*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*/}
</span>
</a>
}

@ -65,6 +65,14 @@
position: absolute;
width: 40px;
right: 39px;
top: 76px;
top: 77px;
z-index: 10;
}
.btn-join {
position: absolute;
width: 40px;
right: 39px;
top: 133px;
z-index: 10;
}
Loading…
Cancel
Save