From af26a97137c82b98d1d2cba672f02d4fd873f916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 19 Feb 2020 17:10:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/question/Paperreview_item.js | 152 ++++++++++++------ 1 file changed, 107 insertions(+), 45 deletions(-) diff --git a/public/react/src/modules/question/Paperreview_item.js b/public/react/src/modules/question/Paperreview_item.js index fa68ce34e..09dddcfb6 100644 --- a/public/react/src/modules/question/Paperreview_item.js +++ b/public/react/src/modules/question/Paperreview_item.js @@ -176,22 +176,43 @@ class Paperreview_item extends Component { } setDownloady = (fenshu) => { - const url = "/item_baskets/batch_set_score.json"; - var data = { - score: fenshu, - item_type: this.state.titilesm === "单选题" ? "SINGLE" : this.state.titilesm === "多选题" ? "MULTIPLE" : this.state.titilesm === "判断题" ? "JUDGMENT" : this.state.titilesm === "编程题" ? "PROGRAM" : '', - + if(this.props.match.params.type==="Intelligence") { + //智能选题 + const url = "/item_baskets/batch_set_score.json"; + var data = { + score: fenshu, + item_type: this.state.titilesm === "单选题" ? "SINGLE" : this.state.titilesm === "多选题" ? "MULTIPLE" : this.state.titilesm === "判断题" ? "JUDGMENT" : this.state.titilesm === "编程题" ? "PROGRAM" : '', + exam_setting_id:this.props.match.params.id, + } + axios.post(url, data) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`调分成功`); + this.props.getdata({}); + this.Singlemagazine("", false); + } + }).catch((error) => { + //console.log(error); + }) + }else{ + const url = "/item_baskets/batch_set_score.json"; + var data = { + score: fenshu, + item_type: this.state.titilesm === "单选题" ? "SINGLE" : this.state.titilesm === "多选题" ? "MULTIPLE" : this.state.titilesm === "判断题" ? "JUDGMENT" : this.state.titilesm === "编程题" ? "PROGRAM" : '', + + } + axios.post(url, data) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`调分成功`); + this.props.getdata({}); + this.Singlemagazine("", false); + } + }).catch((error) => { + //console.log(error); + }) } - axios.post(url, data) - .then((result) => { - if (result.data.status == 0) { - // this.props.showNotification(`调分成功`); - this.props.getdata({}); - this.Singlemagazine("", false); - } - }).catch((error) => { - //console.log(error); - }) + } setDownloadys=(value)=>{ @@ -239,24 +260,49 @@ class Paperreview_item extends Component { modalsTypedel: bool, titilesms: names }) - const url = `/item_baskets/delete_item_type.json`; - axios.delete((url), { - data: { - item_type: names - } - }) - .then((response) => { - if (response.data.status == 0) { - // this.props.showNotification('大题删除成功'); - this.props.getdata({}); - this.setState({ - titilesms: "" - }) - } - }) - .catch(function (error) { - ////console.log(error); - }); + if(this.props.match.params.type==="Intelligence") { + //智能组卷 + const url = `/item_baskets/delete_item_type.json`; + axios.delete((url), { + data: { + item_type: names, + exam_setting_id:this.props.match.params.id, + } + }) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('大题删除成功'); + this.props.getdata({}); + this.setState({ + titilesms: "" + }) + } + }) + .catch(function (error) { + ////console.log(error); + }); + + }else{ + const url = `/item_baskets/delete_item_type.json`; + axios.delete((url), { + data: { + item_type: names + } + }) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('大题删除成功'); + this.props.getdata({}); + this.setState({ + titilesms: "" + }) + } + }) + .catch(function (error) { + ////console.log(error); + }); + } + @@ -271,19 +317,35 @@ class Paperreview_item extends Component { }) }else { //确定 - const url = `/item_baskets/${this.state.item_bank_id}.json`; - axios.delete(url, { data: { - exam_setting_id: this.props.match.params.id, - }}) - .then((response) => { - if (response.data.status == 0) { - // this.props.showNotification('试题删除成功'); - this.props.getdata({}); - } - }) - .catch(function (error) { + if(this.props.match.params.type==="Intelligence"){ + //智能组卷 + const url = `/item_baskets/${this.state.item_bank_id}.json`; + axios.delete(url, { data: { + exam_setting_id: this.props.match.params.id, + }}) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('试题删除成功'); + this.props.getdata({}); + } + }) + .catch(function (error) { + + }); + }else{ + const url = `/item_baskets/${this.state.item_bank_id}.json`; + axios.delete(url) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('试题删除成功'); + this.props.getdata({}); + } + }) + .catch(function (error) { + + }); + } - }); this.setState({ modalsTypedels: bool,