课堂加入

video_transcode
harry 5 years ago
parent 9698cc1334
commit dac42f3c7d

@ -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,16 +1,15 @@
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,Tooltip} 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 Pagination from '@icedesign/base/lib/pagination'; import '../../tpm/shixuns/shixun-keyword-list.scss';
import '@icedesign/base/lib/pagination/style.js'; import btnNew from './btn-new.png'
import btnJoin from './btn-join.png'
const Search = Input.Search;
class CoursesHome extends Component { class CoursesHome extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -120,8 +119,9 @@ class CoursesHome extends Component{
} }
render() { render() {
let { order,search,page,coursesHomelist }=this.state; const { order, page, coursesHomelist } = this.state;
//console.log(this.props) const { user, tojoinclass } = this.props
console.log(tojoinclass, '--------------s')
return ( return (
<div> <div>
{this.state.updata === undefined ? "" : <UpgradeModals {this.state.updata === undefined ? "" : <UpgradeModals
@ -152,28 +152,19 @@ class CoursesHome extends Component{
</div> </div>
</div> </div>
<div className="mt20 educontent mb20 clearfix"> <div className="wrapper">
{/*<a className={ order == "all" ? "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("all")}>全部</a>*/} <div className="btn-groups">
{/*<a className={ order == "mine" ? "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("mine")}>我的</a>*/} <a id='hot' className={order === 'visits' ? 'active' : ''} onClick={() => this.changeStatus("visits")} title='最热'>最热</a>
<a className={ order == "created_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} </div>
onClick={ () => this.changeStatus("created_at")}>最新</a> </div>
<a className={ order == "visits" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} {user && user.user_identity !== '学生' ?
onClick={ () => this.changeStatus("visits")}>最热</a> <Fragment>
{this.props.user&&this.props.user.user_identity==="学生"?"":<span className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/courses/new")}>+新建教学课堂</span>} <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>
{/*<div className="fr mr5 search-new">*/} </Fragment> : null
{/*/!* <Search*/} }
{/*placeholder="课堂名称/教师姓名/学校名称"*/}
{/*id="subject_search_input"*/}
{/*value={search}*/}
{/*onInput={this.inputSearchValue}*/}
{/*onSearch={this.searchValue}*/}
{/*autoComplete="off"*/}
{/*></Search> *!/*/}
{/*</div>*/}
</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

@ -1,25 +1,18 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { Redirect } from 'react-router';
import AccountProfile from "../user/AccountProfile"; import AccountProfile from "../user/AccountProfile";
import PropTypes from 'prop-types';
import Certifiedprofessional from "../../modules/modals/Certifiedprofessional" import Certifiedprofessional from "../../modules/modals/Certifiedprofessional"
// import searchImg from '../../../../images/educoder/icon/search.svg' import { getImageUrl } from 'educoder'
// /images/educoder/icon/search.svg
import { getImageUrl, toPath ,trigger,broadcastChannelPostMessage} from 'educoder'
import axios from 'axios'; import axios from 'axios';
import { Modal,Checkbox ,Radio,Input,message,notification,Popover} from 'antd'; import { Modal, Radio, Input, message, notification } from 'antd';
import Addcourses from '../courses/coursesPublic/Addcourses'; import Addcourses from '../courses/coursesPublic/Addcourses';
import LoginDialog from '../login/LoginDialog'; import LoginDialog from '../login/LoginDialog';
import Trialapplication from '../login/Trialapplication';
import GotoQQgroup from '../../modal/GotoQQgroup' import GotoQQgroup from '../../modal/GotoQQgroup'
@ -121,44 +114,6 @@ class NewHeader extends Component {
} catch (e) { } catch (e) {
} }
// axios.interceptors.response.use((response) => {
// if (response != undefined)
// if (response && response.data.status === -1) {
// if (response.data.message === "该课堂要求成员完成实名认证") {
//
// } else if (response.data.message === "该课堂要求成员完成职业认证") {
// console.log("该课堂要求成员完成职业认证");
// this.HideAddcoursestypess(2);
//
//
//
// return
// } else if (response.data.message === "该课堂要求成员完成实名和职业认证") {
// console.log("该课堂要求成员完成实名和职业认证");
// this.HideAddcoursestypess(3);
// return
//
// }
// }
// return response;
// }, (error) => {
//
// });
}
componentDidUpdate = (prevProps) => {
// if(prevProps.user!=this.props.user){
// // console.log("216")
// // console.log(prevProps.user);
// // console.log(this.props.user);
// if(this.props.user !== undefined){
// this.setState({
// user_phone_binded :this.props.user.user_phone_binded,
// })
// }
//
//
// }
} }
openNotification = (messge) => { openNotification = (messge) => {
@ -204,9 +159,6 @@ class NewHeader extends Component {
this.setState({ this.setState({
user: undefined user: undefined
}) })
// let path="/";
// this.props.history.push(path);
// broadcastChannelPostMessage('refreshPage')
window.location.href = "/login" window.location.href = "/login"
message.success('退出成功'); message.success('退出成功');
} }
@ -341,38 +293,12 @@ class NewHeader extends Component {
this.setState({ this.setState({
isRender: true isRender: true
}) })
// var url = `/accounts/logout.json`;
//
// axios.get((url)).then((result) => {
// if(result!==undefined){
// // this.setState({
// // isRender:true
// // })
// window.location.href = "/";
// }
// }).catch((error) => {
// console.log(error);
// })
} }
educoderloginysl = () => { educoderloginysl = () => {
//退出账号
// this.setState({
// isRender:true
// })
// let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'
// let shixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess'
// let openopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype'
var url = `/accounts/logout.json`; var url = `/accounts/logout.json`;
// let storage=window.localStorage;
axios.get((url)).then((result) => { axios.get((url)).then((result) => {
// storage.removeItem(newTPMsettings);
// storage.removeItem(shixunopenprocess);
// storage.removeItem( openopenpublictype);
if (result !== undefined) { if (result !== undefined) {
// this.setState({
// isRender:true
// })
// broadcastChannelPostMessage('refreshPage')
window.location.href = "/"; window.location.href = "/";
} }
}).catch((error) => { }).catch((error) => {
@ -477,58 +403,9 @@ submittojoinclass=(value)=>{
return return
} }
// if(value===0){
// let url="/courses/join_course_multi_role.json"
// const form = new FormData();
// form.append('invite_code', tojoinclasstitle);
// form.append('role', pamst);
// form.append('type', 1);
// axios.post(url,form,[true]
// ).then((response) => {
// if( response.data.state===0){
// this.submitstatevalue(0,"加入成功",response.data.course_id)
// }else if( response.data.state===1){
// }else if( response.data.state===2){
// this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)")
// }else if( response.data.state===3){
// this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id)
// }else if( response.data.state===4){
// this.submitstatevalue( 0,"您输入的邀请码错误)")
// }else if( response.data.state===5){
// this.submitstatevalue( 0,"您还未登录")
// }else if( response.data.state===6){
// this.submitstatevalue( 0,"申请已提交,请等待审核")
// }else if( response.data.state===7){
// this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待")
// }else if( response.data.state===8){
// this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id)
// }else if( response.data.state==9){
// this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id)
// }else if( response.data.state==10){
// this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id)
// }else if( response.data.state==11){
// this.submitstatevalue(0," 该课堂已归档,请联系老师")
// }else if( response.data.state==12){
// this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师")
// }else if( response.data.state==13){
// this.submitstatevalue(0,"您申请已提交,请等待审核")
// }else if( response.data.state==14){
// this.submitstatevalue("此邀请码已停用,请与老师联系")
// }else if( response.data.state==15){
// this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行")
// }else {
// this.submitstatevalue(0," 未知错误,请稍后再试")
// }
// })
//
// }
if (value === 1) { if (value === 1) {
let url = "/project_applies.json" let url = "/project_applies.json"
// const form = new FormData();
// form.append('code', tojoinclasstitle);
// form.append('role', RadioGroupvalue);
// form.append('type', 1);
axios.post(url, { axios.post(url, {
code: tojoinclasstitle, code: tojoinclasstitle,
role: RadioGroupvalue role: RadioGroupvalue
@ -558,15 +435,6 @@ submittojoinclass=(value)=>{
} }
this.hidetojoinclass() this.hidetojoinclass()
} }
// trialapplications =()=>{
// console.log("点击了")
// this.setState({
// isRenders: true,
// showTrial:true,
// })
// }
// 关闭 // 关闭
cancelModulationModels = () => { cancelModulationModels = () => {
this.setState({ isRenders: false }) this.setState({ isRenders: false })
@ -1404,8 +1272,6 @@ submittojoinclass=(value)=>{
> >
<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