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

@ -1,158 +1,100 @@
import React,{ Component } from "react";
import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd";
import axios from 'axios';
import { SnackbarHOC } from 'educoder';
import Modals from './Modals';
const { Search } = Input;
class SendTopics extends Component{
constructor(props){
super(props);
this.state={
sentShixunPath:false,
sendToCourseList:undefined,
openSearch:false,
sendToCourseId:undefined,
sendToShixunArray:[],
Modalstype:false,
cardsModalcancel:this.cardsModalcancel,
cardsModalsave:this.cardsModalsave,
modalsTopval:'',
Modalsbottomval:'',
courseurl:''
courses:[],
search:null,
Radiolist:undefined,
showcheck:false
}
}
//发送至
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{
this.setState({
sendToCourseList:result.data,
sentShixunPath:true
})
componentDidMount(){
let{search}=this.state;
this.onupdatalist(search)
}
onupdatalist=(search)=>{
let url="/question_banks/my_courses.json";
axios.get(url,{params:{
search
}
}).catch((error)=>{
console.log(error);
})
// this.setState({
// sentShixunPath:true
// })
}
//隐藏发送至弹框
hideSenttothevalue =()=>{
}).then((result)=>{
this.setState({
sentShixunPath:false,
sendToShixunArray:[],
sendToCourseId:undefined,
courses:result.data.courses
})
this.props.topicscancelmodel()
}
//打开课堂列表下拉框
openList=()=>{
this.setState({
openSearch:true
}).catch((error)=>{
console.log(error);
})
}
//关闭课堂列表下拉框
closeList=()=>{
onSearchChange=(e)=>{
this.setState({
openSearch:false
search:e.target.value
})
// this.onupdatalist(e.target.value)
}
// 选择课堂获取选中的Id
selectCloseList=(e)=>{
this.setState({
openSearch:false,
sendToCourseId:e
})
onSearch=(search)=>{
this.onupdatalist(search)
}
//选择checkbox
changeCheckBoxs=(list)=>{
onChange=(e)=>{
this.setState({
sendToShixunArray:list,
// shixunNum:list.length
Radiolist:e.target.value
})
}
//确认提交
submitInfo=()=>{
let {sendToCourseId,sendToShixunArray}=this.state;
if(sendToCourseId===undefined){
this.props.showSnackbar("您还未选择发送的课堂");
}else if(parseInt(sendToShixunArray.length)==0){
this.props.showSnackbar("您还未选择实训");
}else{
let id=this.props.detailInfoList.id;
let url="/paths/"+id+"/send_to_course.json";
axios.post(url,{
shixun_ids:sendToShixunArray,
course_id:sendToCourseId
}).then((result)=>{
if(result.data.status===1){
let{Radiolist}=this.state;
let url=`/question_banks/send_to_course.json`;
let object_id=this.props.checkBoxValues;
let object_type=this.props.category;
if(Radiolist===undefined){
this.setState({
Modalstype:true,
sentShixunPath:false,
Modalstopval:result.data.message,
courseurl:result.data.url,
sendToShixunArray:[],
sendToCourseId:undefined,
showcheck:true
})
}else{
axios.post(url,{
object_id: object_id,
object_type:object_type,
course_id:Radiolist
}
).then((result)=>{
if(result.data.status===0){
this.props.updataslist()
this.props.topicscancelmodel()
this.props.showNotification(result.data.message)
}else{
this.props.showNotification(result.data.message)
}
}).catch((error)=>{
console.log(error);
console.log(error)
})
}
}
componentDidMount(){
// let id=this.props.detailInfoList.id;
// let url="/paths/"+id+"/choose_course.json";
// axios.get(url).then((result)=>{
// if(result.status==200){
// this.setState({
// sendToCourseList:result.data
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
}
cardsModalcancel=()=>{
this.setState({
Modalstype:false,
})
}
cardsModalsave=()=>{
let {courseurl}=this.state;
window.location.href =courseurl;
}
render(){
let{courses,Radiolist,showcheck}= this.state;
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
};
render(){
let{sentShixunPath,sendToCourseList,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state;
return(
<div>
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalsBottomval={Modalsbottomval}
modalCancel={cardsModalcancel}
modalSave={cardsModalsave}
>
</Modals>
<style>
{
`
@ -164,6 +106,7 @@ class SendTopics extends Component{
}
.over221{
height:221px;
overflow-y: auto;
}
`
}
@ -192,26 +135,25 @@ class SendTopics extends Component{
></Search>
</div>
<div className="edu-back-skyblue pl15 pr15 clearfix over221 pt5">
<Radio.Group onChange={this.onChange} value={Radiolist}>
{
sendToCourseList && sendToCourseList.stages.map((item,key)=>{
return(
item.shixuns.map((items,keys)=>{
courses && courses.map((item,key)=>{
return(
<div className="mt5" key={keys}>
<Checkbox name={key} value={items.shixun_id} key={items.shixun_id}>{items.shixun_name}</Checkbox>
<div className="mt5" key={key}>
<Radio style={radioStyle} value={item.course_id} key={item.course_id}>
{item.course_name}
</Radio>
</div>
)
})
)
})
}
</div>
</Radio.Group>
</div>
{showcheck===true?<div className={"color-red mt10"}>请先选择课堂</div>:""}
<div className="mt20 clearfix edu-txt-center">
<a onClick={this.hideSenttothevalue} className="pop_close task-btn mr30">取消</a>
<a className="task-btn task-btn-orange" onClick={this.submitInfo}>确定</a>
<a onClick={()=>this.props.topicscancelmodel()} className="pop_close task-btn mr30">取消</a>
<a className="task-btn task-btn-orange" onClick={()=>this.submitInfo()}>确定</a>
</div>
</div>
</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 NoneData from '../../courses/coursesPublic/NoneData';
import "./usersInfo.css";
import Withoutpermission from './Withoutpermission.png';
@ -24,13 +25,24 @@ class InfosTopics extends Component{
page:1,
data:undefined,
checkBoxValues:[],
per_page:15
per_page:15,
isshowprofes:false
}
}
componentDidMount(){
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=()=>{
let types=this.props.match.params.topicstype;
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
@ -211,10 +223,16 @@ class InfosTopics extends Component{
sendTopics=()=>{
let {checkBoxValues}=this.state;
if(checkBoxValues.length===0){
this.props.showNotification("请选择题库")
}else{
this.setState({
visible:true
})
}
}
render(){
let{
category,
@ -226,7 +244,8 @@ class InfosTopics extends Component{
sort_by,
checkBoxValues,
Modalstype,
visible
visible,
isshowprofes
} = this.state;
let categorylist=[
@ -240,7 +259,7 @@ class InfosTopics extends Component{
let types=this.props.match.params.topicstype;
console.log(Modalstype)
console.log(isshowprofes)
//types===publicly 公共
//types===personal 私有
@ -276,7 +295,10 @@ class InfosTopics extends Component{
{
visible&&visible===true?
<SendTopics
{...this.state}
{...this.props}
visible={visible}
updataslist={()=>this.updataslist()}
topicscancelmodel={()=>this.topicscancelmodel()}
/>:""
}
@ -320,15 +342,25 @@ class InfosTopics extends Component{
<Spin size="large" spinning={isSpin}>
<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"}
href={`/users/innov/topics/personal`}>我的题库</a>
<a className={types==="publicly"?"topicstopfont fr topcsactive":"topicstopfont fr"}
href={`/users/innov/topics/publicly`}
>公共题库</a>
</div>
</div>}
{isshowprofes===false?
<div>
<div className={"topcsmid"}>
{categorylist.map((item,key)=>{
return(
@ -349,11 +381,26 @@ class InfosTopics extends Component{
</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 className="clearfix font-12 mt20">
{isshowprofes===false?<div className="clearfix font-12 mt20">
<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>
</p>
<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>:""}
{types==="personal"?user_id===targetuserid&&user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.deletecheckBoxValues()}>删除</span>:"":""}
</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}>
{data.question_banks.map((item,key)=>{
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">
<Pagination showQuickJumper total={data&&data.count} onChange={this.changePage} pageSize={15} current={page}/>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

@ -360,3 +360,24 @@
width: 100px;
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