From 9a5e99ed2dc2b048f619bd8ac2b2399f69bea272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 26 Dec 2019 09:41:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=A4=E9=94=80=E5=8A=9F=E8=83=BD=E5=AE=9E?= =?UTF-8?q?=E6=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 31 ++++++++++++++++++- .../modules/question/component/Contentpart.js | 6 +++- .../modules/question/component/Listjihe.js | 25 ++++++++++----- 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 1beb16c3a..795e9193c 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -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 { {/*头部*/} this.getitem_basketss(id)} selectallquestionsonthispage={()=>this.selectallquestionsonthispage()} getitem_baskets={(e)=>this.getitem_baskets(e)} setdatafuns={(e) => this.setdatafuns(e)} diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index c88e0f25d..1ef534a4d 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -181,7 +181,11 @@ class Contentpart extends Component {
{this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null? "" : this.props.Contentdata.items.map((object, index) => { return ( - this.props.getitem_baskets(e)} showmodels={(e)=>this.props.showmodels(e)} showmodelysl={(e)=>this.props.showmodelysl(e)}> + 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)}> ) diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index aba81e214..15231e83d 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -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 {

创建者:{items.author.name}

-

this.Selectingpracticaltraining(items.id)}> - - 选用

- -

this.Selectingpracticaltraining(items.id)}> - - 撤销

- + { + items.choosed===true? +

this.Selectingpracticaltrainings(items.id)}> + + 撤销

+ : +

this.Selectingpracticaltraining(items.id)}> + + 选用

+ } { defaultActiveKey===0||defaultActiveKey==="0"?