课堂加入

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 { getImageUrl } from 'educoder';
import CoursesHomeCard from "./CoursesHomeCard.js" import CoursesHomeCard from "./CoursesHomeCard.js"
import axios from 'axios'; import axios from 'axios';
import { Input, Pagination } from 'antd'; import { Pagination } from 'antd';
import LoadingSpin from '../../../common/LoadingSpin'; import LoadingSpin from '../../../common/LoadingSpin';
import UpgradeModals from '../../modals/UpgradeModals'; import UpgradeModals from '../../modals/UpgradeModals';
import './css/CoursesHome.css'; 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 { class CoursesHome extends Component {
constructor(props) { constructor(props) {
@ -51,7 +54,7 @@ class CoursesHome extends Component {
} }
componentDidMount() { componentDidMount() {
document.title = "翻转课堂"; document.title = "教学课堂";
const upsystem = `/users/system_update.json`; const upsystem = `/users/system_update.json`;
axios.get(upsystem).then((response) => { axios.get(upsystem).then((response) => {
let updata = response.data; let updata = response.data;
@ -116,7 +119,9 @@ class CoursesHome extends Component {
} }
render() { render() {
let { order, search, page, coursesHomelist } = this.state; const { order, page, coursesHomelist } = this.state;
const { user, tojoinclass } = this.props
console.log(tojoinclass, '--------------s')
return ( return (
<div> <div>
{this.state.updata === undefined ? "" : <UpgradeModals {this.state.updata === undefined ? "" : <UpgradeModals
@ -125,7 +130,9 @@ class CoursesHome extends Component {
<div className="newMain clearfix"> <div className="newMain clearfix">
<style> <style>
{ {
` ` ::-webkit-scrollbar {
width: 0px !important;
}
.courses-head{ .courses-head{
width: 100%; width: 100%;
height: 300px; height: 300px;
@ -145,13 +152,19 @@ class CoursesHome extends Component {
</div> </div>
</div> </div>
<div className="mt20 educontent mb20 clearfix"> <div className="wrapper">
<a className={order == "created_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} <div className="educontent search-keyword-container" style={{ padding: '20px 0 0 0' }}>
onClick={() => this.changeStatus("created_at")}>最新</a> <div className="btn-groups">
<a className={order == "visits" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} <a id='new' className={order === 'created_at' ? 'active' : ''} onClick={() => this.changeStatus("created_at")} title='最新'>最新</a>
onClick={() => this.changeStatus("visits")}>最热</a> <a id='hot' className={order === 'visits' ? 'active' : ''} onClick={() => this.changeStatus("visits")} title='最热'>最热</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>
</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> </div>
{coursesHomelist === undefined ? <LoadingSpin /> : <CoursesHomeCard {...this.props} {...this.state} {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 { Link } from "react-router-dom";
import AccountProfile from "../user/AccountProfile"; import AccountProfile from "../user/AccountProfile";
import Certifiedprofessional from "../../modules/modals/Certifiedprofessional" import Certifiedprofessional from "../../modules/modals/Certifiedprofessional"
import { getImageUrl } from 'educoder' import { getImageUrl } from 'educoder'
import axios from 'axios'; import axios from 'axios';
import { Modal, Radio, Input, message, notification } from 'antd'; import { Modal, Radio, Input, message, notification } from 'antd';
@ -100,9 +102,6 @@ class NewHeader extends Component {
} }
} }
componentDidUpdate = (prevProps) => {
}
openNotification = (messge) => { openNotification = (messge) => {
notification.open({ notification.open({
message: "提示", message: "提示",
@ -115,6 +114,9 @@ class NewHeader extends Component {
this.setState({ this.setState({
user: newProps.user user: newProps.user
}) })
if (newProps.Headertop != undefined) {
old_url = newProps.Headertop.old_url
}
} }
getCookie = (key) => { getCookie = (key) => {
@ -343,6 +345,14 @@ class NewHeader extends Component {
}) })
return return
} }
// }else if(value===0){
// if(tojoinclasstitle.length<5){
// this.setState({
// code_notice:true
// })
// return
// }
// }
if (tojoinclasstitle === "" || tojoinclasstitle === undefined) { if (tojoinclasstitle === "" || tojoinclasstitle === undefined) {
this.setState({ this.setState({
code_notice: true code_notice: true
@ -410,7 +420,6 @@ class NewHeader extends Component {
} }
this.hidetojoinclass() this.hidetojoinclass()
} }
// 关闭 // 关闭
cancelModulationModels = () => { cancelModulationModels = () => {
this.setState({ isRenders: false }) this.setState({ isRenders: false })
@ -568,6 +577,13 @@ class NewHeader extends Component {
document.head.appendChild(link); 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) => { handleVisibleChanges = (boll) => {
this.setState({ this.setState({
@ -1248,8 +1264,6 @@ class NewHeader extends Component {
> >
<i className="iconfont icon-xiaoxilingdang color-white"></i> <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" }}> <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> </span>
</a> </a>
} }

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