分组作业题库发送和删除题

dev_aliyun_beta
杨树林 6 years ago
parent 69d0f5aaf7
commit a3bacbe24b

@ -8,6 +8,7 @@ import "../../../courses/css/Courses.css"
import "../../../courses/css/busyWork.css" import "../../../courses/css/busyWork.css"
import SendTopics from '../../../modals/SendTopics'; import SendTopics from '../../../modals/SendTopics';
import Modals from '../../../modals/Modals'; import Modals from '../../../modals/Modals';
import axios from 'axios';
class BanksMenu extends Component{ class BanksMenu extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -44,25 +45,33 @@ class BanksMenu extends Component{
Modalstype:true, Modalstype:true,
Modalstopval:"是否确认删除?", Modalstopval:"是否确认删除?",
ModalCancel:this.topicscancelmodel, ModalCancel:this.topicscancelmodel,
ModalSave:this.topicssavedelete(id,type), ModalSave:()=>this.topicssavedelete(id,type),
}) })
} }
topicssavedelete=(id,type)=>{ topicssavedelete=(id,type)=>{
console.log("删除了");
console.log(id);
console.log(type);
const url = `/question_banks/multi_delete.json`; const url = `/question_banks/multi_delete.json`;
axios.delete(url, { data: { axios.delete(url, { data: {
object_id: [id], object_id: [id],
object_type:type object_type:type
}}) }})
.then((response) => { .then((response) => {
if(response.data.status===0){ console.log(response);
this.props.showNotification(response.data.message) if(response){
window.location.href=`/users/${this.props.current_user.login}/topics/personal`; if(response.data){
}else{ if(response.data.status===0){
this.props.showNotification(response.data.message) this.props.showNotification(response.data.message)
window.location.href=`/users/${this.props.current_user.login}/topics/personal`;
}else{
this.props.showNotification(response.data.message)
}
}
} }
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
@ -71,9 +80,10 @@ class BanksMenu extends Component{
} }
render(){ render(){
let { banksMenu,visible } = this.props; let { banksMenu} = this.props;
let {visible}=this.state;
// console.log("问卷预览"); // console.log("问卷预览");
// console.log(banksMenu); // console.log(visible);
let user_id=this.props.current_user&&this.props.current_user.user_id; let user_id=this.props.current_user&&this.props.current_user.user_id;
let user_type=this.props.current_user&&this.props.current_user.user_identity; let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id; let targetuserid=this.props.data&&this.props.data.id;
@ -95,7 +105,7 @@ class BanksMenu extends Component{
{...this.props} {...this.props}
visible={visible} visible={visible}
category={banksMenu&&banksMenu.category} category={banksMenu&&banksMenu.category}
checkBoxValues={[banksMenu&&banksMenu.bankId]} checkBoxValues={[banksMenu&&banksMenu.id]}
topicscancelmodel={()=>this.topicscancelmodel()} topicscancelmodel={()=>this.topicscancelmodel()}
/>:"" />:""
} }
@ -115,7 +125,7 @@ class BanksMenu extends Component{
} }
<span className="fr mt18"> <span className="fr mt18">
<WordsBtn onClick={()=>this.deletecheckBoxValues()}style="blue" className="ml20 font-16">删除</WordsBtn> <WordsBtn onClick={()=>this.deletecheckBoxValues(banksMenu&&banksMenu.id,banksMenu&&banksMenu.category)}style="blue" className="ml20 font-16">删除</WordsBtn>
<WordsBtn to={banksMenu&&banksMenu.category==='poll'?banksMenu.tos:""} style="blue" className="ml20 font-16">编辑</WordsBtn> <WordsBtn to={banksMenu&&banksMenu.category==='poll'?banksMenu.tos:""} style="blue" className="ml20 font-16">编辑</WordsBtn>
<WordsBtn onClick={()=>this.sendTopics()} style="blue" className="ml20 font-16">发送</WordsBtn> <WordsBtn onClick={()=>this.sendTopics()} style="blue" className="ml20 font-16">发送</WordsBtn>
</span> </span>

Loading…
Cancel
Save