调整题库

yslnewtiku
杨树林 5 years ago
parent b46aef7e98
commit fcf9fe3d89

@ -39,6 +39,7 @@ class Question extends Component {
visiblemyss:false,
item_type:null,
keyword:null,
timuid:null
}
}
@ -131,20 +132,23 @@ class Question extends Component {
this.container = container;
};
showmodels=()=>{
showmodels=(id)=>{
this.setState({
modalsType:true,
titilesm:"设为公开后,所有成员均可使用试题",
titiless:"是否设置为公开?",
titbool:false
titbool:true,
timuid:id
})
};
showmodelysl=()=>{
showmodelysl=(id)=>{
this.setState({
modalsType:true,
titilesm:"确认删除后,无法撤销",
titiless:"是否确认删除?",
titbool:false
titbool:false,
timuid:id
})
};
@ -156,6 +160,14 @@ class Question extends Component {
})
}
setDownload=()=>{
//确认
if(this.state.titbool===true){
//公开
this.publicopentimu(this.state.timuid);
}else {
// 删除
this.deletetimu(this.state.timuid);
}
this.setState({
modalsType:false
})
@ -246,6 +258,34 @@ class Question extends Component {
this.getdata(data);
}
deletetimu=(id)=>{
const url = `/item_banks/${id}.json`;
axios.delete(url)
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('删除试题成功')
// props.history.push(response.data.right_url)
}
})
.catch(function (error) {
console.log(error);
});
}
publicopentimu=(id)=>{
const url = `/item_banks/${id}/set_public.json`;
axios.post(url)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`公开题目成功`);
}
}).catch((error) => {
console.log(error);
})
}
render() {
let {page,limit,count,Headertop,visible,placement,modalsType}=this.state;
return (
@ -266,8 +306,8 @@ class Question extends Component {
setitem_types={(e)=>this.setitem_types(e)}
handleVisibleChange={(e)=>this.handleVisibleChange(e)}
setdifficulty={(e)=>this.setdifficulty(e)}
showmodels={()=>this.showmodels()}
showmodelysl={()=>this.showmodelysl()}
showmodels={(e)=>this.showmodels(e)}
showmodelysl={(e)=>this.showmodelysl(e)}
callback={(e)=>this.callback(e)}></Contentpart>
{/*分页*/}
{/*<div className="clearfix mt5">*/}

@ -181,7 +181,7 @@ class Contentpart extends Component {
<div className=" w100s">
{this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null? "" : this.props.Contentdata.items.map((object, index) => {
return (
<Listjihe {...this.state} {...this.props} items={object} showmodels={()=>this.props.showmodels()} showmodelysl={()=>this.props.showmodelysl()}>
<Listjihe {...this.state} {...this.props} items={object} showmodels={(e)=>this.props.showmodels(e)} showmodelysl={(e)=>this.props.showmodelysl(e)}>
</Listjihe>
)

@ -7,6 +7,7 @@ import {
Spin,
Table,
Pagination,
Radio
} from "antd";
import './../questioncss/questioncom.css';
const tagArray = [
@ -43,6 +44,7 @@ class Listjihe extends Component {
}
render() {
let {page,name,nd,chakanjiexibool}=this.state;
let {defaultActiveKey,items}=this.props;
@ -66,16 +68,30 @@ class Listjihe extends Component {
{/*内容*/}
<div className="w100s sortinxdirection">
<p className="w100s listjihetixingstits sortinxdirection">
{items === undefined ||items === null? "" : items.choices.map((object, index) => {
return (
<p className="sortinxdirection ml10">
{tagArray[index]}
{
object.choice_text
}
</p>
)
})}
{
items.item_type==="JUDGMENT"?
items === undefined ||items === null? "" : items.choices.map((object, index) => {
return (
<p className="sortinxdirection ml10">
<Radio checked={object.is_answer}>{
object.choice_text
}</Radio>
</p>
)
})
:
items === undefined ||items === null? "" : items.choices.map((object, index) => {
return (
<p className="sortinxdirection ml10">
{tagArray[index]}
{
object.choice_text
}
</p>
)
})
}
</p>
</div>
@ -92,7 +108,7 @@ class Listjihe extends Component {
{
defaultActiveKey===0||defaultActiveKey==="0"?
<div className="xaxisreverseorder">
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodelysl()}>
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodelysl(items.id)}>
<i className="iconfont icon-shanchu1 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>删除</span>
</p>
@ -100,7 +116,7 @@ class Listjihe extends Component {
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span>
</p>
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodels()}>
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span>
</p>

@ -232,7 +232,7 @@ body>.-task-title {
}
.myrigthsiderbar{
right: 250px !important;
right: 340px !important;
}
.feedbackdivcolor{

Loading…
Cancel
Save