dev_aliyun_beta
杨树明 5 years ago
parent 62447ca824
commit bdf284f556

@ -1,158 +1,100 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd"; import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd";
import axios from 'axios'; import axios from 'axios';
import { SnackbarHOC } from 'educoder';
import Modals from './Modals';
const { Search } = Input; const { Search } = Input;
class SendTopics extends Component{ class SendTopics extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
sentShixunPath:false, courses:[],
sendToCourseList:undefined, search:null,
openSearch:false, Radiolist:undefined,
sendToCourseId:undefined, showcheck:false
sendToShixunArray:[],
Modalstype:false,
cardsModalcancel:this.cardsModalcancel,
cardsModalsave:this.cardsModalsave,
modalsTopval:'',
Modalsbottomval:'',
courseurl:''
} }
} }
//发送至
SentToLesson =() =>{
let id=this.props.detailInfoList.id;
let url="/paths/"+id+"/choose_course.json";
axios.get(url).then((result)=>{
if(result.status==200){
if (result.data.status === 403||result.data.status === 402||result.data.status === 407||result.data.status === 408) {
}else{ componentDidMount(){
this.setState({ let{search}=this.state;
sendToCourseList:result.data, this.onupdatalist(search)
sentShixunPath:true }
})
}
onupdatalist=(search)=>{
let url="/question_banks/my_courses.json";
axios.get(url,{params:{
search
} }
}).then((result)=>{
this.setState({
courses:result.data.courses
})
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
// this.setState({ }
// sentShixunPath:true
// })
}
//隐藏发送至弹框
hideSenttothevalue =()=>{
this.setState({
sentShixunPath:false,
sendToShixunArray:[],
sendToCourseId:undefined,
})
this.props.topicscancelmodel()
}
//打开课堂列表下拉框
openList=()=>{
this.setState({
openSearch:true
})
}
//关闭课堂列表下拉框
closeList=()=>{
this.setState({
openSearch:false
})
}
// 选择课堂获取选中的Id
selectCloseList=(e)=>{
this.setState({
openSearch:false,
sendToCourseId:e
})
}
//选择checkbox onSearchChange=(e)=>{
changeCheckBoxs=(list)=>{ this.setState({
this.setState({ search:e.target.value
sendToShixunArray:list, })
// shixunNum:list.length // this.onupdatalist(e.target.value)
}) }
}
onSearch=(search)=>{
//确认提交 this.onupdatalist(search)
submitInfo=()=>{ }
let {sendToCourseId,sendToShixunArray}=this.state;
if(sendToCourseId===undefined){
this.props.showSnackbar("您还未选择发送的课堂"); onChange=(e)=>{
}else if(parseInt(sendToShixunArray.length)==0){ this.setState({
this.props.showSnackbar("您还未选择实训"); Radiolist:e.target.value
}else{ })
let id=this.props.detailInfoList.id; }
let url="/paths/"+id+"/send_to_course.json";
axios.post(url,{ submitInfo=()=>{
shixun_ids:sendToShixunArray, let{Radiolist}=this.state;
course_id:sendToCourseId let url=`/question_banks/send_to_course.json`;
}).then((result)=>{ let object_id=this.props.checkBoxValues;
if(result.data.status===1){ let object_type=this.props.category;
this.setState({ if(Radiolist===undefined){
Modalstype:true, this.setState({
sentShixunPath:false, showcheck:true
Modalstopval:result.data.message, })
courseurl:result.data.url, }else{
sendToShixunArray:[], axios.post(url,{
sendToCourseId:undefined, object_id: object_id,
}) object_type:object_type,
} course_id:Radiolist
}).catch((error)=>{ }
console.log(error); ).then((result)=>{
}) if(result.data.status===0){
} this.props.updataslist()
} this.props.topicscancelmodel()
this.props.showNotification(result.data.message)
componentDidMount(){ }else{
// let id=this.props.detailInfoList.id; this.props.showNotification(result.data.message)
// let url="/paths/"+id+"/choose_course.json"; }
// axios.get(url).then((result)=>{ }).catch((error)=>{
// if(result.status==200){ console.log(error)
// this.setState({ })
// sendToCourseList:result.data }
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
}
cardsModalcancel=()=>{ }
this.setState({ render(){
Modalstype:false, let{courses,Radiolist,showcheck}= this.state;
})
}
cardsModalsave=()=>{
let {courseurl}=this.state;
window.location.href =courseurl;
}
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
};
render(){
let{sentShixunPath,sendToCourseList,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state;
return( return(
<div> <div>
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalsBottomval={Modalsbottomval}
modalCancel={cardsModalcancel}
modalSave={cardsModalsave}
>
</Modals>
<style> <style>
{ {
` `
@ -164,6 +106,7 @@ class SendTopics extends Component{
} }
.over221{ .over221{
height:221px; height:221px;
overflow-y: auto;
} }
` `
} }
@ -192,26 +135,25 @@ class SendTopics extends Component{
></Search> ></Search>
</div> </div>
<div className="edu-back-skyblue pl15 pr15 clearfix over221 pt5"> <div className="edu-back-skyblue pl15 pr15 clearfix over221 pt5">
<Radio.Group onChange={this.onChange} value={Radiolist}>
{
courses && courses.map((item,key)=>{
return(
<div className="mt5" key={key}>
<Radio style={radioStyle} value={item.course_id} key={item.course_id}>
{item.course_name}
</Radio>
</div>
)
})
}
</Radio.Group>
{
sendToCourseList && sendToCourseList.stages.map((item,key)=>{
return(
item.shixuns.map((items,keys)=>{
return(
<div className="mt5" key={keys}>
<Checkbox name={key} value={items.shixun_id} key={items.shixun_id}>{items.shixun_name}</Checkbox>
</div>
)
})
)
})
}
</div> </div>
{showcheck===true?<div className={"color-red mt10"}>请先选择课堂</div>:""}
<div className="mt20 clearfix edu-txt-center"> <div className="mt20 clearfix edu-txt-center">
<a onClick={this.hideSenttothevalue} className="pop_close task-btn mr30">取消</a> <a onClick={()=>this.props.topicscancelmodel()} className="pop_close task-btn mr30">取消</a>
<a className="task-btn task-btn-orange" onClick={this.submitInfo}>确定</a> <a className="task-btn task-btn-orange" onClick={()=>this.submitInfo()}>确定</a>
</div> </div>
</div> </div>
</Modal> </Modal>
@ -220,4 +162,4 @@ class SendTopics extends Component{
} }
} }
export default SnackbarHOC()(SendTopics); export default SendTopics;

@ -9,6 +9,7 @@ import Modals from '../../modals/Modals';
import SendTopics from '../../modals/SendTopics' import SendTopics from '../../modals/SendTopics'
import NoneData from '../../courses/coursesPublic/NoneData'; import NoneData from '../../courses/coursesPublic/NoneData';
import "./usersInfo.css"; import "./usersInfo.css";
import Withoutpermission from './Withoutpermission.png';
@ -24,12 +25,23 @@ class InfosTopics extends Component{
page:1, page:1,
data:undefined, data:undefined,
checkBoxValues:[], checkBoxValues:[],
per_page:15 per_page:15,
isshowprofes:false
} }
} }
componentDidMount(){ componentDidMount(){
this.updataslist() let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
console.log(professional_certification)
if(professional_certification===false&&types==="publicly"){
this.setState({
isshowprofes:true
})
}else{
this.updataslist()
}
} }
updataslist=()=>{ updataslist=()=>{
let types=this.props.match.params.topicstype; let types=this.props.match.params.topicstype;
@ -211,9 +223,15 @@ class InfosTopics extends Component{
sendTopics=()=>{ sendTopics=()=>{
this.setState({ let {checkBoxValues}=this.state;
visible:true if(checkBoxValues.length===0){
}) this.props.showNotification("请选择题库")
}else{
this.setState({
visible:true
})
}
} }
render(){ render(){
let{ let{
@ -226,7 +244,8 @@ class InfosTopics extends Component{
sort_by, sort_by,
checkBoxValues, checkBoxValues,
Modalstype, Modalstype,
visible visible,
isshowprofes
} = this.state; } = this.state;
let categorylist=[ let categorylist=[
@ -240,7 +259,7 @@ class InfosTopics extends Component{
let types=this.props.match.params.topicstype; let types=this.props.match.params.topicstype;
console.log(Modalstype) console.log(isshowprofes)
//types===publicly 公共 //types===publicly 公共
//types===personal 私有 //types===personal 私有
@ -276,7 +295,10 @@ class InfosTopics extends Component{
{ {
visible&&visible===true? visible&&visible===true?
<SendTopics <SendTopics
{...this.state}
{...this.props}
visible={visible} visible={visible}
updataslist={()=>this.updataslist()}
topicscancelmodel={()=>this.topicscancelmodel()} topicscancelmodel={()=>this.topicscancelmodel()}
/>:"" />:""
} }
@ -320,40 +342,65 @@ class InfosTopics extends Component{
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>
<div className="clearfix topicsbox"> <div className="clearfix topicsbox">
<div className={"topcschild"}> {types==="publicly"?<div className={"topcschild"}>
<a className={types==="personal"?"topicstopfont fr topcsactive":"topicstopfont fr"}
href={`/users/innov/topics/personal`}>个人题库</a>
<a className={types==="publicly"?"topicstopfont fl topcsactive":"topicstopfont fl"}
href={`/users/innov/topics/publicly`}
>公共题库</a>
</div>:<div className={"topcschild"}>
<a className={types==="personal"?"topicstopfont fl topcsactive":"topicstopfont fl"} <a className={types==="personal"?"topicstopfont fl topcsactive":"topicstopfont fl"}
href={`/users/innov/topics/personal`}>我的题库</a> href={`/users/innov/topics/personal`}>我的题库</a>
<a className={types==="publicly"?"topicstopfont fr topcsactive":"topicstopfont fr"} <a className={types==="publicly"?"topicstopfont fr topcsactive":"topicstopfont fr"}
href={`/users/innov/topics/publicly`} href={`/users/innov/topics/publicly`}
>公共题库</a> >公共题库</a>
</div> </div>}
<div className={"topcsmid"}>
{categorylist.map((item,key)=>{
return(
<span key={key} className={category===item.type?"topicsmidfont fl mr38 topcsactive":"topicsmidfont fl mr38"} onClick={()=>this.searchCategory(item.type)}>{item.val}</span>
)
})}
</div> {isshowprofes===false?
<div>
<div className={"shaiContent"}> <div className={"topcsmid"}>
<div className="fl pr topicsItem pagetype mb20"> {categorylist.map((item,key)=>{
<li className={course_list_id===undefined?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} onClick={()=>this.searchCourselistid(undefined)}>全部</li>
{data===undefined?"":data.course_list===undefined||data.course_list.length===0?"":data.course_list.map((item,key)=>{
return( return(
<li key={key} className={course_list_id===item.id?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} onClick={()=>this.searchCourselistid(item.id)}>{item.name}</li> <span key={key} className={category===item.type?"topicsmidfont fl mr38 topcsactive":"topicsmidfont fl mr38"} onClick={()=>this.searchCategory(item.type)}>{item.val}</span>
) )
})} })}
</div> </div>
</div>
<div className={"shaiContent"}>
<div className="fl pr topicsItem pagetype mb20">
<li className={course_list_id===undefined?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} onClick={()=>this.searchCourselistid(undefined)}>全部</li>
{data===undefined?"":data.course_list===undefined||data.course_list.length===0?"":data.course_list.map((item,key)=>{
return(
<li key={key} className={course_list_id===item.id?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} onClick={()=>this.searchCourselistid(item.id)}>{item.name}</li>
)
})}
</div>
</div>
</div>:<div className={"professional_certificationbox"}>
<p className="clearfix ">
<div className={"stud-class-set pd115200 coursenavbox edu-back-white"}>
<div className={"sumbtongs mb10"}><img className={"topicsItemimg"} src={Withoutpermission}/></div>
<div className={"terraces mb5 topicsItemfont"}>通过职业认证的教师才能访问公共题库</div>
<div className="clearfix mt30 mb30 padding251">
<a className="defalutSubmitbtn fl ml60 defalutSubmitbtns" target="_blank" href="/account/certification">立即认证</a>
</div>
</div>
</p>
</div>}
</div> </div>
<div className="clearfix font-12 mt20"> {isshowprofes===false?<div className="clearfix font-12 mt20">
<p className="font-12 alltopisc ml25 fl"> <p className="font-12 alltopisc ml25 fl">
<span className="fl color-grey-9"> <span className={"color-orange"}>{data&&data.count}</span> </span> <span className="fl color-grey-9"> <span className={"color-orange"}>{data&&data.count===undefined?0:data&&data.count}</span> </span>
<span className="fr color-grey-9">已选择 <span className={"color-orange"}>{checkBoxValues.length}</span> ()</span> <span className="fr color-grey-9">已选择 <span className={"color-orange"}>{checkBoxValues.length}</span> ()</span>
</p> </p>
<p className="font-12 alltopiscright ml25 fr"> <p className="font-12 alltopiscright ml25 fr">
@ -371,10 +418,10 @@ class InfosTopics extends Component{
{user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.sendTopics()}>发送</span>:""} {user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.sendTopics()}>发送</span>:""}
{types==="personal"?user_id===targetuserid&&user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.deletecheckBoxValues()}>删除</span>:"":""} {types==="personal"?user_id===targetuserid&&user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.deletecheckBoxValues()}>删除</span>:"":""}
</p> </p>
</div> </div>:""}
{data===undefined?<NoneData></NoneData>:data.question_banks===undefined||data.question_banks.length===0?<NoneData></NoneData>: {isshowprofes===true?"":data===undefined?<NoneData></NoneData>:data.question_banks===undefined||data.question_banks.length===0?<NoneData></NoneData>:
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}> <Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{data.question_banks.map((item,key)=>{ {data.question_banks.map((item,key)=>{
return( return(
@ -417,7 +464,7 @@ class InfosTopics extends Component{
} }
{ {
data&&data.count >15 && isshowprofes===true?"":data&&data.count >15 &&
<div className="mt30 mb50 edu-txt-center"> <div className="mt30 mb50 edu-txt-center">
<Pagination showQuickJumper total={data&&data.count} onChange={this.changePage} pageSize={15} current={page}/> <Pagination showQuickJumper total={data&&data.count} onChange={this.changePage} pageSize={15} current={page}/>
</div> </div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

@ -360,3 +360,24 @@
width: 100px; width: 100px;
display: inline-block; display: inline-block;
} }
.professional_certificationbox{
height:431px;
background:rgba(255,255,255,1);
}
.pd115200{
padding: 55px 200px 0px 200px;
}
.topicsItemimg{
width:150px;
}
.topicsItemfont{
font-size: 18px;
font-family: PingFang-SC;
font-weight: 400;
color: rgba(51,51,51,1);
line-height: 35px;
}
Loading…
Cancel
Save