撤销功能实战

yslnewtiku
杨树林 5 years ago
parent 652392b8fa
commit 9a5e99ed2d

@ -347,7 +347,7 @@ class Question extends Component {
}
//选用
getitem_baskets=(data)=>{
//选用题型可以上传单个 或者多个题型
let url="/item_baskets.json";
@ -356,6 +356,34 @@ class Question extends Component {
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`选用成功`);
var data = {
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
};
this.getdata(data);
}
}).catch((error) => {
console.log(error);
})
}
// 撤销
getitem_basketss=(id)=>{
//选用题型可以上传单个 或者多个题型
let url=`/item_baskets/${id}.json`;
axios.delete(url)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`撤销成功`);
var data = {
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
};
this.getdata(data);
}
}).catch((error) => {
console.log(error);
@ -430,6 +458,7 @@ class Question extends Component {
<Headplugselection></Headplugselection>
{/*头部*/}
<Contentpart {...this.state} {...this.props}
getitem_basketss={(id)=>this.getitem_basketss(id)}
selectallquestionsonthispage={()=>this.selectallquestionsonthispage()}
getitem_baskets={(e)=>this.getitem_baskets(e)}
setdatafuns={(e) => this.setdatafuns(e)}

@ -181,7 +181,11 @@ 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} getitem_baskets={(e)=>this.props.getitem_baskets(e)} showmodels={(e)=>this.props.showmodels(e)} showmodelysl={(e)=>this.props.showmodelysl(e)}>
<Listjihe {...this.state} {...this.props} items={object}
getitem_basketss={(id)=>this.props.getitem_basketss(id)}
getitem_baskets={(e)=>this.props.getitem_baskets(e)}
showmodels={(e)=>this.props.showmodels(e)}
showmodelysl={(e)=>this.props.showmodelysl(e)}>
</Listjihe>
)

@ -43,12 +43,19 @@ class Listjihe extends Component {
}
}
//选用
Selectingpracticaltraining=(id)=>{
let data={
item_ids:[id]
}
this.props.getitem_baskets(data);
}
//撤销
Selectingpracticaltrainings=(id)=>{
this.props.getitem_basketss(id);
}
@ -111,14 +118,16 @@ class Listjihe extends Component {
<p className="updatetimes lh30 ml45">创建者{items.author.name}</p>
</div>
<div className="w50s xaxisreverseorder">
{
items.choosed===true?
<p className="selectionss xiaoshou" onClick={()=>this.Selectingpracticaltrainings(items.id)}>
<i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span>撤销</span></p>
:
<p className="selection xiaoshou" onClick={()=>this.Selectingpracticaltraining(items.id)}>
<i className="iconfont icon-tianjiadaohang font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span>选用</span></p>
<p className="selectionss xiaoshou" onClick={()=>this.Selectingpracticaltraining(items.id)}>
<i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span>撤销</span></p>
}
{
defaultActiveKey===0||defaultActiveKey==="0"?
<div className="xaxisreverseorder">

Loading…
Cancel
Save