From 32c3078f79f942afad6728b843885b3bd1a655bc 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 16:10:52 +0800 Subject: [PATCH 001/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/testpaper/Testpaperlibrary.js | 4 ++-- public/react/src/modules/testpaper/component/Contentpart.js | 2 +- public/react/src/modules/testpaper/component/Listjihe.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 0fb34200e..76b30d2ba 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -304,7 +304,7 @@ class Testpaperlibrary extends Component { tag_discipline_id:this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, - keyword: this.state.keywords, + keyword: this.state.keyword, page: this.state.page, per_page:10, }; @@ -330,7 +330,7 @@ class Testpaperlibrary extends Component { tag_discipline_id:this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, - keyword: this.state.keywords, + keyword: this.state.keyword, page: this.state.page, per_page:10, }; diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 8a3d57414..b73da225f 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -194,7 +194,7 @@ class Contentpart extends Component { size="large" onInput={(e)=>this.props.setdatafunsval(e)} onSearch={ (value)=>this.props.setdatafuns(value)} - value={this.props.keywords} + value={this.props.keyword} /> { diff --git a/public/react/src/modules/testpaper/component/Listjihe.js b/public/react/src/modules/testpaper/component/Listjihe.js index b2f358b96..1b39bfee3 100644 --- a/public/react/src/modules/testpaper/component/Listjihe.js +++ b/public/react/src/modules/testpaper/component/Listjihe.js @@ -82,7 +82,7 @@ class Listjihe extends Component {
-
this.gotoseesj(items.id)}>

{names}

+
this.gotoseesj(items.id)}>

{names}

试题数:{question_counts}

总分:{total_scores}

From 65c58d25d7b6b316d2c81adddeaa0470839658ab 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 16:30:09 +0800 Subject: [PATCH 002/100] =?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/NewMyShixunModel.js | 11 +++++++- .../react/src/modules/question/Paperreview.js | 2 +- .../modules/testpaper/Paperlibraryeditid.js | 28 +++++++++---------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index d50f41484..301a51614 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -219,6 +219,12 @@ class NewMyShixunModel extends Component { } this.callback(defaultActiveKeys); } + if(prevProps.Contentdata !== this.props.Contentdata){ + this.setState({ + Contentdata:this.props.Contentdata, + }) + + } } //公共和我的 @@ -884,7 +890,7 @@ class NewMyShixunModel extends Component { page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list, completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count, program_questions_count, single_questions_count, subjective_questions_count,selectionbools, - modalsTypeInaudit + modalsTypeInaudit,Contentdata } = this.state; const Datacount = completion_questions_count + judgement_questions_count @@ -893,6 +899,8 @@ class NewMyShixunModel extends Component { + single_questions_count + subjective_questions_count; + // console.log("弹出框"); + // console.log(Contentdata) return (
@@ -962,6 +970,7 @@ class NewMyShixunModel extends Component { /> {/*头部*/} - this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: "" diff --git a/public/react/src/modules/testpaper/Paperlibraryeditid.js b/public/react/src/modules/testpaper/Paperlibraryeditid.js index 8700a216f..5843a4709 100644 --- a/public/react/src/modules/testpaper/Paperlibraryeditid.js +++ b/public/react/src/modules/testpaper/Paperlibraryeditid.js @@ -31,7 +31,7 @@ class Paperlibraryeditid extends Component { super(props); this.Judquestio = React.createRef(); this.state = { - paperlibrartdata: [], + Contentdata: [], disciplinesdata: [], knowledgepoints: [], disciplmy: [], @@ -139,7 +139,7 @@ class Paperlibraryeditid extends Component { axios.get(urls).then((response) => { if (response) { this.setState({ - paperlibrartdata: response.data, + Contentdata: response.data, item_banksedit: response.data.exam, }) } @@ -227,7 +227,7 @@ class Paperlibraryeditid extends Component { } render() { - let {paperlibrartdata,newmyshixunmodelbool,defaultActiveKey} = this.state; + let {Contentdata,newmyshixunmodelbool,defaultActiveKey} = this.state; const params = this.props && this.props.match && this.props.match.params; let urlsysl=`/paperlibrary?defaultActiveKey=${defaultActiveKey}`; @@ -248,7 +248,7 @@ class Paperlibraryeditid extends Component { { newmyshixunmodelbool===true?
- this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: "" @@ -291,9 +291,9 @@ class Paperlibraryeditid extends Component {
this.setnewmyshixunmodelbool(e)} - all_score={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_questions_count} - all_questions_count={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_score} - difficulty={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.difficulty} + all_score={Contentdata && Contentdata.exam && Contentdata.exam.all_questions_count} + all_questions_count={Contentdata && Contentdata.exam && Contentdata.exam.all_score} + difficulty={Contentdata && Contentdata.exam && Contentdata.exam.difficulty} >
@@ -301,15 +301,15 @@ class Paperlibraryeditid extends Component { {...this.state} {...this.props} getdata={() => this.getdata()} - single_questions={paperlibrartdata && paperlibrartdata.single_questions && paperlibrartdata.single_questions.questions.length > 0 ? paperlibrartdata.single_questions : null} - multiple_questions={paperlibrartdata && paperlibrartdata.multiple_questions - && paperlibrartdata.multiple_questions.questions.length > 0 ? paperlibrartdata.multiple_questions : null + single_questions={Contentdata && Contentdata.single_questions && Contentdata.single_questions.questions.length > 0 ? Contentdata.single_questions : null} + multiple_questions={Contentdata && Contentdata.multiple_questions + && Contentdata.multiple_questions.questions.length > 0 ? Contentdata.multiple_questions : null } - judgement_questions={paperlibrartdata && paperlibrartdata.judgement_questions - && paperlibrartdata.judgement_questions.questions.length > 0 ? paperlibrartdata.judgement_questions : null + judgement_questions={Contentdata && Contentdata.judgement_questions + && Contentdata.judgement_questions.questions.length > 0 ? Contentdata.judgement_questions : null } - program_questions={paperlibrartdata && paperlibrartdata.program_questions - && paperlibrartdata.program_questions.questions.length > 0 ? paperlibrartdata.program_questions : null + program_questions={Contentdata && Contentdata.program_questions + && Contentdata.program_questions.questions.length > 0 ? Contentdata.program_questions : null } > From 964d3717a7e710bd46c489263a7ee38a53098867 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 16:34:51 +0800 Subject: [PATCH 003/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview_items.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/question/Paperreview_items.js b/public/react/src/modules/question/Paperreview_items.js index 75ed4a248..32d657cfd 100644 --- a/public/react/src/modules/question/Paperreview_items.js +++ b/public/react/src/modules/question/Paperreview_items.js @@ -61,12 +61,15 @@ class Paperreview_items extends Component { // //console.log(object); // //console.log("Paperreview_items"); // //console.log(object.item_id); + //这里换题修改过 + //这里删除修改过 + // /Integeneration/Intelligence/ 换题item_id 删除id return (
{ paperreviewsingleindex===indexs&&paperreviewsinglename===typenames?
-
this.props.showsetmodalsTypedels(object.item_id,true,1)}>删除
+
this.props.showsetmodalsTypedels(object.id,true,1)}>删除
{ this.props.match.params.type==="Intelligence"?
this.props.Changingtopics(object.item_id)}>换题
From f1d4f07c75dbd873871c65a582fab9faf918fd16 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 16:42:43 +0800 Subject: [PATCH 004/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview_items.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/question/Paperreview_items.js b/public/react/src/modules/question/Paperreview_items.js index 32d657cfd..ba377f35f 100644 --- a/public/react/src/modules/question/Paperreview_items.js +++ b/public/react/src/modules/question/Paperreview_items.js @@ -63,13 +63,13 @@ class Paperreview_items extends Component { // //console.log(object.item_id); //这里换题修改过 //这里删除修改过 - // /Integeneration/Intelligence/ 换题item_id 删除id + // /Integeneration/Intelligence/ 换题item_id 删除item_id return (
{ paperreviewsingleindex===indexs&&paperreviewsinglename===typenames?
-
this.props.showsetmodalsTypedels(object.id,true,1)}>删除
+
this.props.showsetmodalsTypedels(object.item_id,true,1)}>删除
{ this.props.match.params.type==="Intelligence"?
this.props.Changingtopics(object.item_id)}>换题
From 5c611fb61bd8f0a32cc3e102113ace4ac81de221 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 16:57:24 +0800 Subject: [PATCH 005/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview.js | 3 ++- public/react/src/modules/question/Paperreview_item.js | 9 +++++++-- .../testpaper/component/Paperlibraryseeid_itemss.js | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 8fbe146b4..c05645b54 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -427,11 +427,12 @@ class Paperreview extends Component { { Cohetepaperbool===false? - this.Changingtopics(e)} Replacementtype={(e)=>this.Replacementtype(e)} getdata={(data)=>this.getdata(data)} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}> + this.Changingtopics(e)} Replacementtype={(e)=>this.Replacementtype(e)} getdata={(data)=>this.getdata(data)} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}> : this.getcontentMdRef(ref)} setitem_type={(item) => this.setitem_type(item)} diff --git a/public/react/src/modules/question/Paperreview_item.js b/public/react/src/modules/question/Paperreview_item.js index 0156b3211..fa68ce34e 100644 --- a/public/react/src/modules/question/Paperreview_item.js +++ b/public/react/src/modules/question/Paperreview_item.js @@ -272,7 +272,9 @@ class Paperreview_item extends Component { }else { //确定 const url = `/item_baskets/${this.state.item_bank_id}.json`; - axios.delete((url)) + axios.delete(url, { data: { + exam_setting_id: this.props.match.params.id, + }}) .then((response) => { if (response.data.status == 0) { // this.props.showNotification('试题删除成功'); @@ -291,7 +293,8 @@ class Paperreview_item extends Component { } showsetmodalsTypedels=(id,bool,type)=>{ - debugger + console.log("Paperreview_item"); + this.setState({ item_bank_id:id, }) @@ -394,6 +397,8 @@ class Paperreview_item extends Component { modalsTypeys } = this.state; let {single_questions, multiple_questions, judgement_questions, program_questions, all_score} = this.props; + console.log("this.props"); + console.log(this.props); return (
{ diff --git a/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js b/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js index b725b4e5e..754a45560 100644 --- a/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js +++ b/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js @@ -291,7 +291,8 @@ class Paperlibraryseeid_itemss extends Component { } showsetmodalsTypedels=(id,bool,type)=>{ - debugger + console.log("Paperlibraryseeid_itemss"); + this.setState({ item_bank_id:id, }) 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 006/100] =?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, From d98cda09f7cc461d26481d62288493e4f8b001bd 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:44:10 +0800 Subject: [PATCH 007/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 10 +-- public/react/src/modules/question/Question.js | 72 +++++++++++++------ .../modules/question/Questionitem_banks.js | 2 +- 3 files changed, 53 insertions(+), 31 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index e321b4d2e..a5e51a81c 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -258,16 +258,10 @@ export function initAxiosInterceptors(props) { } // // console.log(config); - if (config.method === "post") { - if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 显示这个方法会影响到定制信息 - // console.log(config); - // console.log(JSON.parse(config)); - // console.log(config.url); - // console.log("被阻止了是重复请求================================="); + if (requestMap[config.url] === true) { return false; } - } - // 非file_update请求 + // // 非file_update请求 if (config.url.indexOf('update_file') === -1) { requestMap[config.url] = true; diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index e4a618f19..1ff4babd1 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -22,6 +22,7 @@ import './questioncss/questioncom.css'; import SiderBars from "../question/component/SiderBars"; import QuestionModalys from "./component/QuestionModalys"; +var Undoclickable=true; class Question extends Component { constructor(props) { super(props); @@ -69,6 +70,9 @@ class Question extends Component { isVisible: false, selectionbools:false, chakanjiexiboolindex:"无", + + + } } @@ -287,7 +291,10 @@ class Question extends Component { }) this.getdataslen(response.data.items); + // Undoclickable=true; + }).catch((error) => { + // Undoclickable=true; }); } @@ -634,6 +641,7 @@ class Question extends Component { single_questions_count: result.data.single_questions_count, subjective_questions_count: result.data.subjective_questions_count, }) + // Undoclickable=true; }).catch((error) => { // ////console.log(error); @@ -646,6 +654,7 @@ class Question extends Component { single_questions_count: 0, subjective_questions_count: 0, }) + // Undoclickable=true; }) } @@ -683,30 +692,49 @@ class Question extends Component { } // 撤销 getitem_basketss=(id)=>{ - //选用题型可以上传单个 或者多个题型 - let url=`/item_baskets/${id}.json`; + this.setState({ - axios.delete(url) - .then((result) => { - if (result.data.status == 0) { - // this.props.showNotification(`撤销成功`); - var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, - public: this.state.defaultActiveKey, - difficulty: this.state.difficulty, - item_type: this.state.item_type, - keyword: this.state.keywords, - page: this.state.page, - per_page:10, - }; - this.getdatasy(data); - this.getbasket_listdata(); - } - }).catch((error) => { - ////console.log(error); }) + if(Undoclickable===true){ + Undoclickable=false; + //选用题型可以上传单个 或者多个题型 + let url=`/item_baskets/${id}.json`; + + axios.delete(url) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`撤销成功`); + var data = { + discipline_id:this.state.discipline_id, + sub_discipline_id:this.state.sub_discipline_id, + tag_discipline_id:this.state.tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keyword: this.state.keywords, + page: this.state.page, + per_page:10, + }; + this.getdatasy(data); + this.getbasket_listdata(); + setTimeout(()=>{ + Undoclickable=true; + },1000); + } + }).catch((error) => { + ////console.log(error); + setTimeout(()=>{ + Undoclickable=true; + },1000); + + }) + + }else{ + + return + } + + } //全选试题库 selectallquestionsonthispage=()=>{ diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index 11605ec6d..349615ddc 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -588,7 +588,7 @@ class Questionitem_banks extends Component { "" : this.preservation()} url={item_type === "PROGRAM" ?'/problems':'/question'}> + onSubmits={() => this.preservation()} url={'/question'}> }
) From ffec573b338ba961d13b111ea03662b76e7b34d4 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:48:14 +0800 Subject: [PATCH 008/100] =?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/NewMyShixunModel.js | 118 +++++++++++------- public/react/src/modules/question/Question.js | 6 +- 2 files changed, 73 insertions(+), 51 deletions(-) diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index 301a51614..f20f9ab1a 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -23,6 +23,7 @@ import Bottomsubmit from "../modals/Bottomsubmit"; import QuestionModalys from "./component/QuestionModalys"; //exam_id 试卷的id +var Undoclickable=true; class NewMyShixunModel extends Component { constructor(props) { super(props); @@ -725,57 +726,78 @@ class NewMyShixunModel extends Component { } // 撤销 getitem_basketss=(id)=>{ + let url=""; if(this.props.exam_id===undefined){ - url=`/item_baskets/${id}.json`; - axios.delete(url) - .then((result) => { - if (result.data.status == 0) { - // this.props.showNotification(`撤销成功`); - var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, - public: this.state.defaultActiveKey, - difficulty: this.state.difficulty, - item_type: this.state.item_type, - keyword: this.state.keywords, - page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), - }; - this.getdatasy(data); - this.getbasket_listdata(); - } - }).catch((error) => { - ////console.log(error); - }) + if(Undoclickable===true) { + Undoclickable = false; + url = `/item_baskets/${id}.json`; + axios.delete(url) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`撤销成功`); + var data = { + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keyword: this.state.keywords, + page: this.state.page, + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + }; + this.getdatasy(data); + this.getbasket_listdata(); + } + setTimeout(()=>{ + Undoclickable=true; + },1000); + + }).catch((error) => { + setTimeout(()=>{ + Undoclickable=true; + },1000); + + }) + } }else{ - url=`/examination_banks/${this.props.exam_id}/revoke_item.json`; - axios.delete(url,{ data: { - item_id:id===undefined?"":parseInt(id), - }}) - .then((result) => { - if (result.data.status == 0) { - // this.props.showNotification(`撤销成功`); - var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, - public: this.state.defaultActiveKey, - difficulty: this.state.difficulty, - item_type: this.state.item_type, - keyword: this.state.keywords, - page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), - }; - this.getdatasy(data); - this.getbasket_listdata(); - } - }).catch((error) => { - ////console.log(error); - }) + if(Undoclickable===true) { + Undoclickable = false; + url = `/examination_banks/${this.props.exam_id}/revoke_item.json`; + axios.delete(url, { + data: { + item_id: id === undefined ? "" : parseInt(id), + } + }) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`撤销成功`); + var data = { + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keyword: this.state.keywords, + page: this.state.page, + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + }; + this.getdatasy(data); + this.getbasket_listdata(); + } + setTimeout(()=>{ + Undoclickable=true; + },1000); + }).catch((error) => { + setTimeout(()=>{ + Undoclickable=true; + },1000); + }) + } } diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 1ff4babd1..9881bdc0e 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -717,10 +717,10 @@ class Question extends Component { }; this.getdatasy(data); this.getbasket_listdata(); - setTimeout(()=>{ - Undoclickable=true; - },1000); } + setTimeout(()=>{ + Undoclickable=true; + },1000); }).catch((error) => { ////console.log(error); setTimeout(()=>{ From 5cc7fdb66bd48356e5363afa36f92fad2ee7f3fa 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 18:02:32 +0800 Subject: [PATCH 009/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/component/ChoquesEditor.js | 19 +++++++++++++++++-- .../question/component/SingleEditor.js | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 25aab75a1..36ef4c61f 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -236,8 +236,23 @@ class ChoquesEditor extends Component{ texts=""; } } else { - value = JSON.stringify(value); - texts=value; + if(_text.length>=500){ + var result = _text.substring(0,450); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else { + // 提交到后台的内容需要处理一下; + value = JSON.stringify(value); + if(value.length>=500){ + let a=value.length-500; + let b=_text.length-a; + var result = _text.substring(0,b); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else{ + texts=value; + } + } } let question_choices = this.state.question_choices.slice(0); question_choices[index] = texts; diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 39c2e447e..c1255c83a 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -258,8 +258,23 @@ class SingleEditor extends Component{ texts=""; } } else { - value = JSON.stringify(value); - texts=value; + if(_text.length>=500){ + var result = _text.substring(0,450); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else { + // 提交到后台的内容需要处理一下; + value = JSON.stringify(value); + if(value.length>=500){ + let a=value.length-500; + let b=_text.length-a; + var result = _text.substring(0,b); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else{ + texts=value; + } + } } let question_choices = this.state.question_choices.slice(0); question_choices[index] = texts; From 6bd1b62ac9b24a2285510e37a7eb99e51a4d789c 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 18:11:17 +0800 Subject: [PATCH 010/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/component/ChoquesEditor.js | 1 + public/react/src/modules/question/component/JudquestionEditor.js | 1 + public/react/src/modules/question/component/SingleEditor.js | 1 + 3 files changed, 3 insertions(+) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 36ef4c61f..803adbdff 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -377,6 +377,7 @@ class ChoquesEditor extends Component{ } .signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-font { line-height: 20px; + min-width: 150px; } `}

diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 09cf1094f..e5134dafb 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -397,6 +397,7 @@ class JudquestionEditor extends Component{ } .signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-font { line-height: 20px; + min-width: 150px; } `}

diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index c1255c83a..fd3840727 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -399,6 +399,7 @@ class SingleEditor extends Component{ } .signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-font { line-height: 20px; + min-width: 150px; } `}

From 5d3f267cc39d2509eb660718cef40415a7984abc 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 20:07:26 +0800 Subject: [PATCH 011/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/common/quillForEditor/font.css | 65 +++++++++++++++++++ .../react/src/common/quillForEditor/index.js | 1 + .../src/common/quillForEditor/quill.core.css | 18 +++++ .../src/common/quillForEditor/quill.snow.css | 28 ++++++++ .../question/component/ChoquesEditor.js | 1 + .../question/component/JudquestionEditor.js | 1 + .../question/component/SingleEditor.js | 1 + .../src/modules/question/questioncss/font.css | 65 +++++++++++++++++++ .../question/questioncss/quill.core.css | 18 +++++ .../question/questioncss/quill.snow.css | 28 ++++++++ 10 files changed, 226 insertions(+) create mode 100644 public/react/src/common/quillForEditor/font.css create mode 100644 public/react/src/common/quillForEditor/quill.core.css create mode 100644 public/react/src/common/quillForEditor/quill.snow.css create mode 100644 public/react/src/modules/question/questioncss/font.css create mode 100644 public/react/src/modules/question/questioncss/quill.core.css create mode 100644 public/react/src/modules/question/questioncss/quill.snow.css diff --git a/public/react/src/common/quillForEditor/font.css b/public/react/src/common/quillForEditor/font.css new file mode 100644 index 000000000..8537e9f23 --- /dev/null +++ b/public/react/src/common/quillForEditor/font.css @@ -0,0 +1,65 @@ +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { + content: "宋体"; + font-family: "SimSun"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { + content: "黑体"; + font-family: "SimHei"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { + content: "微软雅黑"; + font-family: "Microsoft YaHei"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { + content: "楷体"; + font-family: "KaiTi"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=FangSong]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=FangSong]::before { + content: "仿宋"; + font-family: "FangSong"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { + content: "Arial"; + font-family: "Arial"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { + content: "Times New Roman"; + font-family: "Times New Roman"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=sans-serif]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=sans-serif]::before { + content: "sans-serif"; + font-family: "sans-serif"; +} + +.ql-font-SimSun { + font-family: "SimSun"; +} +.ql-font-SimHei { + font-family: "SimHei"; +} +.ql-font-Microsoft-YaHei { + font-family: "Microsoft YaHei"; +} +.ql-font-KaiTi { + font-family: "KaiTi"; +} +.ql-font-FangSong { + font-family: "FangSong"; +} +.ql-font-Arial { + font-family: "Arial"; +} +.ql-font-Times-New-Roman { + font-family: "Times New Roman"; +} +.ql-font-sans-serif { + font-family: "sans-serif"; +} diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index 89a4f6224..6b41885e7 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -11,6 +11,7 @@ import 'quill/dist/quill.core.css'; // 核心样式 import 'quill/dist/quill.snow.css'; // 有工具栏 import 'quill/dist/quill.bubble.css'; // 无工具栏 import 'katex/dist/katex.min.css'; // katex 表达式样式 +import './font.css' import React, { useState, useRef, useEffect } from 'react'; import Quill from 'quill'; import katex from 'katex'; diff --git a/public/react/src/common/quillForEditor/quill.core.css b/public/react/src/common/quillForEditor/quill.core.css new file mode 100644 index 000000000..516e388b6 --- /dev/null +++ b/public/react/src/common/quillForEditor/quill.core.css @@ -0,0 +1,18 @@ +.ql-editor .ql-font-Microsoft-YaHei { + font-family: "Microsoft YaHei"; +} +.ql-editor .ql-font-SimSun { + font-family: "SimSun"; +} +.ql-editor .ql-font-SimHei { + font-family: "SimHei"; +} +.ql-editor .ql-font-KaiTi { + font-family: "KaiTi"; +} +.ql-editor .ql-font-Arial { + font-family: "Arial"; +} +.ql-editor .Times-New-Roman { + font-family: "Times New Roman"; +} diff --git a/public/react/src/common/quillForEditor/quill.snow.css b/public/react/src/common/quillForEditor/quill.snow.css new file mode 100644 index 000000000..962b40f99 --- /dev/null +++ b/public/react/src/common/quillForEditor/quill.snow.css @@ -0,0 +1,28 @@ +.ql-snow .ql-picker.ql-font .ql-picker-label::before, +.ql-snow .ql-picker.ql-font .ql-picker-item::before { + content: '微软雅黑'; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { + content: "微软雅黑"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { + content: "宋体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { + content: "黑体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { + content: "楷体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { + content: "Arial"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { + content: "Times New Roman"; +} diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 803adbdff..d274a6573 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -9,6 +9,7 @@ import TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor'; import axios from 'axios' import update from 'immutability-helper' import './../questioncss/questioncom.css'; +import '../questioncss/font.css'; import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder'; import QuillForEditor from '../../../common/quillForEditor'; const { TextArea } = Input; diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index e5134dafb..d2aa7a7f0 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -9,6 +9,7 @@ import TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor'; import axios from 'axios' import update from 'immutability-helper' import './../questioncss/questioncom.css'; +import '../questioncss/font.css'; import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder'; import QuillForEditor from '../../../common/quillForEditor'; diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index fd3840727..3a4950f24 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -10,6 +10,7 @@ import TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor'; import axios from 'axios' import update from 'immutability-helper' import './../questioncss/questioncom.css'; +import '../questioncss/font.css'; import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder'; const { TextArea } = Input; const confirm = Modal.confirm; diff --git a/public/react/src/modules/question/questioncss/font.css b/public/react/src/modules/question/questioncss/font.css new file mode 100644 index 000000000..8537e9f23 --- /dev/null +++ b/public/react/src/modules/question/questioncss/font.css @@ -0,0 +1,65 @@ +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { + content: "宋体"; + font-family: "SimSun"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { + content: "黑体"; + font-family: "SimHei"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { + content: "微软雅黑"; + font-family: "Microsoft YaHei"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { + content: "楷体"; + font-family: "KaiTi"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=FangSong]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=FangSong]::before { + content: "仿宋"; + font-family: "FangSong"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { + content: "Arial"; + font-family: "Arial"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { + content: "Times New Roman"; + font-family: "Times New Roman"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=sans-serif]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=sans-serif]::before { + content: "sans-serif"; + font-family: "sans-serif"; +} + +.ql-font-SimSun { + font-family: "SimSun"; +} +.ql-font-SimHei { + font-family: "SimHei"; +} +.ql-font-Microsoft-YaHei { + font-family: "Microsoft YaHei"; +} +.ql-font-KaiTi { + font-family: "KaiTi"; +} +.ql-font-FangSong { + font-family: "FangSong"; +} +.ql-font-Arial { + font-family: "Arial"; +} +.ql-font-Times-New-Roman { + font-family: "Times New Roman"; +} +.ql-font-sans-serif { + font-family: "sans-serif"; +} diff --git a/public/react/src/modules/question/questioncss/quill.core.css b/public/react/src/modules/question/questioncss/quill.core.css new file mode 100644 index 000000000..516e388b6 --- /dev/null +++ b/public/react/src/modules/question/questioncss/quill.core.css @@ -0,0 +1,18 @@ +.ql-editor .ql-font-Microsoft-YaHei { + font-family: "Microsoft YaHei"; +} +.ql-editor .ql-font-SimSun { + font-family: "SimSun"; +} +.ql-editor .ql-font-SimHei { + font-family: "SimHei"; +} +.ql-editor .ql-font-KaiTi { + font-family: "KaiTi"; +} +.ql-editor .ql-font-Arial { + font-family: "Arial"; +} +.ql-editor .Times-New-Roman { + font-family: "Times New Roman"; +} diff --git a/public/react/src/modules/question/questioncss/quill.snow.css b/public/react/src/modules/question/questioncss/quill.snow.css new file mode 100644 index 000000000..962b40f99 --- /dev/null +++ b/public/react/src/modules/question/questioncss/quill.snow.css @@ -0,0 +1,28 @@ +.ql-snow .ql-picker.ql-font .ql-picker-label::before, +.ql-snow .ql-picker.ql-font .ql-picker-item::before { + content: '微软雅黑'; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { + content: "微软雅黑"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { + content: "宋体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { + content: "黑体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { + content: "楷体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { + content: "Arial"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { + content: "Times New Roman"; +} From e64d002f42918c55d39557affe345c51fac76c8c 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 22:01:41 +0800 Subject: [PATCH 012/100] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/common/quillForEditor/font.css | 33 +++++++++--------- .../react/src/common/quillForEditor/index.js | 10 +++--- .../question/component/ChoquesEditor.js | 9 +++-- .../question/component/JudquestionEditor.js | 10 ++++-- .../question/component/SingleEditor.js | 10 ++++-- .../src/modules/question/questioncss/font.css | 34 ++++++++++--------- 6 files changed, 60 insertions(+), 46 deletions(-) diff --git a/public/react/src/common/quillForEditor/font.css b/public/react/src/common/quillForEditor/font.css index 8537e9f23..08e78a5a2 100644 --- a/public/react/src/common/quillForEditor/font.css +++ b/public/react/src/common/quillForEditor/font.css @@ -1,65 +1,66 @@ +@charset "utf-8"; .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { content: "宋体"; - font-family: "SimSun"; + font-family:SimSun !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { content: "黑体"; - font-family: "SimHei"; + font-family:SimHei !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { content: "微软雅黑"; - font-family: "Microsoft YaHei"; + font-family:Microsoft YaHei !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { content: "楷体"; - font-family: "KaiTi"; + font-family:KaiTi !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=FangSong]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=FangSong]::before { content: "仿宋"; - font-family: "FangSong"; + font-family:FangSong !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { content: "Arial"; - font-family: "Arial"; + font-family:Arial !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { content: "Times New Roman"; - font-family: "Times New Roman"; + font-family:Times New Roman !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=sans-serif]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=sans-serif]::before { content: "sans-serif"; - font-family: "sans-serif"; + font-family:sans-serif !important; } .ql-font-SimSun { - font-family: "SimSun"; + font-family:SimSun !important; } .ql-font-SimHei { - font-family: "SimHei"; + font-family:SimHei !important; } .ql-font-Microsoft-YaHei { - font-family: "Microsoft YaHei"; + font-family:Microsoft YaHei !important; } .ql-font-KaiTi { - font-family: "KaiTi"; + font-family:KaiTi !important; } .ql-font-FangSong { - font-family: "FangSong"; + font-family:FangSong !important; } .ql-font-Arial { - font-family: "Arial"; + font-family:Arial !important; } .ql-font-Times-New-Roman { - font-family: "Times New Roman"; + font-family:Times New Roman !important; } .ql-font-sans-serif { - font-family: "sans-serif"; + font-family:sans-serif !important; } diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index 6b41885e7..ba37059ba 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -20,12 +20,12 @@ import { fetchUploadImage } from '../../services/ojService.js'; import { getImageUrl } from 'educoder' import ImageBlot from './ImageBlot'; import FillBlot from './FillBlot'; -const Size = Quill.import('attributors/style/size'); -const Font = Quill.import('formats/font'); +var Size = Quill.import('attributors/style/size'); // const Color = Quill.import('attributes/style/color'); Size.whitelist = ['14px', '16px', '18px', '20px', false]; -Font.whitelist = ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']; - +var fonts = ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong']; +var Font = Quill.import('formats/font'); +Font.whitelist = fonts; //将字体加入到白名单 window.Quill = Quill; window.katex = katex; Quill.register(ImageBlot); @@ -60,7 +60,7 @@ function QuillForEditor ({ {align: []}, {list: 'ordered'}, {list: 'bullet'}, // 列表 {script: 'sub'}, {script: 'super'}, { 'color': [] }, { 'background': [] }, - { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']}, + { 'font': []}, {header: [1,2,3,4,5,false]}, 'blockquote', 'code-block', 'link', 'image', 'video', diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index d274a6573..be660b386 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -349,9 +349,9 @@ class ChoquesEditor extends Component{ // //////console.log("xuanzheshijuan"); // //////console.log(answerTagArray); // //////console.log(!exerciseIsPublish); - const options=['code-block', 'image', 'formula',{size: ['14px', '16px', '18px', '20px']}, - { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']}, - { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']} + const options=['code-block', 'image', 'formula', + 'bold', 'italic', 'underline', 'strike',{size: ['14px', '16px', '18px', '20px']}, + { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']} ] return(

@@ -380,6 +380,9 @@ class ChoquesEditor extends Component{ line-height: 20px; min-width: 150px; } + .signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{ + font-family: MicrosoftYaHei; + } `}

{/* {!question_id ? '新建' : '编辑'} */} diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index d2aa7a7f0..58954dd85 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -369,9 +369,10 @@ class JudquestionEditor extends Component{ // ////////console.log(answerTagArray); // ////////console.log(!exerciseIsPublish); const params= this.props&&this.props.match&&this.props.match.params; - const options=['code-block', 'image', 'formula',{size: ['14px', '16px', '18px', '20px']}, - { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']}, - { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']} + const options=['code-block', 'image', 'formula', + 'bold', 'italic', 'underline', 'strike', + {size: ['14px', '16px', '18px', '20px']}, + { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']} ] return(

@@ -400,6 +401,9 @@ class JudquestionEditor extends Component{ line-height: 20px; min-width: 150px; } + .signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{ + font-family: MicrosoftYaHei; + } `}

{/* {!question_id ? '新建' : '编辑'} */} diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 3a4950f24..665785240 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -370,9 +370,10 @@ class SingleEditor extends Component{ // //////console.log("xuanzheshijuan"); // //////console.log(answerTagArray); // //////console.log(!exerciseIsPublish); - const options=['code-block', 'image', 'formula',{size: ['14px', '16px', '18px', '20px']}, - { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']}, - { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']} + const options=['code-block', 'image', 'formula', + 'bold', 'italic', 'underline', 'strike', + ,{size: ['14px', '16px', '18px', '20px']}, + { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']} ] return(

@@ -402,6 +403,9 @@ class SingleEditor extends Component{ line-height: 20px; min-width: 150px; } + .signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{ + font-family: MicrosoftYaHei; + } `}

{/* {!question_id ? '新建' : '编辑'} */} diff --git a/public/react/src/modules/question/questioncss/font.css b/public/react/src/modules/question/questioncss/font.css index 8537e9f23..1f2cd8386 100644 --- a/public/react/src/modules/question/questioncss/font.css +++ b/public/react/src/modules/question/questioncss/font.css @@ -1,65 +1,67 @@ +@charset "utf-8"; .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { content: "宋体"; - font-family: "SimSun"; + font-family:SimSun !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { content: "黑体"; - font-family: "SimHei"; + font-family:SimHei !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { content: "微软雅黑"; - font-family: "Microsoft YaHei"; + font-family:Microsoft YaHei !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { content: "楷体"; - font-family: "KaiTi"; + font-family:KaiTi !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=FangSong]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=FangSong]::before { content: "仿宋"; - font-family: "FangSong"; + font-family:FangSong !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { content: "Arial"; - font-family: "Arial"; + font-family:Arial !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { content: "Times New Roman"; - font-family: "Times New Roman"; + font-family:Times New Roman !important; } .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=sans-serif]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=sans-serif]::before { content: "sans-serif"; - font-family: "sans-serif"; + font-family:sans-serif !important; } + .ql-font-SimSun { - font-family: "SimSun"; + font-family:SimSun !important; } .ql-font-SimHei { - font-family: "SimHei"; + font-family:SimHei !important; } .ql-font-Microsoft-YaHei { - font-family: "Microsoft YaHei"; + font-family:Microsoft YaHei !important; } .ql-font-KaiTi { - font-family: "KaiTi"; + font-family:KaiTi !important; } .ql-font-FangSong { - font-family: "FangSong"; + font-family:FangSong !important; } .ql-font-Arial { - font-family: "Arial"; + font-family:Arial !important; } .ql-font-Times-New-Roman { - font-family: "Times New Roman"; + font-family:Times New Roman !important; } .ql-font-sans-serif { - font-family: "sans-serif"; + font-family:sans-serif !important; } From 27109c1c5f8b46dc441bea401540c786dbd4ffb0 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 22:33:52 +0800 Subject: [PATCH 013/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/question/component/Headplugselections.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/question/component/Headplugselections.js b/public/react/src/modules/question/component/Headplugselections.js index 4da7a57e3..d683ad43e 100644 --- a/public/react/src/modules/question/component/Headplugselections.js +++ b/public/react/src/modules/question/component/Headplugselections.js @@ -260,7 +260,7 @@ class Headplugselections extends Component { disciplinesdata&&disciplinesdata.map((item,key)=>{ return( item.sub_disciplines.length>0? - trigger.parentNode} overlay={ overlaymenu(item.sub_disciplines,item.id)} key={key} placement={"bottomRight"}> + trigger.parentNode} overlay={ overlaymenu(item.sub_disciplines,item.id)} key={key} placement="bottomLeft">

  • this.shixunserdchAlls(item.sub_disciplines,item.id)}> {item.name}
  • From afd54d61c1eefc9c2b90b2befbad4a0530225887 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, 20 Feb 2020 14:37:19 +0800 Subject: [PATCH 014/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/question/component/ChoquesEditor.js | 5 +---- .../src/modules/question/component/JudquestionEditor.js | 6 +----- public/react/src/modules/question/component/SingleEditor.js | 5 +---- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index be660b386..233c5237d 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -349,10 +349,7 @@ class ChoquesEditor extends Component{ // //////console.log("xuanzheshijuan"); // //////console.log(answerTagArray); // //////console.log(!exerciseIsPublish); - const options=['code-block', 'image', 'formula', - 'bold', 'italic', 'underline', 'strike',{size: ['14px', '16px', '18px', '20px']}, - { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']} - ] + const options=['code-block', 'image', 'formula'] return(
    + + :"" + }
    diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index b73da225f..9aa4cf2ea 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -17,6 +17,7 @@ import NoneDatas from '../component/NoneDatas'; import Contentquestionbank from "./Contentquestionbank"; import LoadingSpin from '../../../common/LoadingSpin'; import Listjihe from "./Listjihe"; +import Certifiedprofessional from "../../modals/Certifiedprofessional"; const { TabPane } = Tabs; const Search = Input.Search; class Contentpart extends Component { @@ -25,6 +26,8 @@ class Contentpart extends Component { this.state = { page:1, defaultActiveKeyss:"0", + mydisplay:false, + occupation:2, } } @@ -86,9 +89,31 @@ class Contentpart extends Component { this.props.callback(defaultActiveKeys,false); } } + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } + xinzenw=(url)=>{ + //只限制了教师 + if(this.props.current_user.professional_certification===false){ + this.HideAddcoursestypess(2); + return + } + + this.props.history.push(url); + } render() { - let {page,defaultActiveKeyss}=this.state; + let {page,defaultActiveKeyss,mydisplay}=this.state; let {defaultActiveKey,defaultActiveKeybool}=this.props; let defaultActiveKeys=defaultActiveKey+''; @@ -125,6 +150,27 @@ class Contentpart extends Component { return (
    + { + mydisplay===true? + + + :"" + } + { + mydisplay===true? + + + :"" + }
    @@ -203,13 +249,13 @@ class Contentpart extends Component { width:"50%" }}> - + this.xinzenw('/Integeneration')}>

    智能组卷

    - + this.xinzenw('/question')}>

    人工组卷

    diff --git a/public/react/src/modules/testpaper/component/Listjihe.js b/public/react/src/modules/testpaper/component/Listjihe.js index c6b83eafa..8dc398e4e 100644 --- a/public/react/src/modules/testpaper/component/Listjihe.js +++ b/public/react/src/modules/testpaper/component/Listjihe.js @@ -135,21 +135,22 @@ class Listjihe extends Component { } { - items.apply===false? -

    this.props.showmodels(items.id)}> - - 公开 -

    - : - ( items.public==true? - "" - : -

    this.props.showmodelsInaudit(e)}> - - 公开审核中 +

    + + 已公开

    - ) + : + items.apply===false? +

    this.props.showmodels(items.id)}> + + 公开 +

    + : +

    this.props.showmodelsInaudit(e)}> + + 公开审核中 +

    }
    :""} From a904ff0acff5ad6ef3ab2f4b0ab4bd58314b7e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 21 Feb 2020 16:11:24 +0800 Subject: [PATCH 018/100] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/question/NewMyShixunModel.js | 27 ++++++++++++++-- public/react/src/modules/question/Question.js | 32 +++++++------------ .../modules/question/component/Contentpart.js | 26 +++++++++++++-- .../modules/question/component/SiderBars.js | 20 ++++++++++-- .../testpaper/component/Contentpart.js | 24 ++++++++++++-- 5 files changed, 99 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index f20f9ab1a..4e3132ab9 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -163,11 +163,22 @@ class NewMyShixunModel extends Component { //初始化 componentDidMount() { - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + let isysladmins=false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; let {defaultActiveKey} = this.props; var defaultActiveKeys=defaultActiveKey; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -207,12 +218,22 @@ class NewMyShixunModel extends Component { componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { - debugger - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + let isysladmins=false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; let {defaultActiveKey} = this.props; var defaultActiveKeys=defaultActiveKey; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 9881bdc0e..b7a96d956 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -853,10 +853,19 @@ class Question extends Component { + program_questions_count + single_questions_count + subjective_questions_count; - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + let isysladmins=false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; - + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } return (
    @@ -923,19 +932,7 @@ class Question extends Component { ` } - { - isysladmins===true? - this.showDrawer()} - Headertop={Headertop} - - /> - : - is_teacher===true&&professional_certification===true? + - : - - "" - } - {/*顶部*/} diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 4ccab5e14..142e34ccc 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -42,11 +42,22 @@ class Contentpart extends Component { componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + let isysladmins=false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; let {defaultActiveKey} = this.props; var defaultActiveKeys=defaultActiveKey; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -120,10 +131,19 @@ class Contentpart extends Component { let {page,mydisplay}=this.state; let {defaultActiveKey,item_type,booljupyterurls}=this.props; const defaultActiveKeys=defaultActiveKey+''; - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + let isysladmins=false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; - + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } const content = (
    0?"-task-sidebar mystask-sidebars":"-task-sidebar mystask-sidebarss"} > @@ -101,7 +117,7 @@ class SiderBars extends Component { {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?
    { - mypath&&mypath==="/question"? + mypath&&mypath==="/question"&&swsilan===true? :"" diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 9aa4cf2ea..eac80dad4 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -63,11 +63,21 @@ class Contentpart extends Component { componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + let isysladmins=false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; let {defaultActiveKey} = this.props; let defaultActiveKeys=defaultActiveKey; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -117,9 +127,19 @@ class Contentpart extends Component { let {defaultActiveKey,defaultActiveKeybool}=this.props; let defaultActiveKeys=defaultActiveKey+''; - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + let isysladmins=false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } const contents = (
    Date: Fri, 21 Feb 2020 17:16:46 +0800 Subject: [PATCH 019/100] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/question/component/Contentpart.js | 24 +++++++++- .../modules/question/component/Listjihe.js | 43 ++++++++++++++++-- .../component/QuestionModalPicture.js | 44 +++++++++++++++++++ 3 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 public/react/src/modules/question/component/QuestionModalPicture.js diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 142e34ccc..c26994147 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -18,6 +18,7 @@ import LoadingSpin from '../../../common/LoadingSpin'; import Contentquestionbank from "./Contentquestionbank"; import Listjihe from "./Listjihe"; import Certifiedprofessional from "../../modals/Certifiedprofessional"; +import QuestionModalys from '../component/QuestionModalPicture.js' const { TabPane } = Tabs; const Search = Input.Search; class Contentpart extends Component { @@ -28,12 +29,25 @@ class Contentpart extends Component { chakanjiexibool:false, mydisplay:false, occupation:2, + url: "" } } //初始化 componentDidMount(){ + } + handleShowUploadImage = (url) => { + // console.log('==============>>>>>>>>>>>>',url); + // setUrl(url); + this.setState({ + url:url + }) + } + handleClose=()=>{ + this.setState({ + url:'', + }) } chakanjiexibool=(index)=>{ @@ -128,7 +142,7 @@ class Contentpart extends Component { } render() { - let {page,mydisplay}=this.state; + let {page,mydisplay,url}=this.state; let {defaultActiveKey,item_type,booljupyterurls}=this.props; const defaultActiveKeys=defaultActiveKey+''; let isysladmins=false; @@ -184,6 +198,11 @@ class Contentpart extends Component { return (
    + {url? + this.handleClose()}> + : + "" + } { mydisplay===true? @@ -386,6 +405,9 @@ class Contentpart extends Component { showmodels={(e)=>this.props.showmodels(e)} showmodelysl={(e)=>this.props.showmodelysl(e)} showmodelsInaudit={(e)=>this.props.showmodelsInaudit(e)} + handleShowUploadImage={(e)=>this.handleShowUploadImage(e)} + handleClose={()=>this.handleClose()} + > diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index fe7d079ef..a31b74636 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -8,7 +8,8 @@ import { Table, Pagination, Radio, - Tooltip + Tooltip, + Icon } from "antd"; import './../questioncss/questioncom.css'; import QuillForEditor from "../../../common/quillForEditor"; @@ -31,6 +32,7 @@ class Listjihe extends Component { page: 1, name: "单选题", nd: "简单", + url: "" } } @@ -39,7 +41,21 @@ class Listjihe extends Component { } + handleShowUploadImage = (url) => { + try { + this.props.handleShowUploadImage(url); + }catch (e) { + + } + } + handleClose=()=>{ + try { + this.props.handleClose(); + }catch (e) { + + } + } //选用 Selectingpracticaltraining = (id) => { let data = {} @@ -63,8 +79,10 @@ class Listjihe extends Component { } + + render() { - let {page, name, nd} = this.state; + let {page, name, nd,url} = this.state; let {defaultActiveKey, items, listjihe, chakanjiexiboolindex, keindex} = this.props; // 编程答案 @@ -173,11 +191,26 @@ class Listjihe extends Component { } - return (
    {/*顶部*/} + + + {/* 显示上传的图片信息 */} + {/*
    */} + {/* this.handleClose()}/>*/} + {/*
    */} + {/* */} + {/*
    */} + {/*
    */} +
    + {/**/} +
    @@ -40,4 +53,4 @@ class QuestionModalys extends Component { } } -export default QuestionModalys; +export default QuestionModalPicture; diff --git a/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js b/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js index 0064b83cf..76b715519 100644 --- a/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js +++ b/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js @@ -16,6 +16,7 @@ import { import '../testioncss/testioncss.css'; import '../../tpm/newshixuns/css/Newshixuns.css'; import QuillForEditor from "../../../common/quillForEditor"; +import QuestionModalPicture from "../../question/component/QuestionModalPicture"; const tagArray = [ 'A.', 'B.', 'C.', 'D.', 'E.', 'F.', 'G.', 'H.', 'I.', @@ -33,6 +34,7 @@ class Paperlibraryseeid_items extends Component { questions: 0, totalscore: 0, total: 0, + url: "" } } @@ -65,9 +67,20 @@ class Paperlibraryseeid_items extends Component { Singlemagaziness = () => { } - + handleShowUploadImage = (url) => { + // console.log('==============>>>>>>>>>>>>',url); + // setUrl(url); + this.setState({ + url:url + }) + } + handleClose=()=>{ + this.setState({ + url:'', + }) + } render() { - let {questions, totalscore, total, items} = this.state; + let {questions, totalscore, total, items,url} = this.state; let {objectsingle, indexx, paperreviewsingleindex, indexxy,name} = this.props; @@ -109,6 +122,11 @@ class Paperlibraryseeid_items extends Component { style={{ minHeight: "114px", }}> + {url? + this.handleClose()}> + : + "" + } + + :"" + } + + :"" + } { visible===true? { - isysladmins===true||(is_teacher===true&&professional_certification===true)? + isysladmins===true||is_teacher===true? this.props.callback(e,true)}> @@ -252,7 +352,7 @@ class Contentpart extends Component { ` } -
    +
    { - isysladmins===true||(is_teacher===true&&professional_certification===true)? + isysladmins===true||is_teacher===true?
    @@ -326,9 +426,9 @@ class Contentpart extends Component { : this.props.Contentdata.exams.map((object, index) => { return ( this.props.Testpapereditor(e)} - showmodels={(e)=>this.props.showmodels(e)} - showmodelysl={(e)=>this.props.showmodelysl(e)} + Testpapereditor={(e)=>this.Testpapereditor(e)} + showmodels={(e)=>this.showmodels(e)} + showmodelysl={(e)=>this.showmodelysl(e)} Isitapopup={this.props.Isitapopup} showmodelsInaudit={(e)=>this.props.showmodelsInaudit(e)} > diff --git a/public/react/src/modules/testpaper/component/Listjihe.js b/public/react/src/modules/testpaper/component/Listjihe.js index 8dc398e4e..569ab3008 100644 --- a/public/react/src/modules/testpaper/component/Listjihe.js +++ b/public/react/src/modules/testpaper/component/Listjihe.js @@ -10,6 +10,7 @@ import { Radio } from "antd"; import './../testioncss/testioncss.css'; +import Certifiedprofessional from "../../modals/Certifiedprofessional"; const tagArray = [ 'A.', 'B.', 'C.', 'D.', 'E.', 'F.', 'G.', 'H.', 'I.', 'J.', 'K.', 'L.', 'M.', 'N.', 'O.', 'P.', 'Q.', 'R.', @@ -23,12 +24,27 @@ class Listjihe extends Component { name:"单选题", nd:"简单", chakanjiexibool:false, + mydisplay:false, + occupation:2, + isysladmins:false, } } //初始化 componentDidMount(){ - - + let isysladmins=false; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + this.setState({ + isysladmins:isysladmins + }) } chakanjiexibool=()=>{ @@ -55,15 +71,31 @@ class Listjihe extends Component { this.props.getitem_basketss(id); } + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } gotoseesj=(id)=>{ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } this.props.history.push(`/paperlibrary/see/${id}?defaultActiveKey=${this.props.defaultActiveKey}`); } render() { - let {page,name,nd,chakanjiexibool}=this.state; + let {page,name,nd,chakanjiexibool,mydisplay}=this.state; let {defaultActiveKey,items}=this.props; const names= items&&items.name&&items.name; @@ -77,6 +109,27 @@ class Listjihe extends Component { return (
    + { + mydisplay===true? + + + :"" + } + { + mydisplay===true? + + + :"" + }
    From c10833a3eb1548a3f14033988d41f208e9117c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 21 Feb 2020 20:03:12 +0800 Subject: [PATCH 027/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 4 ++-- .../src/modules/question/component/QuestionModalPicture.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 5b5942f22..a5e51a81c 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -42,9 +42,9 @@ if (isDev) { window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' } // 超管 -// debugType="admin"; +debugType="admin"; // 老师 -debugType="teacher"; +// debugType="teacher"; // 学生 // debugType="student"; diff --git a/public/react/src/modules/question/component/QuestionModalPicture.js b/public/react/src/modules/question/component/QuestionModalPicture.js index f54576d61..bf49253ea 100644 --- a/public/react/src/modules/question/component/QuestionModalPicture.js +++ b/public/react/src/modules/question/component/QuestionModalPicture.js @@ -45,7 +45,9 @@ class QuestionModalPicture extends Component {
    {/**/}
    - +
    From 8c3fea2f14f254c1dd2cec6e7e642e030b6c1da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 21 Feb 2020 20:19:32 +0800 Subject: [PATCH 028/100] =?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/component/QuestionModalPicture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/question/component/QuestionModalPicture.js b/public/react/src/modules/question/component/QuestionModalPicture.js index bf49253ea..bd556e338 100644 --- a/public/react/src/modules/question/component/QuestionModalPicture.js +++ b/public/react/src/modules/question/component/QuestionModalPicture.js @@ -46,7 +46,7 @@ class QuestionModalPicture extends Component { {/**/}
    From 0b6416d64e54061e875377b9af7a494438b74b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 21 Feb 2020 21:05:15 +0800 Subject: [PATCH 029/100] =?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 | 54 ++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/question/Paperreview_item.js b/public/react/src/modules/question/Paperreview_item.js index 09dddcfb6..8f3ca4f28 100644 --- a/public/react/src/modules/question/Paperreview_item.js +++ b/public/react/src/modules/question/Paperreview_item.js @@ -85,9 +85,17 @@ class Paperreview_item extends Component { const positions = this.props.single_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + }else { + var data = { + position: positions + } } + axios.post(url, data) .then((result) => { if (result.data.status == 0) { @@ -104,8 +112,18 @@ class Paperreview_item extends Component { const ids = this.props.multiple_questions.questions[result.source.index].id; const positions = this.props.multiple_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + + }else { + var data = { + position: positions + } + } axios.post(url, data) .then((result) => { @@ -125,8 +143,18 @@ class Paperreview_item extends Component { const ids = this.props.judgement_questions.questions[result.source.index].id; const positions = this.props.judgement_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + + + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + + }else { + var data = { + position: positions + } } axios.post(url, data) .then((result) => { @@ -145,8 +173,18 @@ class Paperreview_item extends Component { const ids = this.props.program_questions.questions[result.source.index].id; const positions = this.props.program_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + + + + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + }else { + var data = { + position: positions + } } axios.post(url, data) .then((result) => { From 5e8df535cd1bb1e8cf83b34e64615bbd1cb1ea0a 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, 27 Feb 2020 16:21:51 +0800 Subject: [PATCH 030/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/developer/studentStudy/index.js | 27 +++++++++++++------ public/react/src/services/ojService.js | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index 184ce0af5..2af70efdf 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -1,7 +1,7 @@ /* * @Description: 学员学习 * @Author: tangjiang - * @Github: + * @Github: * @Date: 2019-11-23 10:53:19 * @LastEditors : tangjiang * @LastEditTime : 2020-02-10 18:24:01 @@ -37,7 +37,7 @@ function StudentStudy (props) { } = props; const { - match: { params }, + match: { params }, getUserProgramDetail, saveUserProgramIdentifier } = props; @@ -48,7 +48,18 @@ function StudentStudy (props) { // 保存当前的id saveUserProgramIdentifier(id); // startProgramQuestion(id); - getUserProgramDetail(id); + // console.log("getUserProgramDetail(id)"); + // console.log(id); + // console.log(id.charAt(id.length-1)); + try { + if(id.charAt(id.length-1)==="?"){ + id = id.substring(0, id.length - 1); + } + }catch (e) { + + } + + getUserProgramDetail(id); const $searchs = window.location.search && window.location.search.substring(1); if ($searchs) { const $params = $searchs.split('&') || []; @@ -110,7 +121,7 @@ function StudentStudy (props) { props.clearOjForUserReducer(); props.history.push(`/problems/${identifier}/edit?{searchParams}`); } - // 处理退出 + // 处理退出 const handleClickQuit = () => { // 退出时,清空内容 props.clearOjForUserReducer(); @@ -136,9 +147,9 @@ function StudentStudy (props) {
    {/* to={`/problems/${_hack_id}/edit`} */} - handleClickEditor(hack.identifier)} + onClick={() => handleClickEditor(hack.identifier)} className={`quit-btn`} > 编辑 @@ -161,7 +172,7 @@ function StudentStudy (props) {
    -
    @@ -182,7 +193,7 @@ const mapStateToProps = (state) => { user_program_identifier, hack_identifier, searchParams - }; + }; }; const mapDispatchToProps = (dispatch) => ({ diff --git a/public/react/src/services/ojService.js b/public/react/src/services/ojService.js index d0d0ae0ae..806364ef4 100644 --- a/public/react/src/services/ojService.js +++ b/public/react/src/services/ojService.js @@ -154,4 +154,4 @@ export async function fetchQuestion (params) { export async function fetchTagDisciplines (params) { const url = `/tag_disciplines.json`; return axios.post(url, params); -} \ No newline at end of file +} From 338e4e2902dd5b97806f2aabd1dc1086dbb84869 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, 27 Feb 2020 16:28:05 +0800 Subject: [PATCH 031/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/component/Contentpart.js | 2 +- public/react/src/modules/testpaper/component/Contentpart.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 799875876..955a9d9b8 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -347,7 +347,7 @@ class Contentpart extends Component { ` .xaxisreverseorder .ant-input-group-addon{ - width: 60px !important; + width: 48px !important; } diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index cce165b91..5148e00ca 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -338,7 +338,7 @@ class Contentpart extends Component { { ` .sortinxdirection .ant-input-group-addon{ - width: 60px !important; + width: 48px !important; } From 8c608562c2f690665e714be95ab842aae67a9cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 2 Mar 2020 15:08:58 +0800 Subject: [PATCH 032/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 7ad929ffe..9b832f344 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1065,7 +1065,7 @@ submittojoinclass=(value)=>{ color:#010101 !important; } .queyppors { - top: 63px !important; + top: 42px !important; } .questionbanks .ant-popover-inner-content { @@ -1076,8 +1076,8 @@ submittojoinclass=(value)=>{ { Periofters===true? -
  • - +
  • +
    Date: Tue, 3 Mar 2020 18:41:33 +0800 Subject: [PATCH 033/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 2 +- public/react/src/modules/testpaper/Testpaperlibrary.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index bdb808047..c99957132 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -241,7 +241,7 @@ class Question extends Component { this.setState({ booljupyterurls:false, }) - },1000); + },500); if (response === null || response === undefined) { return diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 76b30d2ba..054f0aced 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -168,7 +168,7 @@ class Testpaperlibrary extends Component { this.setState({ booljupyterurls:false, }) - },1000); + },500); if (response === null || response === undefined) { return From f83c4bc685f4113434b243df48f2b8f3f1ad4214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 3 Mar 2020 18:45:52 +0800 Subject: [PATCH 034/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 2 -- public/react/src/modules/testpaper/Testpaperlibrary.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index c99957132..5afb988ba 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -237,11 +237,9 @@ class Question extends Component { } axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ this.setState({ booljupyterurls:false, }) - },500); if (response === null || response === undefined) { return diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 054f0aced..ca4bd8594 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -164,11 +164,9 @@ class Testpaperlibrary extends Component { } axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ this.setState({ booljupyterurls:false, }) - },500); if (response === null || response === undefined) { return From 76fe1e7cf66ab81d915014f256829751803fb63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 3 Mar 2020 18:47:54 +0800 Subject: [PATCH 035/100] =?UTF-8?q?=E9=A2=98=E5=BA=93=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=EF=BC=88=E7=AD=9B=E9=80=89=E3=80=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=EF=BC=89=E6=80=A7=E8=83=BD=E9=97=AE=E9=A2=98=EF=BC=9A?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=A4=AA=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/testpaper/Testpaperlibrary.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index ca4bd8594..f86fcee81 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -162,7 +162,7 @@ class Testpaperlibrary extends Component { booljupyterurls:true, }) } - + axios.get((url), {params: data}).then((response) => { this.setState({ booljupyterurls:false, From 73d11fdd6e6cda1a950f790ab4a0eaf3c8ee648f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 3 Mar 2020 21:12:18 +0800 Subject: [PATCH 036/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/component/ChoquesEditor.js | 4 ++-- public/react/src/modules/question/component/SingleEditor.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 233c5237d..652a90258 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -425,7 +425,7 @@ class ChoquesEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={item} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} @@ -435,7 +435,7 @@ class ChoquesEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={JSON.parse(item)} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 03f280ced..5bfda9f7a 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -446,7 +446,7 @@ class SingleEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={item} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} @@ -456,7 +456,7 @@ class SingleEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={JSON.parse(item)} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} From 18b13802f063812200d947027c58987dc52f5ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 3 Mar 2020 21:34:37 +0800 Subject: [PATCH 037/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/question/Questionitem_banks.js | 20 ++++++++++++++++++- public/react/src/modules/tpm/NewHeader.js | 7 +++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index d07d593a0..0b8f0213e 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -1,5 +1,5 @@ import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; +import {Link, NavLink,Prompt} from 'react-router-dom'; import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { @@ -172,6 +172,20 @@ class Questionitem_banks extends Component { } + componentWillMount () { + // 拦截判断是否离开当前页面 + window.addEventListener('beforeunload', this.beforeunload); + } + componentWillUnmount () { + // 销毁拦截判断是否离开当前页面 + window.removeEventListener('beforeunload', this.beforeunload); + } + beforeunload (e) { + let confirmationMessage = '你确定离开此页面吗?'; + (e || window.event).returnValue = confirmationMessage; + return confirmationMessage; + } + getdata = (data) => { // const url=`/item_banks.json`; @@ -510,6 +524,10 @@ class Questionitem_banks extends Component {
    + '你确定离开此页面吗?'} + /> :"" - } + { + debugger; let{Addcoursestype}=this.state; this.setState({ isSpin:true }) let {invite_code,professor,assistant_professor,student}=this.state; + invite_code="MBTAP"; if(invite_code===undefined||invite_code===""){ this.setState({ invite_codetype:true, @@ -269,13 +271,18 @@ class Addcourses extends Component{ this.props.history.push('/courses/2704/boards/8367/messages/42072') return; } - if(response.data.course_id!=undefined){ - this.submitasyn(response.data.course_id) - } notification.open({ message:"提示", description:response.data.message - }); + }); + if(response.data.course_id!=undefined){ + this.submitasyn(response.data.course_id) + }else{ + // 无返回课程id则是选择的教师或者助教身份,成功后跳转到课堂首页 + // console.log(this.props); + // console.log(this.props.history.push); + window.location.href="/courses"; + } if(Addcoursestype===true){ this.props.hideAddcoursestype(); } diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 873b1d9d7..e599bfa93 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -73,8 +73,8 @@ class CoursesNew extends Component { period: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period+"", credit: data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit+"", checkboxgroup: data.course_module_types, - Realnamecertification: data.authentication, - Professionalcertification:data.professional_certification, + // Realnamecertification: data.authentication, + // Professionalcertification:data.professional_certification, endtime: data.end_date === undefined ? "" : moment(data.end_date, dateFormat), school:data.school @@ -84,8 +84,8 @@ class CoursesNew extends Component { datatime: data.end_date, dataname:data.name, is_public: data.is_public === 1 ? true : false, - Realnamecertification: data.authentication, - Professionalcertification:data.professional_certification, + // Realnamecertification: data.authentication, + // Professionalcertification:data.professional_certification, addonAfteronelenone: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period, addonAfteronelentwo:data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit, @@ -237,8 +237,8 @@ class CoursesNew extends Component { end_date: datatime===undefined?"":datatime, is_public: is_public === true || is_public === 1 ? 1 : 0, course_module_types: values.checkboxgroup, - authentication: this.state.Realnamecertification, - professional_certification: this.state.Professionalcertification, + // authentication: this.state.Realnamecertification, + // professional_certification: this.state.Professionalcertification, school:values.school } ).then((response) => { @@ -313,8 +313,8 @@ class CoursesNew extends Component { end_date: datatime===undefined?"":datatime, is_public: is_public === true || is_public === 1 ? 1 : 0, course_module_types: values.checkboxgroup, - authentication: this.state.Realnamecertification, - professional_certification: this.state.Professionalcertification, + // authentication: this.state.Realnamecertification, + // professional_certification: this.state.Professionalcertification, school:values.school } ).then((response) => { @@ -953,7 +953,7 @@ class CoursesNew extends Component { )}
    -
    + {/*
    -
    +
    */}
    { + if(info.response){ let shixunId = this.props.match.params.shixunId; let {message,filspath}=this.state; if(message===""||message===undefined){ @@ -105,13 +109,20 @@ class RepositoryAddFileupload_files extends Component { secret_repository:Repositoryflag }}) .then((response) => { - if (response.data.status == 0) { - this.props.showNotification("删除成功") + if (response.data.status === 0) { + let fileList = this.state.fileList.filter(item=>item.uid !== info.uid); + this.setState({ + fileList + }) + this.props.showNotification("删除成功"); } }) .catch(function (error) { console.log(error); }); + }else{ + this.props.showNotification("还未上传完成,无法进行删除操作!"); + } } FormInput=(e)=>{ @@ -195,7 +206,7 @@ class RepositoryAddFileupload_files extends Component { return false } - this.props.showNotification("上传成功") + // this.props.showNotification("上传成功"); }, }; From f614c99827291c79988081da2a76559b1edb46a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 19:38:26 +0800 Subject: [PATCH 054/100] =?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/testpaper/Intecomponents.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/public/react/src/modules/testpaper/Intecomponents.js b/public/react/src/modules/testpaper/Intecomponents.js index 8776b6a9e..ce5040821 100644 --- a/public/react/src/modules/testpaper/Intecomponents.js +++ b/public/react/src/modules/testpaper/Intecomponents.js @@ -282,6 +282,34 @@ class Intecomponents extends Component { } preservation = () => { + + let mylistcour=1; + try { + mylistcour=this.state.single_question_count+this.state.multiple_question_count+this.state.judgement_question_count+this.state.program_question_count + }catch (e) { + + } + if(mylistcour===0){ + this.props.showNotification(`没有题不能组卷`); + return; + } + + let arraycour=1; + try { + arraycour=this.Judquestio.Getdatas()[3].rbdxt+this.Judquestio.Getdatas()[4].rbdxtx+ this.Judquestio.Getdatas()[5].rbpdt+this.Judquestio.Getdatas()[6].rbbct + + }catch (e) { + + } + + if(arraycour===0){ + this.props.showNotification(`没有设置题型及数量不能组卷`); + return; + } + + + + if (this.Judquestio.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return; From 9daef0475ff10ed7033a056bca504123b4da7690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 19:39:43 +0800 Subject: [PATCH 055/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index dccdbc5a7..8d3c85378 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{ ` } - { - Periofters===true? -
  • - -
    -
    - 题库 -
    -
    -
    -
  • - :"" - } + {/*{*/} + {/* Periofters===true?*/} + {/*
  • */} + {/* */} + {/*
    */} + {/*
    */} + {/* 题库*/} + {/*
    */} + {/*
    */} + {/*
    */} + {/*
  • */} + {/* :""*/} + {/*}*/}
  • Date: Fri, 6 Mar 2020 20:04:35 +0800 Subject: [PATCH 056/100] issue --- .../react/src/modules/courses/boards/index.js | 10 ++-- .../courses/coursesPublic/Addcourses.js | 2 - .../RepositoryAddFileupload_file.js | 46 +++++++++---------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/courses/boards/index.js b/public/react/src/modules/courses/boards/index.js index ea49e862b..9c18313fe 100644 --- a/public/react/src/modules/courses/boards/index.js +++ b/public/react/src/modules/courses/boards/index.js @@ -98,12 +98,12 @@ class Boards extends Component{ this.fetchBoards() this.fetchAll() - on('updateNavSuccess', this.updateNavSuccess) + // on('updateNavSuccess', this.updateNavSuccess) } - componentWillUnmount() { - off('updateNavSuccess', this.updateNavSuccess) - } + // componentWillUnmount() { + // off('updateNavSuccess', this.updateNavSuccess) + // } updateNavSuccess = () => { this.fetchBoards() if (this.props.match.params.boardId == this.state.boardid) { @@ -112,7 +112,7 @@ class Boards extends Component{ } componentDidUpdate = (prevProps) => { - if ( prevProps.match.params.boardId != this.props.match.params.boardId ) { + if ( prevProps.match.params.boardId !== this.props.match.params.boardId ) { this.setState({ isSpin:true }) diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index ab26787ea..fb0a8a920 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -194,13 +194,11 @@ class Addcourses extends Component{ } submittojoinclass=()=>{ - debugger; let{Addcoursestype}=this.state; this.setState({ isSpin:true }) let {invite_code,professor,assistant_professor,student}=this.state; - invite_code="MBTAP"; if(invite_code===undefined||invite_code===""){ this.setState({ invite_codetype:true, diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js index 71161bb89..eb0557472 100644 --- a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js +++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js @@ -65,7 +65,6 @@ class RepositoryAddFileupload_files extends Component { fileList = fileList.map(file => { if (file.response) { if (file.response.status===0) { - } } return file; @@ -76,34 +75,35 @@ class RepositoryAddFileupload_files extends Component { }; onAttachmentRemove=(info)=>{ + console.log(info); if(info.response){ - let shixunId = this.props.match.params.shixunId; - let {message,filspath}=this.state; - if(message===""||message===undefined){ - this.props.showNotification('删除文件请先填写提交信息'); - return - } + let shixunId = this.props.match.params.shixunId; + let {message,filspath}=this.state; + if(message===""||message===undefined){ + this.props.showNotification('删除文件请先填写提交信息'); + return; + } - let matchpath =this.props.match.path; + let matchpath =this.props.match.path; - let Repositoryflag =undefined; + let Repositoryflag =undefined; - if( matchpath.indexOf("repository")>-1){ - Repositoryflag =undefined; - } - if(matchpath.indexOf("secret_repository")>-1){ - Repositoryflag =true; - } + if( matchpath.indexOf("repository")>-1){ + Repositoryflag =undefined; + } + if(matchpath.indexOf("secret_repository")>-1){ + Repositoryflag =true; + } - let newfilspath=filspath; + let newfilspath=filspath; - if(newfilspath===""){ - newfilspath=info.name - }else{ - newfilspath=filspath+"/"+info.name - } - const url = `/shixuns//${shixunId}/delete_git_file.json`; - axios.delete(url, { data: { + if(newfilspath===""){ + newfilspath=info.name + }else{ + newfilspath=filspath+"/"+info.name + } + const url = `/shixuns//${shixunId}/delete_git_file.json`; + axios.delete(url, { data: { path:newfilspath, message:message, secret_repository:Repositoryflag From 760c2edfddaba7770828c0d65097abd9be26aba0 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 6 Mar 2020 20:31:36 +0800 Subject: [PATCH 057/100] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BC=9A=E5=8F=A0=E5=8A=A0=E5=8F=8A?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BC=9A=E6=8D=A2=E6=88=90=E5=9C=A8?= =?UTF-8?q?=E5=8F=A6=E5=A4=96=E4=B8=80=E4=B8=AA=E8=AF=BE=E5=A0=82=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8D=E5=AF=B9=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/statics/index.js | 10 ++++++---- public/react/src/redux/actions/static.js | 4 +++- public/react/src/redux/reducers/staticReducer.js | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index aa5592cd4..b4eeec035 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -23,7 +23,7 @@ const App = (props) => { total, staticList, changeParams, - initTotal + initTotal, } = props; // const [datas, setDatas] = useState([]); // const [sortedInfo, setSortedInfo] = useState({}); @@ -212,7 +212,8 @@ const App = (props) => { sorter: (a, b) => a.cost_time - b.cost_time } ]; - + + useEffect(() => { changeParams({ page: 1 @@ -224,6 +225,7 @@ const App = (props) => { pathId && staticList(pathId); } + // const { // study_count, // course_study_count, @@ -249,7 +251,6 @@ const App = (props) => { // 恢复初始值 changeParams(params); initTotal(); - console.log(staticList) pathId && staticList(pathId); } @@ -335,8 +336,9 @@ const mapStateToProps = (state) => { return { subject_info, other_info, - total + total, } + }; const mapDispatchToProps = (dispatch) => ({ diff --git a/public/react/src/redux/actions/static.js b/public/react/src/redux/actions/static.js index bc689c868..77c4e0267 100644 --- a/public/react/src/redux/actions/static.js +++ b/public/react/src/redux/actions/static.js @@ -12,13 +12,15 @@ import { fetchStaticList } from "../../services/staticService"; export const staticList = (id) => { return (dispatch, getState) => { const { params, total_count, other_info } = getState().staticReducer; - if (other_info.length===20||total_count !== 0 && total_count === other_info.length) return; + // console.log('统计数据=====>>>>>', params); + // if (total_count !== 0 && total_count === other_info.length) return; fetchStaticList(id, params).then(res => { // console.log('统计数据=====>>>>>', res); const {data} = res; if (data.status === 0) { dispatch({ type: types.GET_STATIC_INFO, + other_info:data.data.other_info, payload: data.data }); } diff --git a/public/react/src/redux/reducers/staticReducer.js b/public/react/src/redux/reducers/staticReducer.js index 7d2202d03..3790b2638 100644 --- a/public/react/src/redux/reducers/staticReducer.js +++ b/public/react/src/redux/reducers/staticReducer.js @@ -38,12 +38,14 @@ const initalState = { const staticReducer = (state = initalState, action) => { const { payload = {}, type } = action; const {subject_info, other_info = [], total = {}, total_count} = payload; + switch (type) { case types.GET_STATIC_INFO: return { ...state, subject_info, - other_info: state.other_info.concat(other_info), + other_info, + // other_info: state.other_info.concat(other_info), total, total_count, params: Object.assign({}, state.params, { page: state.params.page + 1 }) From 2de1014d4b65f7acddf25c3122b0450ded195b27 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Mar 2020 20:47:38 +0800 Subject: [PATCH 058/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homework_commons_controller.rb | 1084 ++++++++--------- 1 file changed, 515 insertions(+), 569 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index d4e7ae4a3..415207707 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -58,7 +58,7 @@ class HomeworkCommonsController < ApplicationController end @published_count = @user_course_identity < Course::STUDENT ? @homework_commons.homework_published.size : - @homework_commons.size + @homework_commons.size unless search.blank? @homework_commons = @homework_commons.where("homework_commons.name like ?", "%#{search}%") @@ -110,7 +110,7 @@ class HomeworkCommonsController < ApplicationController if @homework_type == 4 @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :shixuns, :course_second_category, user: :user_extension) elsif @homework_type == 3 - @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :homework_detail_group, :course_second_category, user: :user_extension) + @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :homework_detail_group, :course_second_category, user: :user_extension) else @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :course_second_category, user: :user_extension) end @@ -128,7 +128,7 @@ class HomeworkCommonsController < ApplicationController if @homework.publish_time.blank? || (@homework.publish_time > Time.now) @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") - normal_status(-1,"作业未发布") + normal_status(-1, "作业未发布") end else if @user_course_identity == Course::STUDENT @@ -145,14 +145,14 @@ class HomeworkCommonsController < ApplicationController # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段 if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) && - ((!@homework.anonymous_comment && @homework.end_or_late) || (@homework_detail_manual.comment_status > 4 && @homework.end_or_late)) + ((!@homework.anonymous_comment && @homework.end_or_late) || (@homework_detail_manual.comment_status > 4 && @homework.end_or_late)) @student_works = student_works.where("student_works.user_id != #{@work.user_id}") # 匿评、申诉阶段只能看到分配给自己的匿评作品 elsif @work&.work_status.to_i > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2 && @homework_detail_manual.comment_status <= 4 @is_evaluation = true @student_works = student_works.joins(:student_works_evaluation_distributions).where( - "student_works_evaluation_distributions.user_id = #{@current_user.id}") + "student_works_evaluation_distributions.user_id = #{@current_user.id}") else @student_works = [] end @@ -173,7 +173,7 @@ class HomeworkCommonsController < ApplicationController unless params[:teacher_comment].blank? student_work_ids = StudentWorksScore.where(student_work_id: @student_works.map(&:id)).pluck(:student_work_id) if params[:teacher_comment].to_i == 0 - @student_works = @student_works.where.not(id: student_work_ids) + @student_works = @student_works.where.not(id: student_work_ids) elsif params[:teacher_comment].to_i == 1 @student_works = @student_works.where(id: student_work_ids) end @@ -182,7 +182,7 @@ class HomeworkCommonsController < ApplicationController # 作品状态 0: 未提交, 1 按时提交, 2 延迟提交 if params[:work_status].present? params_work_status = params[:work_status] - work_status = params_work_status.map{|status| status.to_i} + work_status = params_work_status.map {|status| status.to_i} if @homework.homework_type == "practice" @student_works = @student_works.where(compelete_status: work_status) else @@ -241,17 +241,17 @@ class HomeworkCommonsController < ApplicationController if @user_course_identity >= Course::STUDENT tip_exception(403, "无权限操作") elsif @work_excel.blank? || @work_excel.size == 0 - normal_status(-1,"暂无用户提交!") + normal_status(-1, "暂无用户提交!") elsif params[:export].present? && params[:export] - normal_status(0,"正在下载中") + normal_status(0, "正在下载中") else respond_to do |format| - format.xlsx{ + format.xlsx { set_export_cookies - student_work_to_xlsx(@work_excel,@homework) + student_work_to_xlsx(@work_excel, @homework) exercise_export_name = "#{current_user.real_name}_#{@course.name}_#{@homework.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}" - render xlsx: "#{exercise_export_name.strip}",template: "homework_commons/works_list.xlsx.axlsx",locals: - {table_columns: @work_head_cells,task_users: @work_cells_column} + render xlsx: "#{exercise_export_name.strip}", template: "homework_commons/works_list.xlsx.axlsx", locals: + {table_columns: @work_head_cells, task_users: @work_cells_column} } end end @@ -268,10 +268,10 @@ class HomeworkCommonsController < ApplicationController if status == 0 if params[:export].present? && params[:export] - normal_status(0,"正在下载中") + normal_status(0, "正在下载中") else respond_to do |format| - format.zip{ + format.zip { set_export_cookies zipfile = zip_homework_common @homework, zip_works file = decode64(zipfile[0][:base64file]) @@ -289,33 +289,21 @@ class HomeworkCommonsController < ApplicationController def update_score tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now - begin - @homework.update_homework_work_score - normal_status("更新成功") - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback - end + @homework.update_homework_work_score + normal_status("更新成功") end def update_student_score work = @homework.student_works.find_by(user_id: current_user.id) myshixun = Myshixun.find_by(shixun_id: params[:shixun_id], user_id: current_user.id) ActiveRecord::Base.transaction do - begin - if work && myshixun - challenge_settings = @homework.homework_challenge_settings - games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) - HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings - normal_status("更新成功") - else - normal_status("还未开启挑战,暂不能更新成绩") - end - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + if work && myshixun + challenge_settings = @homework.homework_challenge_settings + games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) + HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings + normal_status("更新成功") + else + normal_status("还未开启挑战,暂不能更新成绩") end end end @@ -382,41 +370,35 @@ class HomeworkCommonsController < ApplicationController end ActiveRecord::Base.transaction do - begin - @homework = HomeworkCommon.new(homework_params) - @homework.reference_answer = params[:reference_answer].to_s.strip - @homework.homework_type = @homework_type - @homework.user_id = current_user.id - @homework.course_id = @course.id - - homework_detail_manual = HomeworkDetailManual.new - @homework.homework_detail_manual = homework_detail_manual - homework_detail_manual.te_proportion = 0.7 - homework_detail_manual.ta_proportion = 0.3 - - if @homework_type == 3 - homework_detail_group = HomeworkDetailGroup.new(min_num: params[:min_num].to_i, max_num: params[:max_num].to_i, - base_on_project: params[:base_on_project]) - @homework.homework_detail_group = homework_detail_group - end + @homework = HomeworkCommon.new(homework_params) + @homework.reference_answer = params[:reference_answer].to_s.strip + @homework.homework_type = @homework_type + @homework.user_id = current_user.id + @homework.course_id = @course.id + + homework_detail_manual = HomeworkDetailManual.new + @homework.homework_detail_manual = homework_detail_manual + homework_detail_manual.te_proportion = 0.7 + homework_detail_manual.ta_proportion = 0.3 + + if @homework_type == 3 + homework_detail_group = HomeworkDetailGroup.new(min_num: params[:min_num].to_i, max_num: params[:max_num].to_i, + base_on_project: params[:base_on_project]) + @homework.homework_detail_group = homework_detail_group + end - if @homework.save! - homework_detail_manual.save! if homework_detail_manual - homework_detail_group.save! if homework_detail_group + if @homework.save! + homework_detail_manual.save! if homework_detail_manual + homework_detail_group.save! if homework_detail_group - # 作业描述的附件 - Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] - # 作业参考答案的附件 - Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] + # 作业描述的附件 + Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] + # 作业参考答案的附件 + Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] - HomeworksService.new.create_works_list(@homework, @course) - else - tip_exception("创建失败") - end - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + HomeworksService.new.create_works_list(@homework, @course) + else + tip_exception("创建失败") end end end @@ -432,30 +414,25 @@ class HomeworkCommonsController < ApplicationController end ActiveRecord::Base.transaction do - begin - @homework.update_attributes!(homework_params) - @homework.reference_answer = params[:reference_answer].to_s.strip - - if @homework.homework_type == "group" - homework_detail_group = @homework.homework_detail_group - param_min = params[:min_num].to_i - param_max = params[:max_num].to_i - homework_detail_group.min_num = @homework.has_commit_work ? [param_min, homework_detail_group.min_num].min : param_min - homework_detail_group.max_num = @homework.has_commit_work ? [param_max, homework_detail_group.max_num].max : param_max - homework_detail_group.base_on_project = params[:base_on_project] unless @homework.has_relate_project - homework_detail_group.save! - end - # 作业描述的附件 - Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] - # 作业参考答案的附件 - Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] - - normal_status(0, "更新成功") - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + @homework.update_attributes!(homework_params) + @homework.reference_answer = params[:reference_answer].to_s.strip + + if @homework.homework_type == "group" + homework_detail_group = @homework.homework_detail_group + param_min = params[:min_num].to_i + param_max = params[:max_num].to_i + homework_detail_group.min_num = @homework.has_commit_work ? [param_min, homework_detail_group.min_num].min : param_min + homework_detail_group.max_num = @homework.has_commit_work ? [param_max, homework_detail_group.max_num].max : param_max + homework_detail_group.base_on_project = params[:base_on_project] unless @homework.has_relate_project + homework_detail_group.save! end + # 作业描述的附件 + Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] + # 作业参考答案的附件 + Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] + + normal_status(0, "更新成功") + end end @@ -467,304 +444,298 @@ class HomeworkCommonsController < ApplicationController end def update_settings - begin - # 课堂结束后不能再更新 - unless @course.is_end - - # 发布设置 - UpdateHomeworkPublishSettingService.call(@homework, publish_params) - - # 补交设置 - tip_exception("缺少allow_late参数") if params[:allow_late].nil? - tip_exception("缺少late_penalty参数") if params[:allow_late] && params[:late_penalty].blank? - tip_exception("缺少late_time参数") if params[:allow_late] && params[:late_time].blank? - - current_late_penalty = @homework.late_penalty - if params[:allow_late] - tip_exception("补交结束时间必须晚于截止时间") if params[:late_time] <= strf_time(@homework.end_time) - tip_exception("补交结束时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:late_time] > - strf_time(@course.end_date.end_of_day) - tip_exception("迟交扣分不能小于0") if params[:late_penalty] && params[:late_penalty].to_i < 0 + # 课堂结束后不能再更新 + unless @course.is_end + + # 发布设置 + UpdateHomeworkPublishSettingService.call(@homework, publish_params) + + # 补交设置 + tip_exception("缺少allow_late参数") if params[:allow_late].nil? + tip_exception("缺少late_penalty参数") if params[:allow_late] && params[:late_penalty].blank? + tip_exception("缺少late_time参数") if params[:allow_late] && params[:late_time].blank? + + current_late_penalty = @homework.late_penalty + if params[:allow_late] + tip_exception("补交结束时间必须晚于截止时间") if params[:late_time] <= strf_time(@homework.end_time) + tip_exception("补交结束时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:late_time] > + strf_time(@course.end_date.end_of_day) + tip_exception("迟交扣分不能小于0") if params[:late_penalty] && params[:late_penalty].to_i < 0 + + @homework.allow_late = true + @homework.late_time = params[:late_time] + @homework.late_penalty = params[:late_penalty].to_i + else + @homework.allow_late = false + @homework.late_penalty = 0 + @homework.late_time = nil + end - @homework.allow_late = true - @homework.late_time = params[:late_time] - @homework.late_penalty = params[:late_penalty].to_i - else - @homework.allow_late = false - @homework.late_penalty = 0 - @homework.late_time = nil + # 迟交扣分有变动则更新迟交学生的成绩 + late_penalty_change = @homework.late_penalty != current_late_penalty + + if @homework.homework_type == "practice" + + # 实训作业的评分设置 + tip_exception("总分值不能为空") if params[:total_score].blank? + tip_exception("总分值不能小于0") if params[:total_score].to_i < 0 + tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil? + tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil? + tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank? + tip_exception("效率分不能小于等于0") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f <= 0 + tip_exception("效率分不能大于总分值") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2) + tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank? + tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank? + # tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank? + # tip_exception("缺少challenge_score参数") if params[:challenge_settings][:challenge_score].blank? + # tip_exception("challenge_id参数的长度与challenge_score参数的长度不匹配") if + # params[:challenge_settings][:challenge_score].length != params[:challenge_settings][:challenge_id].length + + sum_challenge_score = params[:challenge_settings].pluck(:challenge_score).reject(&:blank?)&.map {|score| score.to_f}.sum + total_score = params[:work_efficiency] ? (params[:eff_score].to_f + sum_challenge_score) : sum_challenge_score + tip_exception("分值之和必须等于总分值:#{params[:total_score]}分") if params[:total_score].to_f.round(2) != total_score.to_f.round(2) + + current_eff_score = @homework.eff_score.to_f.round(2) + @homework.total_score = params[:total_score] + @homework.work_efficiency = params[:work_efficiency] + @homework.eff_score = params[:work_efficiency] ? params[:eff_score].to_f.round(2) : 0 + + update_eff_score = current_eff_score.round(2) != @homework.eff_score.round(2) + + if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation] + @homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation] + score_change = true end - # 迟交扣分有变动则更新迟交学生的成绩 - late_penalty_change = @homework.late_penalty != current_late_penalty - - if @homework.homework_type == "practice" - - # 实训作业的评分设置 - tip_exception("总分值不能为空") if params[:total_score].blank? - tip_exception("总分值不能小于0") if params[:total_score].to_i < 0 - tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil? - tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil? - tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank? - tip_exception("效率分不能小于等于0") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f <= 0 - tip_exception("效率分不能大于总分值") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2) - tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank? - tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank? - # tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank? - # tip_exception("缺少challenge_score参数") if params[:challenge_settings][:challenge_score].blank? - # tip_exception("challenge_id参数的长度与challenge_score参数的长度不匹配") if - # params[:challenge_settings][:challenge_score].length != params[:challenge_settings][:challenge_id].length - - sum_challenge_score = params[:challenge_settings].pluck(:challenge_score).reject(&:blank?)&.map{|score| score.to_f}.sum - total_score = params[:work_efficiency] ? (params[:eff_score].to_f + sum_challenge_score) : sum_challenge_score - tip_exception("分值之和必须等于总分值:#{params[:total_score]}分") if params[:total_score].to_f.round(2) != total_score.to_f.round(2) - - current_eff_score = @homework.eff_score.to_f.round(2) - @homework.total_score = params[:total_score] - @homework.work_efficiency = params[:work_efficiency] - @homework.eff_score = params[:work_efficiency] ? params[:eff_score].to_f.round(2) : 0 - - update_eff_score = current_eff_score.round(2) != @homework.eff_score.round(2) - - if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation] - @homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation] - score_change = true - end - - @homework_detail_manual.shixun_evaluation = params[:shixun_evaluation].to_i - - if params[:challenge_settings] - params[:challenge_settings].each do |challenge| - setting = @homework.homework_challenge_settings.find_by(challenge_id: challenge[:challenge_id]) - score = challenge[:challenge_score] - if setting && setting.score != score - score_change = true - setting.update_attributes!(score: score) - elsif setting.blank? - score_change = true - HomeworkChallengeSetting.create!(homework_common_id: @homework.id, challenge_id: challenge[:challenge_id], - shixun_id: @homework.homework_commons_shixun.try(:shixun_id), score: score) - end - end + @homework_detail_manual.shixun_evaluation = params[:shixun_evaluation].to_i - if @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).count > 0 + if params[:challenge_settings] + params[:challenge_settings].each do |challenge| + setting = @homework.homework_challenge_settings.find_by(challenge_id: challenge[:challenge_id]) + score = challenge[:challenge_score] + if setting && setting.score != score score_change = true - @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).destroy_all + setting.update_attributes!(score: score) + elsif setting.blank? + score_change = true + HomeworkChallengeSetting.create!(homework_common_id: @homework.id, challenge_id: challenge[:challenge_id], + shixun_id: @homework.homework_commons_shixun.try(:shixun_id), score: score) end end - # 公开设置 - tip_exception("缺少score_open参数") if params[:score_open].nil? - @homework.score_open = params[:score_open] - - @homework.save! - if score_change && @homework.end_or_late_none_group - UpdateShixunWorkScoreJob.perform_later(@homework.id) - elsif update_eff_score && (@homework.end_or_late_none_group || @homework.max_efficiency > 0) - # 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止 或者作业已计算过效率分) - HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id) + if @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).count > 0 + score_change = true + @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).destroy_all end + end - # 更新迟交扣分 - if !(score_change || update_eff_score) && late_penalty_change - @homework.student_works.where(work_status: 2).each do |work| - work.late_penalty = @homework.late_penalty - work.save! - end - end + # 公开设置 + tip_exception("缺少score_open参数") if params[:score_open].nil? + @homework.score_open = params[:score_open] - unless @homework.allow_late - @homework.student_works.where(work_status: 2).update_all(work_status: 1) - end + @homework.save! + if score_change && @homework.end_or_late_none_group + UpdateShixunWorkScoreJob.perform_later(@homework.id) + elsif update_eff_score && (@homework.end_or_late_none_group || @homework.max_efficiency > 0) + # 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止 或者作业已计算过效率分) + HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id) + end - @homework_detail_manual.save! - @homework.save! - else + # 更新迟交扣分 + if !(score_change || update_eff_score) && late_penalty_change + @homework.student_works.where(work_status: 2).each do |work| + work.late_penalty = @homework.late_penalty + work.save! + end + end - # 普通和分组作业的匿评设置 - current_absence_penalty = @homework_detail_manual.absence_penalty - current_appeal_penalty = @homework_detail_manual.appeal_penalty - - # 匿评未开启前可以更新:是否开启匿评、匿评开始时间、匿评数 - if @homework_detail_manual.comment_status < 3 - tip_exception("缺少anonymous_comment参数") if params[:anonymous_comment].nil? - # anonymous_comment :true 是启用,false 是不启用 - if params[:anonymous_comment] - tip_exception("匿评开启时间不能为空") if params[:evaluation_start].blank? - tip_exception("匿评开启时间不能早于截止时间") if params[:evaluation_start] < strf_time(@homework.end_time) - tip_exception("匿评结束时间不能为空") if params[:evaluation_end].blank? - tip_exception("匿评截止时间必须晚于匿评开启时间") if params[:evaluation_end] <= params[:evaluation_start] - tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:evaluation_end] > - strf_time(@course.end_date.end_of_day) - tip_exception("匿评数必须为正整数") if params[:evaluation_num].blank? || params[:evaluation_num].to_i < 1 - tip_exception("缺评扣分不能为空") if params[:absence_penalty].blank? - tip_exception("缺评扣分不能小于0") if params[:absence_penalty].to_i < 0 - tip_exception("缺评扣分不能大于100") if params[:absence_penalty].to_i > 100 - end + unless @homework.allow_late + @homework.student_works.where(work_status: 2).update_all(work_status: 1) + end - @homework.anonymous_comment = params[:anonymous_comment] - @homework_detail_manual.evaluation_start = !@homework.anonymous_comment ? nil : params[:evaluation_start] - @homework_detail_manual.evaluation_num = !@homework.anonymous_comment ? 0 : params[:evaluation_num] - - # 不启用匿评时还原申诉设置和教师、助教的评分比例 - unless @homework.anonymous_comment - @homework.anonymous_appeal = false - @homework_detail_manual.appeal_time = nil - @homework_detail_manual.appeal_penalty = 0 - @homework_detail_manual.te_proportion = 1 - @homework_detail_manual.ta_proportion = 0 - end + @homework_detail_manual.save! + @homework.save! + else + # 普通和分组作业的匿评设置 + current_absence_penalty = @homework_detail_manual.absence_penalty + current_appeal_penalty = @homework_detail_manual.appeal_penalty + + # 匿评未开启前可以更新:是否开启匿评、匿评开始时间、匿评数 + if @homework_detail_manual.comment_status < 3 + tip_exception("缺少anonymous_comment参数") if params[:anonymous_comment].nil? + # anonymous_comment :true 是启用,false 是不启用 + if params[:anonymous_comment] + tip_exception("匿评开启时间不能为空") if params[:evaluation_start].blank? + tip_exception("匿评开启时间不能早于截止时间") if params[:evaluation_start] < strf_time(@homework.end_time) + tip_exception("匿评结束时间不能为空") if params[:evaluation_end].blank? + tip_exception("匿评截止时间必须晚于匿评开启时间") if params[:evaluation_end] <= params[:evaluation_start] + tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:evaluation_end] > + strf_time(@course.end_date.end_of_day) + tip_exception("匿评数必须为正整数") if params[:evaluation_num].blank? || params[:evaluation_num].to_i < 1 + tip_exception("缺评扣分不能为空") if params[:absence_penalty].blank? + tip_exception("缺评扣分不能小于0") if params[:absence_penalty].to_i < 0 + tip_exception("缺评扣分不能大于100") if params[:absence_penalty].to_i > 100 end - # 匿评未截止时可以更新匿评结束时间 - if @homework_detail_manual.comment_status < 4 - tip_exception("匿评结束时间不能为空") if @homework.anonymous_comment && params[:evaluation_end].blank? - tip_exception("匿评截止时间必须晚于匿评开启时间") if @homework.anonymous_comment && - params[:evaluation_end] <= strf_time(@homework_detail_manual.evaluation_start) - tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_comment && - @course.end_date.present? && params[:evaluation_end] > strf_time(@course.end_date.end_of_day) + @homework.anonymous_comment = params[:anonymous_comment] + @homework_detail_manual.evaluation_start = !@homework.anonymous_comment ? nil : params[:evaluation_start] + @homework_detail_manual.evaluation_num = !@homework.anonymous_comment ? 0 : params[:evaluation_num] - @homework_detail_manual.evaluation_end = !@homework.anonymous_comment ? nil : params[:evaluation_end] + # 不启用匿评时还原申诉设置和教师、助教的评分比例 + unless @homework.anonymous_comment + @homework.anonymous_appeal = false + @homework_detail_manual.appeal_time = nil + @homework_detail_manual.appeal_penalty = 0 + @homework_detail_manual.te_proportion = 1 + @homework_detail_manual.ta_proportion = 0 end - # 作业未结束可以更新缺评扣分 - tip_exception("缺评扣分不能为空") if @homework.anonymous_comment && params[:absence_penalty].blank? - tip_exception("缺评扣分不能小于0") if @homework.anonymous_comment && params[:absence_penalty].to_i < 0 - tip_exception("缺评扣分不能大于100") if @homework.anonymous_comment && params[:absence_penalty].to_i > 100 - @homework_detail_manual.absence_penalty = !@homework.anonymous_comment ? 0 : params[:absence_penalty].to_i + end + # 匿评未截止时可以更新匿评结束时间 + if @homework_detail_manual.comment_status < 4 + tip_exception("匿评结束时间不能为空") if @homework.anonymous_comment && params[:evaluation_end].blank? + tip_exception("匿评截止时间必须晚于匿评开启时间") if @homework.anonymous_comment && + params[:evaluation_end] <= strf_time(@homework_detail_manual.evaluation_start) + tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_comment && + @course.end_date.present? && params[:evaluation_end] > strf_time(@course.end_date.end_of_day) - # 匿评申诉设置 - # 匿评申诉未开启前可以更新:是否启用匿评申诉 - if @homework_detail_manual.comment_status < 4 && @homework.anonymous_comment - tip_exception("缺少anonymous_appeal参数") if params[:anonymous_appeal].nil? - @homework.anonymous_appeal = params[:anonymous_appeal] - end + @homework_detail_manual.evaluation_end = !@homework.anonymous_comment ? nil : params[:evaluation_end] + end + # 作业未结束可以更新缺评扣分 + tip_exception("缺评扣分不能为空") if @homework.anonymous_comment && params[:absence_penalty].blank? + tip_exception("缺评扣分不能小于0") if @homework.anonymous_comment && params[:absence_penalty].to_i < 0 + tip_exception("缺评扣分不能大于100") if @homework.anonymous_comment && params[:absence_penalty].to_i > 100 + @homework_detail_manual.absence_penalty = !@homework.anonymous_comment ? 0 : params[:absence_penalty].to_i - # 匿评申诉未结束前可以更新:匿评申诉结束时间 - if @homework_detail_manual.comment_status < 5 - tip_exception("匿评申诉结束时间不能为空") if @homework.anonymous_appeal && params[:appeal_time].blank? - tip_exception("匿评开启时间不能早于匿评截止时间") if @homework.anonymous_appeal && - params[:appeal_time] <= strf_time(@homework_detail_manual.evaluation_end) - tip_exception("匿评申诉结束不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_appeal && - @course.end_date.present? && params[:appeal_time] > strf_time(@course.end_date.end_of_day) - @homework_detail_manual.appeal_time = @homework.anonymous_appeal ? params[:appeal_time] : nil - end + # 匿评申诉设置 + # 匿评申诉未开启前可以更新:是否启用匿评申诉 + if @homework_detail_manual.comment_status < 4 && @homework.anonymous_comment + tip_exception("缺少anonymous_appeal参数") if params[:anonymous_appeal].nil? + @homework.anonymous_appeal = params[:anonymous_appeal] + end - # 作业未结束可以更新违规匿评扣分 - tip_exception("违规匿评扣分不能为空") if @homework.anonymous_appeal && params[:appeal_penalty].blank? - tip_exception("违规匿评扣分不能小于0") if @homework.anonymous_appeal && params[:appeal_penalty].to_i < 0 - tip_exception("违规匿评扣分不能大于100") if @homework.anonymous_appeal && params[:appeal_penalty].to_i > 100 - @homework_detail_manual.appeal_penalty = @homework.anonymous_appeal ? params[:appeal_penalty].to_i : 0 - - # 如果缺评扣分的设置有变更且匿评已截止 - absence_penalty_change = current_absence_penalty != @homework_detail_manual.absence_penalty && - @homework_detail_manual.comment_status >= 4 - # 如果违规匿评扣分的设置有变更且匿评已截止 - appeal_penalty_change = current_appeal_penalty != @homework_detail_manual.appeal_penalty && - @homework_detail_manual.comment_status >= 4 - - # 评分设置 - tip_exception("助教评分模式不能为空") if params[:ta_mode].blank? - - # 助教评分模式的变更 - ta_mode_change = @homework_detail_manual.ta_mode != params[:ta_mode].to_i - @homework_detail_manual.ta_mode = params[:ta_mode].to_i - - # 最终成绩组成 - tip_exception("最终成绩组成模式不能为空") if params[:final_mode].nil? - - final_mode_change = @homework_detail_manual.final_mode != params[:final_mode] - @homework_detail_manual.final_mode = params[:final_mode] - if !@homework_detail_manual.final_mode - tip_exception("教师评分比例不能为空") if params[:te_proportion].blank? - te_proportion = params[:te_proportion].to_f.round(2) - tip_exception("教师评分比例不能小于0") if te_proportion < 0 - tip_exception("助教评分比例不能为空") if params[:ta_proportion].blank? - ta_proportion = params[:ta_proportion].to_f.round(2) - tip_exception("助教评分比例不能小于0") if ta_proportion < 0 - if !@homework.anonymous_comment - tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion) > 1.0 - else - tip_exception("学生评分比例不能为空") if params[:st_proportion].blank? - st_proportion = params[:st_proportion].to_f.round(2) - tip_exception("学生评分比例不能小于0") if st_proportion < 0 - tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion + st_proportion) > 1.0 - end - proportion_change = @homework_detail_manual.te_proportion.round(2) != te_proportion || - @homework_detail_manual.ta_proportion.round(2) != ta_proportion - @homework_detail_manual.te_proportion = te_proportion - @homework_detail_manual.ta_proportion = ta_proportion + # 匿评申诉未结束前可以更新:匿评申诉结束时间 + if @homework_detail_manual.comment_status < 5 + tip_exception("匿评申诉结束时间不能为空") if @homework.anonymous_appeal && params[:appeal_time].blank? + tip_exception("匿评开启时间不能早于匿评截止时间") if @homework.anonymous_appeal && + params[:appeal_time] <= strf_time(@homework_detail_manual.evaluation_end) + tip_exception("匿评申诉结束不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_appeal && + @course.end_date.present? && params[:appeal_time] > strf_time(@course.end_date.end_of_day) + + @homework_detail_manual.appeal_time = @homework.anonymous_appeal ? params[:appeal_time] : nil + end + + # 作业未结束可以更新违规匿评扣分 + tip_exception("违规匿评扣分不能为空") if @homework.anonymous_appeal && params[:appeal_penalty].blank? + tip_exception("违规匿评扣分不能小于0") if @homework.anonymous_appeal && params[:appeal_penalty].to_i < 0 + tip_exception("违规匿评扣分不能大于100") if @homework.anonymous_appeal && params[:appeal_penalty].to_i > 100 + @homework_detail_manual.appeal_penalty = @homework.anonymous_appeal ? params[:appeal_penalty].to_i : 0 + + # 如果缺评扣分的设置有变更且匿评已截止 + absence_penalty_change = current_absence_penalty != @homework_detail_manual.absence_penalty && + @homework_detail_manual.comment_status >= 4 + # 如果违规匿评扣分的设置有变更且匿评已截止 + appeal_penalty_change = current_appeal_penalty != @homework_detail_manual.appeal_penalty && + @homework_detail_manual.comment_status >= 4 + + # 评分设置 + tip_exception("助教评分模式不能为空") if params[:ta_mode].blank? + + # 助教评分模式的变更 + ta_mode_change = @homework_detail_manual.ta_mode != params[:ta_mode].to_i + @homework_detail_manual.ta_mode = params[:ta_mode].to_i + + # 最终成绩组成 + tip_exception("最终成绩组成模式不能为空") if params[:final_mode].nil? + + final_mode_change = @homework_detail_manual.final_mode != params[:final_mode] + @homework_detail_manual.final_mode = params[:final_mode] + if !@homework_detail_manual.final_mode + tip_exception("教师评分比例不能为空") if params[:te_proportion].blank? + te_proportion = params[:te_proportion].to_f.round(2) + tip_exception("教师评分比例不能小于0") if te_proportion < 0 + tip_exception("助教评分比例不能为空") if params[:ta_proportion].blank? + ta_proportion = params[:ta_proportion].to_f.round(2) + tip_exception("助教评分比例不能小于0") if ta_proportion < 0 + if !@homework.anonymous_comment + tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion) > 1.0 else - @homework_detail_manual.te_proportion = 1 - @homework_detail_manual.ta_proportion = 0 + tip_exception("学生评分比例不能为空") if params[:st_proportion].blank? + st_proportion = params[:st_proportion].to_f.round(2) + tip_exception("学生评分比例不能小于0") if st_proportion < 0 + tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion + st_proportion) > 1.0 end - # 公开属性设置 - tip_exception("缺少work_public参数") if params[:work_public].nil? - tip_exception("缺少score_open参数") if params[:score_open].nil? - tip_exception("缺少answer_public参数") if params[:answer_public].nil? - @homework.work_public = params[:work_public] - @homework.score_open = params[:score_open] - @homework.answer_public = params[:answer_public] - - @homework_detail_manual.save! - @homework.save! - - # 迟交扣分、缺评扣分、违规匿评扣分、助教评分模式变更、最终成绩组成、评分比例变更都需要更新学生成绩 - if late_penalty_change || absence_penalty_change || appeal_penalty_change || ta_mode_change || - final_mode_change || proportion_change - - student_works = @homework.student_works.has_committed - work_ids = student_works.pluck(:id) - - student_works.each do |student_work| - # 迟交扣分 - student_work.late_penalty = student_work.work_status == 1 ? 0 : @homework.late_penalty - - # 缺评扣分的更新 如果之前的作业缺评扣分为0,则需重新计算缺评次数 - if absence_penalty_change - absence_penalty_count = current_absence_penalty == 0 ? student_work.absence_count : - (student_work.absence_penalty / current_absence_penalty).to_i - student_work.absence_penalty = absence_penalty_count * @homework_detail_manual.absence_penalty - end + proportion_change = @homework_detail_manual.te_proportion.round(2) != te_proportion || + @homework_detail_manual.ta_proportion.round(2) != ta_proportion + @homework_detail_manual.te_proportion = te_proportion + @homework_detail_manual.ta_proportion = ta_proportion + else + @homework_detail_manual.te_proportion = 1 + @homework_detail_manual.ta_proportion = 0 + end - # 违规匿评扣分 如果之前的作业违规扣分为0,则需重新计算违规匿评次数 - if appeal_penalty_change - appeal_penalty_count = current_appeal_penalty == 0 ? student_work.appeal_count : - (student_work.appeal_penalty / current_appeal_penalty).to_i - student_work.appeal_penalty = appeal_penalty_count * @homework_detail_manual.appeal_penalty - end + # 公开属性设置 + tip_exception("缺少work_public参数") if params[:work_public].nil? + tip_exception("缺少score_open参数") if params[:score_open].nil? + tip_exception("缺少answer_public参数") if params[:answer_public].nil? + @homework.work_public = params[:work_public] + @homework.score_open = params[:score_open] + @homework.answer_public = params[:answer_public] + + @homework_detail_manual.save! + @homework.save! + + # 迟交扣分、缺评扣分、违规匿评扣分、助教评分模式变更、最终成绩组成、评分比例变更都需要更新学生成绩 + if late_penalty_change || absence_penalty_change || appeal_penalty_change || ta_mode_change || + final_mode_change || proportion_change + + student_works = @homework.student_works.has_committed + work_ids = student_works.pluck(:id) + + student_works.each do |student_work| + # 迟交扣分 + student_work.late_penalty = student_work.work_status == 1 ? 0 : @homework.late_penalty + + # 缺评扣分的更新 如果之前的作业缺评扣分为0,则需重新计算缺评次数 + if absence_penalty_change + absence_penalty_count = current_absence_penalty == 0 ? student_work.absence_count : + (student_work.absence_penalty / current_absence_penalty).to_i + student_work.absence_penalty = absence_penalty_count * @homework_detail_manual.absence_penalty + end - # 助教模式变更且有助教评分记录时才更新 - if ta_mode_change && student_work.student_works_scores.where("reviewer_role = 2 AND score IS NOT NULL").count > 0 - student_work.teaching_asistant_score = student_work.ta_score @homework_detail_manual.ta_mode - end + # 违规匿评扣分 如果之前的作业违规扣分为0,则需重新计算违规匿评次数 + if appeal_penalty_change + appeal_penalty_count = current_appeal_penalty == 0 ? student_work.appeal_count : + (student_work.appeal_penalty / current_appeal_penalty).to_i + student_work.appeal_penalty = appeal_penalty_count * @homework_detail_manual.appeal_penalty + end - student_work.save! + # 助教模式变更且有助教评分记录时才更新 + if ta_mode_change && student_work.student_works_scores.where("reviewer_role = 2 AND score IS NOT NULL").count > 0 + student_work.teaching_asistant_score = student_work.ta_score @homework_detail_manual.ta_mode end - end + student_work.save! + end end - normal_status(0, "更新成功") - else - tip_exception("课堂已结束不能再更新") + end + normal_status(0, "更新成功") + else + tip_exception("课堂已结束不能再更新") + end # rescue ActiveRecord::RecordInvalid # render_error("保存失败") # rescue ApplicationService::Error => ex # uid_logger(ex.message) # render_error(ex.message) # raise ActiveRecord::Rollback - rescue Exception => e - uid_logger(e.backtrace) - tip_exception(e.message) - raise ActiveRecord::Rollback - end end # 选用实训 @@ -799,7 +770,7 @@ class HomeworkCommonsController < ApplicationController @total_count = @shixuns.size ## 分页参数 - page = params[:page] || 1 + page = params[:page] || 1 @shixuns = @shixuns.reorder("shixuns.created_at desc").includes(:challenges, user: [user_extension: :school]).page(page).per(10) end @@ -822,15 +793,15 @@ class HomeworkCommonsController < ApplicationController def subjects @tags = Repertoire.where(nil).order("updated_at desc") # select = params[:select] # 路径导航类型 - select = params[:type] # 路径导航类型 + select = params[:type] # 路径导航类型 reorder = params[:order] || "myshixun_count" sort = params[:sort] || "desc" search = params[:search] ## 分页参数 - page = params[:page] || 1 + page = params[:page] || 1 limit = params[:limit] || 15 - offset = (page.to_i-1) * limit + offset = (page.to_i - 1) * limit # 最热排序 if reorder == "myshixun_count" @@ -903,8 +874,8 @@ class HomeworkCommonsController < ApplicationController # 为实训作业创建与stage同名的子目录 category = CourseSecondCategory.find_by(name: stage.name, course_id: @course.id, category_type: "shixun_homework") || - CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework", - course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) + CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework", + course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) # 去掉不对当前用户的单位公开的实训,已发布的实训 stage.shixuns.no_jupyter.where(id: shixun_ids).unhidden.each do |shixun| @@ -935,16 +906,14 @@ class HomeworkCommonsController < ApplicationController if params[:detail].blank? tip_exception("缺少截止时间参数") if params[:end_time].blank? tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now) - tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) + tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) else tip_exception("缺少分班截止时间参数") if params[:group_end_times].blank? - group_end_times = params[:group_end_times].reject(&:blank?)&.map{|time| time.to_time} + group_end_times = params[:group_end_times].reject(&:blank?)&.map {|time| time.to_time} tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length group_end_times.each do |time| tip_exception("分班截止时间不能早于当前时间") if time <= Time.now - tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && time > @course.end_date.end_of_day + tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && time > @course.end_date.end_of_day end end @@ -955,94 +924,89 @@ class HomeworkCommonsController < ApplicationController publish_groups = charge_group_ids & group_ids if group_ids # ActiveRecord::Base.transaction do - begin - homeworks.each do |homework| - # 作业未发布时 - if homework.homework_detail_manual.try(:comment_status) == 0 - if !params[:group_ids].blank? - - # 全选即统一设置,unified_setting为true - if @course.course_groups.where(id: publish_groups).size == @course.course_groups.size && - ((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?) - homework.homework_group_settings.destroy_all - homework.unified_setting = true - homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] - else - homework.unified_setting = false - # 创建作业分班设置:homework_group_setting - homework.create_homework_group_settings - - # 选中的分班设置的发布时间改为当前时间,截止时间改为传的截止时间参数 - if params[:detail] - group_ids.each_with_index do |group_id, index| - homework.homework_group_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, - end_time: group_end_times[index]) - end - else - homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now, - end_time: params[:end_time]) - end - # 发消息 - tiding_group_ids = publish_groups - end - else - homework.homework_group_settings.destroy_all - # students = @course.students - end - - homework.publish_time = Time.now - - # 截止时间的处理 - if homework.end_time.nil? - homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] - elsif homework.max_group_end_time - homework.end_time = homework.max_group_end_time - end - homework.homework_detail_manual.update_attributes!(comment_status: 1) - - if homework.course_act.blank? - CourseActivity.create!(user_id: homework.user_id, course_id: homework.course_id, course_act: homework) - end - # 发消息 - HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids) + homeworks.each do |homework| + # 作业未发布时 + if homework.homework_detail_manual.try(:comment_status) == 0 + if !params[:group_ids].blank? + + # 全选即统一设置,unified_setting为true + if @course.course_groups.where(id: publish_groups).size == @course.course_groups.size && + ((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?) + homework.homework_group_settings.destroy_all + homework.unified_setting = true + homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] else + homework.unified_setting = false + # 创建作业分班设置:homework_group_setting homework.create_homework_group_settings - none_publish_settings = homework.homework_group_settings.where(course_group_id: publish_groups).none_published + # 选中的分班设置的发布时间改为当前时间,截止时间改为传的截止时间参数 if params[:detail] group_ids.each_with_index do |group_id, index| - none_publish_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, - end_time: group_end_times[index]) + homework.homework_group_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, + end_time: group_end_times[index]) end else - none_publish_settings.update_all(publish_time: Time.now, end_time: params[:end_time]) + homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now, + end_time: params[:end_time]) end - - if homework.max_group_end_time - homework.end_time = homework.max_group_end_time - end - HomeworkCommonPushNotifyJob.perform_later(homework.id, none_publish_settings.pluck(:course_group_id)) + # 发消息 + tiding_group_ids = publish_groups end + else + homework.homework_group_settings.destroy_all + # students = @course.students + end + homework.publish_time = Time.now - if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1 - homework.homework_detail_manual.update_attributes!(comment_status: 1) - end + # 截止时间的处理 + if homework.end_time.nil? + homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] + elsif homework.max_group_end_time + homework.end_time = homework.max_group_end_time + end + homework.homework_detail_manual.update_attributes!(comment_status: 1) - # 补交结束时间 - homework.late_time = Time.at(homework.end_time.to_i + 30*24*3600) if homework.allow_late && homework.late_time.nil? + if homework.course_act.blank? + CourseActivity.create!(user_id: homework.user_id, course_id: homework.course_id, course_act: homework) + end + # 发消息 + HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids) + else + homework.create_homework_group_settings - homework.save! + none_publish_settings = homework.homework_group_settings.where(course_group_id: publish_groups).none_published + if params[:detail] + group_ids.each_with_index do |group_id, index| + none_publish_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, + end_time: group_end_times[index]) + end + else + none_publish_settings.update_all(publish_time: Time.now, end_time: params[:end_time]) + end - # 更新学生状态及成绩(手动点击计算) - # HomeworkPublishUpdateWorkStatusJob.perform_later(tiding_group_ids, homework.id) + if homework.max_group_end_time + homework.end_time = homework.max_group_end_time end - normal_status(0, "发布成功") - rescue Exception => e - uid_logger(e.message) - tip_exception("发布失败") - raise ActiveRecord::Rollback + HomeworkCommonPushNotifyJob.perform_later(homework.id, none_publish_settings.pluck(:course_group_id)) end + + + if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1 + homework.homework_detail_manual.update_attributes!(comment_status: 1) + end + + # 补交结束时间 + homework.late_time = Time.at(homework.end_time.to_i + 30 * 24 * 3600) if homework.allow_late && homework.late_time.nil? + + homework.save! + + # 更新学生状态及成绩(手动点击计算) + # HomeworkPublishUpdateWorkStatusJob.perform_later(tiding_group_ids, homework.id) + end + normal_status(0, "发布成功") + # end end @@ -1051,9 +1015,9 @@ class HomeworkCommonsController < ApplicationController charge_ids = @course.charge_group_ids(@current_user) if @homework.end_immediately charge_ids # 可立即截止的分班:统一设置则是用户管理的所有分班,否则是当前用户管理的分班中已发布且未截止的 - charge_group_ids = @course.charge_group_ids(@current_user) # 当前用户管理的分班 + charge_group_ids = @course.charge_group_ids(@current_user) # 当前用户管理的分班 group_ids = @homework.unified_setting ? charge_group_ids : - @homework.homework_group_settings.where(course_group_id: charge_group_ids).published_no_end.pluck(:course_group_id) + @homework.homework_group_settings.where(course_group_id: charge_group_ids).published_no_end.pluck(:course_group_id) @course_groups = @course.course_groups.where(id: group_ids) else tip_exception("没有可截止的分班") @@ -1074,56 +1038,50 @@ class HomeworkCommonsController < ApplicationController group_ids = params[:group_ids]&.reject(&:blank?)&.map(&:to_i) end_groups = charge_group_ids & group_ids if group_ids - begin - homeworks.each do |homework| - ActiveRecord::Base.transaction do - homework_detail_manual = homework.homework_detail_manual - - # 分组设置 - if !params[:group_ids].blank? - # 确保之前是统一设置或者有新创建的分班的数据一致性 - homework.create_homework_group_settings + homeworks.each do |homework| + ActiveRecord::Base.transaction do + homework_detail_manual = homework.homework_detail_manual - homework.unified_setting = false if homework.unified_setting && end_groups.length != @course.course_groups_count + # 分组设置 + if !params[:group_ids].blank? + # 确保之前是统一设置或者有新创建的分班的数据一致性 + homework.create_homework_group_settings - # 已发布且未截止的分班 - none_end_settings = homework.homework_group_settings.where(course_group_id: end_groups).published_no_end + homework.unified_setting = false if homework.unified_setting && end_groups.length != @course.course_groups_count - none_end_settings.update_all(end_time: time) - student_works = homework.student_works.where(user_id: course_students.where(course_group_id: none_end_settings. - pluck(:course_group_id)).pluck(:user_id)).has_committed if homework.homework_type == "practice" + # 已发布且未截止的分班 + none_end_settings = homework.homework_group_settings.where(course_group_id: end_groups).published_no_end - homework.end_time = homework.max_group_end_time - if homework.end_time > time && homework_detail_manual.try(:comment_status) > 1 - homework_detail_manual.update_attributes!(comment_status: 1) - end + none_end_settings.update_all(end_time: time) + student_works = homework.student_works.where(user_id: course_students.where(course_group_id: none_end_settings. + pluck(:course_group_id)).pluck(:user_id)).has_committed if homework.homework_type == "practice" - # 统一设置 - elsif homework.unified_setting - student_works = homework.student_works.has_committed if homework.homework_type == "practice" - homework.end_time = time + homework.end_time = homework.max_group_end_time + if homework.end_time > time && homework_detail_manual.try(:comment_status) > 1 + homework_detail_manual.update_attributes!(comment_status: 1) end - # homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time + # 统一设置 + elsif homework.unified_setting + student_works = homework.student_works.has_committed if homework.homework_type == "practice" + homework.end_time = time + end + + # homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time - # 实训作业的作品需要计算是否迟交 - if homework.homework_type == "practice" - # shixun = homework.shixuns.first - # homework_challenge_settings = homework.homework_challenge_settings - unless student_works.blank? - student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty) if homework.allow_late - end + # 实训作业的作品需要计算是否迟交 + if homework.homework_type == "practice" + # shixun = homework.shixuns.first + # homework_challenge_settings = homework.homework_challenge_settings + unless student_works.blank? + student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty) if homework.allow_late end - homework.save! end - HomeworkEndUpdateScoreJob.perform_later(homework.id) if !homework.allow_late && homework.end_time <= time + homework.save! end - normal_status(0, "更新成功") - rescue Exception => e - uid_logger(e.message) - tip_exception("操作失败") - raise ActiveRecord::Rollback + HomeworkEndUpdateScoreJob.perform_later(homework.id) if !homework.allow_late && homework.end_time <= time end + normal_status(0, "更新成功") end def set_public @@ -1156,19 +1114,13 @@ class HomeworkCommonsController < ApplicationController # 删除多个作业 def multi_destroy ActiveRecord::Base.transaction do - begin - homeworks = @course.homework_commons.where(id: params[:homework_ids]) - homeworks.destroy_all - - # 这些写是因为model中的关联删除无法删除is_delete=0的作品 - StudentWork.where(homework_common_id: homeworks.pluck(:id)).destroy_all - normal_status(0, "删除成功") - - rescue Exception => e - uid_logger(e.message) - tip_exception("删除失败") - raise ActiveRecord::Rollback - end + homeworks = @course.homework_commons.where(id: params[:homework_ids]) + homeworks.destroy_all + + # 这些写是因为model中的关联删除无法删除is_delete=0的作品 + StudentWork.where(homework_common_id: homeworks.pluck(:id)).destroy_all + normal_status(0, "删除成功") + end end @@ -1178,41 +1130,35 @@ class HomeworkCommonsController < ApplicationController homeworks.each do |homework| ActiveRecord::Base.transaction do - begin - homework_bank = current_user.homework_banks.find_by(homework_common_id: homework.id) - if homework_bank.present? - # 如果作业加入过题库则更新参数 - if homework_bank.homework_type == 1 - homework_bank.update_attributes!(name: homework.name, description: homework.description, - reference_answer: homework.reference_answer, course_list_id: @course.course_list_id) - elsif homework_bank.homework_type == 3 - homework_detail_group = homework.homework_detail_group - homework_bank.update_attributes!(name: homework.name, description: homework.description, - reference_answer: homework.reference_answer, course_list_id: @course.course_list_id, - min_num: homework_detail_group.min_num, max_num: homework_detail_group.max_num, - base_on_project: homework_detail_group.base_on_project) - end - - # 附件的更新 - homework_bank.attachments.destroy_all - homework.attachments.each do |attachment| - att = attachment.copy - att.author_id = homework_bank.user_id - att.copy_from = attachment.id - homework_bank.attachments << att - end - else - new_homework_bank = add_to_homework_bank_f homework - new_homework_bank.save! + homework_bank = current_user.homework_banks.find_by(homework_common_id: homework.id) + if homework_bank.present? + # 如果作业加入过题库则更新参数 + if homework_bank.homework_type == 1 + homework_bank.update_attributes!(name: homework.name, description: homework.description, + reference_answer: homework.reference_answer, course_list_id: @course.course_list_id) + elsif homework_bank.homework_type == 3 + homework_detail_group = homework.homework_detail_group + homework_bank.update_attributes!(name: homework.name, description: homework.description, + reference_answer: homework.reference_answer, course_list_id: @course.course_list_id, + min_num: homework_detail_group.min_num, max_num: homework_detail_group.max_num, + base_on_project: homework_detail_group.base_on_project) + end - homework.update_attributes!(homework_bank_id: new_homework_bank.id) + # 附件的更新 + homework_bank.attachments.destroy_all + homework.attachments.each do |attachment| + att = attachment.copy + att.author_id = homework_bank.user_id + att.copy_from = attachment.id + homework_bank.attachments << att end + else + new_homework_bank = add_to_homework_bank_f homework + new_homework_bank.save! - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + homework.update_attributes!(homework_bank_id: new_homework_bank.id) end + end end normal_status(0, "加入成功") @@ -1229,7 +1175,7 @@ class HomeworkCommonsController < ApplicationController # 班级作品查重 def homework_code_repeat - tip_exception(-1,"分班id不能为空!") if params[:group_ids].nil? + tip_exception(-1, "分班id不能为空!") if params[:group_ids].nil? shixun = @homework.shixuns.take # 通过代码文件来判断语言 language = shixun.challenges.practice_type.pluck(:path).first @@ -1247,16 +1193,16 @@ class HomeworkCommonsController < ApplicationController games.each do |game| game.game_codes.each do |game_code| code_infos << { - path: game_code.path, - content: Base64.urlsafe_encode64(game_code.new_code.to_s, padding: false), - passed_time: game.end_time.try(:strftime, '%Y-%m-%d %H:%M:%S') + path: game_code.path, + content: Base64.urlsafe_encode64(game_code.new_code.to_s, padding: false), + passed_time: game.end_time.try(:strftime, '%Y-%m-%d %H:%M:%S') } end end if code_infos.size != 0 user_lists << { - user_id: user_id, - code_info: code_infos + user_id: user_id, + code_info: code_infos } end end @@ -1270,13 +1216,13 @@ class HomeworkCommonsController < ApplicationController normal_status("代码查重成功") else if result.status == 1 - tip_exception(-4,"代码查重异常,请稍后重试") + tip_exception(-4, "代码查重异常,请稍后重试") else - tip_exception(-3,"正在查重,请在几分钟后刷新页面查看结果") + tip_exception(-3, "正在查重,请在几分钟后刷新页面查看结果") end end else - tip_exception(-2,"平台目前支持java、python语言的查重
    其他语言正在规划中,敬请期待") + tip_exception(-2, "平台目前支持java、python语言的查重
    其他语言正在规划中,敬请期待") end end @@ -1295,23 +1241,23 @@ class HomeworkCommonsController < ApplicationController student_works = @homework.student_works.where("work_status > 0") # 按分班id搜索 user_ids = - if params[:group_ids] - # 筛选了分班 - group_student_ids = @course.course_members.where(course_group_id: params[:group_ids]).pluck(:user_id) - student_works.where(:user_id => group_student_ids).pluck(:user_id) + if params[:group_ids] + # 筛选了分班 + group_student_ids = @course.course_members.where(course_group_id: params[:group_ids]).pluck(:user_id) + student_works.where(:user_id => group_student_ids).pluck(:user_id) + else + # 如果当前用户有分班 显示分班内的学生,没有则显示全部 + user_ids = @course.user_group_students(current_user.id).pluck(:user_id) + if user_ids.present? + student_works.where(:user_id => user_ids).pluck(:user_id) else - # 如果当前用户有分班 显示分班内的学生,没有则显示全部 - user_ids = @course.user_group_students(current_user.id).pluck(:user_id) - if user_ids.present? - student_works.where(:user_id => user_ids).pluck(:user_id) - else - student_works.pluck(:user_id) - end + student_works.pluck(:user_id) end + end # 查询作品数总数 @all_reviews_count = user_ids.count @users_reviews = @homework.homework_review_results.where("code_rate >= 50.0") - .where(:user_id => user_ids).joins(user: :user_extension) + .where(:user_id => user_ids).joins(user: :user_extension) # 按学号和姓名搜索 if params[:search] @users_reviews = @users_reviews.where("concat(lastname, firstname) like :keyword or student_id like :keyword", keyword: "%#{params[:search]}%") @@ -1325,9 +1271,9 @@ class HomeworkCommonsController < ApplicationController # 如果未分班被查重过,则显示未分班列 @non_course_group = - if @homework.homework_group_reviews.where(course_group_id: 0).count > 0 - @course.course_members.where(role: 4, course_group_id: 0).count - end + if @homework.homework_group_reviews.where(course_group_id: 0).count > 0 + @course.course_members.where(role: 4, course_group_id: 0).count + end # 最新一次的查重时间 @last_review_time = format_time @homework.homework_group_reviews.last.try(:created_at) @@ -1353,38 +1299,38 @@ class HomeworkCommonsController < ApplicationController homework_challenge_settings = @homework.homework_challenge_settings @challenges = @shixun.challenges.where(id: homework_challenge_settings.pluck(:challenge_id), st: 0) @challenges = - @challenges.map do |challenge| - code_rate = 0 - game_codes = results.code_info.select {|info| challenge.path.split(";").include?(info.origin_path)} - # 先判断用户该关卡是否查重了 取多个待补充文件的平均值 - if game_codes.count > 0 - code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length - end - logger.info("#####game_codes: #{game_codes}") - #target = game_codes.count > 0 ? game_codes[0].target_user_id : nil - # 作品完成时间 - game = challenge.games.find_by(user_id: @user.id) - end_time = game.end_time - # 用户关卡的得分 - all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f - final_score = @student_work.work_challenge_score game, all_score, challenge.id - # 抄袭用户 - copy_user = User.find_by_id(game_codes[0].try(:target_user_id)) - copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present? - # 代码部分 - code_list = [] - challenge.path.split(";").each do |path| - if code_info.select{|info| path == info.origin_path}.size > 0 - info = code_info.select{|info| path == info.origin_path}[0] - code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} - end + @challenges.map do |challenge| + code_rate = 0 + game_codes = results.code_info.select {|info| challenge.path.split(";").include?(info.origin_path)} + # 先判断用户该关卡是否查重了 取多个待补充文件的平均值 + if game_codes.count > 0 + code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length + end + logger.info("#####game_codes: #{game_codes}") + #target = game_codes.count > 0 ? game_codes[0].target_user_id : nil + # 作品完成时间 + game = challenge.games.find_by(user_id: @user.id) + end_time = game.end_time + # 用户关卡的得分 + all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f + final_score = @student_work.work_challenge_score game, all_score, challenge.id + # 抄袭用户 + copy_user = User.find_by_id(game_codes[0].try(:target_user_id)) + copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present? + # 代码部分 + code_list = [] + challenge.path.split(";").each do |path| + if code_info.select {|info| path == info.origin_path}.size > 0 + info = code_info.select {|info| path == info.origin_path}[0] + code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} end - # TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。 - {code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score, - all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name), - username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, - id: challenge.id} end + # TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。 + {code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score, + all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name), + username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, + id: challenge.id} + end else if results.status == 1 @@ -1461,8 +1407,8 @@ class HomeworkCommonsController < ApplicationController user_rate = 0 # 计算每个关卡的相似度 challenges.each do |challenge| - game_codes = results.user_lists.select{|user_list| user_list.user_id == user && - challenge.path.split(";").include?(user_list.origin_path)} + game_codes = results.user_lists.select {|user_list| user_list.user_id == user && + challenge.path.split(";").include?(user_list.origin_path)} # 先判断用户该关卡是否查重了 取多个待补充文件的平均值 if game_codes.count > 0 user_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length From ea9925f2b092b26c05343acba8d309ba1ee2e4f7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Mar 2020 20:48:58 +0800 Subject: [PATCH 059/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/examination_banks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index cc34d9fea..3df11a432 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -36,8 +36,8 @@ class ExaminationBanksController < ApplicationController end current_user.item_baskets.destroy_all + render_ok({exam_id: exam.id}) end - render_ok rescue ApplicationService::Error => ex render_error(ex.message) end From 22c10fd8995cbcfb1ad09e0edc10256b00b8aa49 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Mar 2020 20:57:42 +0800 Subject: [PATCH 060/100] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/polls_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 21a919efd..edb3fba00 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -135,6 +135,7 @@ class PollsController < ApplicationController :course_id => @course.id, :polls_status => 1, :polls_type => "Course", + :un_anonymous => true } @poll = Poll.create!(poll_options) end From 17ef1d3a2af2425c6f73e2428384ffef63cdffb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:08:28 +0800 Subject: [PATCH 061/100] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=98=E5=BA=93?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=BE=93=E5=85=A5=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/component/ChoquesEditor.js | 73 +++++-------------- .../question/component/JudquestionEditor.js | 60 +++++---------- .../question/component/SingleEditor.js | 64 ++++++---------- public/react/src/modules/tpm/NewHeader.js | 30 ++++---- 4 files changed, 78 insertions(+), 149 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 725817d17..d2a0b231b 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -229,22 +229,9 @@ class ChoquesEditor extends Component{ var texts; const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - - - - if(this.isNull(_text)===true){ - - return - } - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - texts=JSON.stringify(value); - }catch (e) { texts=""; - } } else { if(_text.length>=500){ var result = _text.substring(0,450); @@ -298,66 +285,46 @@ class ChoquesEditor extends Component{ // debugger const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - if(this.isNull(_text)===true){ - this.setState({ - question_titleysl:"" - }) - return - } - - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titleysl: JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titleysl:"" }) - } } else { // 提交到后台的内容需要处理一下; - let texts=""; - texts = JSON.stringify(value); - this.setState({ - question_titleysl:texts - }) + try { + let texts = JSON.stringify(value); + this.setState({ + question_titleysl:texts + }) + }catch (e) { + this.setState({ + question_titleysl:"" + }) + } } } onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - - if(this.isNull(_text)===true){ - this.setState({ - question_titlesysl:"" - }) - return - } - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titlesysl: JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titlesysl:"" }) - } } else { // 提交到后台的内容需要处理一下; - let texts=""; + try { + let texts = JSON.stringify(value); + this.setState({ + question_titlesysl:texts + }) + }catch (e) { + this.setState({ + question_titlesysl:"" + }) + } - texts = JSON.stringify(value); - this.setState({ - question_titlesysl:texts - }) } } diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 603fbd6e7..868700c6b 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -303,72 +303,50 @@ class JudquestionEditor extends Component{ // console.log(quill); const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - // console.log(_text); - // console.log(_text.length); - if(this.isNull(_text)===true){ - this.setState({ - question_titleysl:"" - }) - return - } - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { this.setState({ - question_titleysl:JSON.stringify(value) + question_titleysl:"" + }) + // console.log("空"); + } else { + // 提交到后台的内容需要处理一下; + try { + let texts = JSON.stringify(value); + this.setState({ + question_titleysl:texts }) }catch (e) { this.setState({ question_titleysl:"" }) } - - // console.log("空"); - } else { - // console.log("有"); - - // 提交到后台的内容需要处理一下; - let texts=""; - texts = JSON.stringify(value); - this.setState({ - question_titleysl:texts - }) } } onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - if(this.isNull(_text)===true){ - this.setState({ - question_titlesysl:"" - }) - return - } if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titlesysl:JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titlesysl:"" }) - } - } else { // 提交到后台的内容需要处理一下; - let texts=""; + try { - texts = JSON.stringify(value); - this.setState({ - question_titlesysl:texts - }) + let texts = JSON.stringify(value); + this.setState({ + question_titlesysl:texts + }) + }catch (e) { + this.setState({ + question_titlesysl:"" + }) + } } } render() { diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 464eb19e0..fab9170b8 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -140,7 +140,13 @@ class SingleEditor extends Component{ // this.refs['titleEditor'].showError() this.props.showNotification('请您输入题干'); return editordata; + }else{ + console.log("question_titleysl"); + console.log(question_titleysl); } + + + for(let i = 0; i < question_choices.length; i++) { if (!question_choices[i]) { // this.refs[`optionEditor${i}`].showError() @@ -244,6 +250,7 @@ class SingleEditor extends Component{ this.setState({ standard_answers }) } onOptionContentChange = (value,quill,index) => { + debugger if (index >= this.state.question_choices.length) { // TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3 return; @@ -251,18 +258,9 @@ class SingleEditor extends Component{ var texts; const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - - if(this.isNull(_text)===true){ - return - } if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - texts= JSON.stringify(value) - }catch (e) { texts=""; - } } else { if(_text.length>=500){ var result = _text.substring(0,450); @@ -315,61 +313,47 @@ class SingleEditor extends Component{ const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - if(this.isNull(_text)===true){ - this.setState({ - question_titleysl:"" - }) - return - } - - - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titleysl: JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titleysl:"" }) - } } else { + try { let texts = JSON.stringify(value); - this.setState({ - question_titleysl:texts - }) + this.setState({ + question_titleysl:texts===undefined|| null?"":texts + }) + }catch (e) { + this.setState({ + question_titleysl:"" + }) + } } } onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - if(this.isNull(_text)===true){ - this.setState({ - question_titlesysl:"" - }) - return - } + if (!reg.test(_text)) { // 处理编辑器内容为空 + this.setState({ + question_titlesysl:"" + }) + } else { try { + let texts = JSON.stringify(value); this.setState({ - question_titlesysl:JSON.stringify(value) + question_titlesysl:texts===undefined|| null?"":texts }) }catch (e) { this.setState({ question_titlesysl:"" }) } - } else { - let texts = JSON.stringify(value); - this.setState({ - question_titlesysl:texts - }) + } } handleShowImage = (url) => { diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 8d3c85378..dccdbc5a7 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{ ` } - {/*{*/} - {/* Periofters===true?*/} - {/*
  • */} - {/* */} - {/*
    */} - {/*
    */} - {/* 题库*/} - {/*
    */} - {/*
    */} - {/*
    */} - {/*
  • */} - {/* :""*/} - {/*}*/} + { + Periofters===true? +
  • + +
    +
    + 题库 +
    +
    +
    +
  • + :"" + }
  • Date: Fri, 6 Mar 2020 21:09:09 +0800 Subject: [PATCH 062/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index dccdbc5a7..8d3c85378 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{ ` } - { - Periofters===true? -
  • - -
    -
    - 题库 -
    -
    -
    -
  • - :"" - } + {/*{*/} + {/* Periofters===true?*/} + {/*
  • */} + {/* */} + {/*
    */} + {/*
    */} + {/* 题库*/} + {/*
    */} + {/*
    */} + {/*
    */} + {/*
  • */} + {/* :""*/} + {/*}*/}
  • Date: Fri, 6 Mar 2020 21:15:33 +0800 Subject: [PATCH 063/100] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=BF=9B=E5=85=A5=E9=80=80=E5=87=BA=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=99=BD=E5=B1=8F=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/statics/index.js | 3 ++- public/react/src/redux/actions/static.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index b4eeec035..5988f113d 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -216,7 +216,8 @@ const App = (props) => { useEffect(() => { changeParams({ - page: 1 + page: 1, + type: "subject_info" }); pathId && staticList(pathId); }, []); diff --git a/public/react/src/redux/actions/static.js b/public/react/src/redux/actions/static.js index 77c4e0267..2c57479fb 100644 --- a/public/react/src/redux/actions/static.js +++ b/public/react/src/redux/actions/static.js @@ -12,7 +12,7 @@ import { fetchStaticList } from "../../services/staticService"; export const staticList = (id) => { return (dispatch, getState) => { const { params, total_count, other_info } = getState().staticReducer; - // console.log('统计数据=====>>>>>', params); + console.log('统计数据=====>>>>>', params); // if (total_count !== 0 && total_count === other_info.length) return; fetchStaticList(id, params).then(res => { // console.log('统计数据=====>>>>>', res); From a02c622293ab58bff12a036f8ccfb3a118ad22f0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 21:25:12 +0800 Subject: [PATCH 064/100] =?UTF-8?q?games=E8=A1=A8=E5=A2=9E=E5=8A=A0user=5F?= =?UTF-8?q?id=E7=9A=84=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20200306131654_add_user_id_index_for_games.rb | 5 +++++ lib/tasks/static_all.rake | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20200306131654_add_user_id_index_for_games.rb diff --git a/db/migrate/20200306131654_add_user_id_index_for_games.rb b/db/migrate/20200306131654_add_user_id_index_for_games.rb new file mode 100644 index 000000000..ec92a1a08 --- /dev/null +++ b/db/migrate/20200306131654_add_user_id_index_for_games.rb @@ -0,0 +1,5 @@ +class AddUserIdIndexForGames < ActiveRecord::Migration[5.2] + def change + add_index :games, :user_id + end +end diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake index 2290f0dc5..58a11572d 100644 --- a/lib/tasks/static_all.rake +++ b/lib/tasks/static_all.rake @@ -2,7 +2,7 @@ desc "统计每个学校使用数据" namespace :static_all do task :repo => :environment do - school_alls = School.includes(:courses, user_extensions: :user).all + school_alls = School.includes(courses: [:homework_commons, :attachments, :course_videos], user_extensions: :user).where(id: 117) proc_num = ENV['processes'].blank? ? 5 : ENV['processes'].to_i school_alls.find_in_batches(batch_size: 50) do |schools| Parallel.each(schools, in_processes: proc_num) do |school| From d667dbf809bdf0e54183e2a7eb09235ea8ac3699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:38:09 +0800 Subject: [PATCH 065/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/component/Contentpart.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 516e6be1f..449e0e9e4 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -348,11 +348,12 @@ class Contentpart extends Component { .xaxisreverseorder .ant-input-group-addon{ width: 48px !important; - + } - .xaxisreverseorder .ant-input-lg { - height: 41px !important;} + .xaxisreverseorder .ant-input-wrapper .ant-input-group-addon button .ant-input-lg { + height: 39px !important; + } .xaxisreverseorder .ant-popover{ top: 30px !important; From fbe15fec18b55747179b4945ad36a81fe24fd59c Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 6 Mar 2020 21:45:09 +0800 Subject: [PATCH 066/100] =?UTF-8?q?=E8=AF=95=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 1 + .../modules/question/component/Contentpart.js | 2 +- .../modules/question/component/Listjihe.js | 31 ++++++++++++++++--- .../question/questioncss/questioncom.css | 26 +++++++++++++++- public/react/src/modules/tpm/NewHeader.js | 3 +- 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 9613a4cc3..b7553311d 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -982,6 +982,7 @@ class Question extends Component { position: relative; z-index: 9999999 ; } + ` } diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 516e6be1f..75fe883d6 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -362,7 +362,7 @@ class Contentpart extends Component { .xaxisreverseorder .ant-popover-inner-content { padding:0px !important; } - + ` } diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index 34d8844e7..067de710c 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -25,6 +25,28 @@ const tagArrays = [ 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] +const questionType = [ + { + type:'SINGLE', + color:'typeGreen', + name:'单选题' + }, + { + type:'MULTIPLE', + color:'typeBlue', + name:'多选题' + }, + { + type:'JUDGMENT', + color:'typeRed', + name:'判断题' + }, + { + type:'PROGRAM', + color:'typeYellow', + name:'编程题' + } +] //Paperreview_single.js Paperlibraryseeid_items.js class Listjihe extends Component { constructor(props) { @@ -233,10 +255,10 @@ class Listjihe extends Component { }catch (e) { } - + const types = questionType.filter(item=>item.type === items.item_type); return (
    + className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : "borderwds pd20 mb20 listjihecolors"}> {/*顶部*/} { mydisplay===true? @@ -301,6 +323,7 @@ class Listjihe extends Component { }
    + {types && types[0].name}
    @@ -311,10 +334,10 @@ class Listjihe extends Component { { items.item_type==="PROGRAM"? this.seturls(`/problems/${items.program_attr.identifier}/edit`)} > -
    +
    : -
    +
    { items===undefined||items===null||items===""?"": items.name === undefined || items.name === null || items.name === "" ? diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 096b30007..a0c791190 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -329,7 +329,7 @@ .listjihetixingstitsy { color: #333333; font-size: 14px; - line-height: 20px !important; + line-height: 25px !important; height: 25px !important; } @@ -1118,3 +1118,27 @@ .text-indents50{ text-indent: 50px } +.typesBtn{ + padding:0px 10px; + height:24px; + line-height:24px; + border-radius:2px; + margin-right:10px; + font-size: 13px; +} +.typeGreen{ + color:#15DB7A; + border:1px solid #15DB7A; +} +.typeBlue{ + color:#0CB9F1; + border:1px solid #0CB9F1; +} +.typeRed{ + color:#FF5555; + border:1px solid #FF5555; +} +.typeYellow{ + color:#FFB538; + border:1px solid #FFB538; +} \ No newline at end of file diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 8d3c85378..aecee799a 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1267,7 +1267,8 @@ submittojoinclass=(value)=>{ {/* p 老师 l 学生 */} {shixuntype===true?"":
  • 我的实训项目
  • } {pathstype===true?"":
  • {this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}
  • } - {this.props.user&&this.props.user.main_site===true?
  • 我的开发项目
  • :""} + {this.props.user&&this.props.user.main_site===true?
  • 我的开发项目
  • :""} + { Periofters === true &&
  • 我的题库
  • } {/*
  • 我的众包
  • */}
  • 客户管理 From 64d78d9df73109fe5e1deea520990da5586e01b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:48:22 +0800 Subject: [PATCH 067/100] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview.js | 6 +++--- .../src/modules/question/Paperreview_item.js | 2 +- .../src/modules/question/Questionitem_banks.js | 16 ++++++++-------- .../modules/question/component/Contentpart.js | 2 +- .../src/modules/question/component/Listjihe.js | 2 +- .../src/modules/question/component/SiderBars.js | 2 +- .../modules/testpaper/component/Contentpart.js | 4 ++-- .../component/Paperlibraryseeid_item.js | 2 +- .../component/Paperlibraryseeid_itemss.js | 2 +- .../modules/testpaper/component/Seeoagertits.js | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 425815d62..874eb9bbd 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -418,7 +418,7 @@ class Paperreview extends Component { artificialtype==="artificial"? 试题库 - 人工组卷 + 人工组卷 试卷预览 : @@ -429,7 +429,7 @@ class Paperreview extends Component { : - 试题库 + 试题库 新增试卷 } @@ -461,7 +461,7 @@ class Paperreview extends Component { this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/question':'/paperlibrary'}> + onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/problemset':'/paperlibrary'}>
  • ) diff --git a/public/react/src/modules/question/Paperreview_item.js b/public/react/src/modules/question/Paperreview_item.js index 8f3ca4f28..a4c5e5773 100644 --- a/public/react/src/modules/question/Paperreview_item.js +++ b/public/react/src/modules/question/Paperreview_item.js @@ -463,7 +463,7 @@ class Paperreview_item extends Component { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } showparagraphs = (e,name) => { diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index b70332269..aade5de2e 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -312,7 +312,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`新增单选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } }).catch((error) => { @@ -324,7 +324,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`编辑单选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } @@ -392,7 +392,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`新增多选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } @@ -406,7 +406,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`编辑多选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } @@ -461,7 +461,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`新增判断题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } }).catch((error) => { @@ -474,7 +474,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`编辑判断题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } }).catch((error) => { @@ -561,7 +561,7 @@ class Questionitem_banks extends Component {
    - 试题库 + 试题库 {JSON.stringify(params) === "{}" ? "新增" : "编辑"}试题
    @@ -627,7 +627,7 @@ class Questionitem_banks extends Component { "" : this.preservation()} url={'/question'}> + onSubmits={() => this.preservation()} url={'/problemset'}> }
    ) diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 449e0e9e4..f8e2ee400 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -201,7 +201,7 @@ class Contentpart extends Component { } - this.props.history.push("/question/newitem?pages="+this.props.pages+urls); + this.props.history.push("/problemset/newitem?pages="+this.props.pages+urls); } render() { diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index 34d8844e7..14652cdef 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -495,7 +495,7 @@ class Listjihe extends Component { this.props.Isitapopup&&this.props.Isitapopup==="true"? "" : - this.seturls(`/question/edit/${items.id}`)}> + this.seturls(`/problemset/edit/${items.id}`)}>

    编辑 diff --git a/public/react/src/modules/question/component/SiderBars.js b/public/react/src/modules/question/component/SiderBars.js index e6cee7761..724ae7f79 100644 --- a/public/react/src/modules/question/component/SiderBars.js +++ b/public/react/src/modules/question/component/SiderBars.js @@ -117,7 +117,7 @@ class SiderBars extends Component { {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?

    { - mypath&&mypath==="/question"&&swsilan===true? + mypath&&mypath==="/problemset"&&swsilan===true?
    this.props.showDrawer()} > diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 5148e00ca..3f86a30f9 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -73,7 +73,7 @@ class Contentpart extends Component { } //跳转人工组卷 Mantegeneration=()=>{ - this.props.history.push('/question'); + this.props.history.push('/problemset'); } @@ -375,7 +375,7 @@ class Contentpart extends Component {
    - this.xinzenw('/question')}> + this.xinzenw('/problemset')}>

    人工组卷

    diff --git a/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js b/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js index 06298299f..58959d745 100644 --- a/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js +++ b/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js @@ -286,7 +286,7 @@ class Paperreview_item extends Component { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } showparagraphs = (e,name) => { diff --git a/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js b/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js index 754a45560..2cdc60623 100644 --- a/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js +++ b/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js @@ -361,7 +361,7 @@ class Paperlibraryseeid_itemss extends Component { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } showparagraphs = (e,name) => { diff --git a/public/react/src/modules/testpaper/component/Seeoagertits.js b/public/react/src/modules/testpaper/component/Seeoagertits.js index a983bd67e..573655a63 100644 --- a/public/react/src/modules/testpaper/component/Seeoagertits.js +++ b/public/react/src/modules/testpaper/component/Seeoagertits.js @@ -26,7 +26,7 @@ class Seeoagertit extends Component { onChange=(e)=> { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } render() { From 9ebaedf84a0805d8c61f8b0e48f5a5f0a279ff50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:50:11 +0800 Subject: [PATCH 068/100] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 4c4908771..947cf51a5 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -807,16 +807,16 @@ class App extends Component { render={ (props) => () } /> - () } /> - () } /> - () } /> @@ -835,7 +835,7 @@ class App extends Component { (props) => () }/> - () }/> From 720dd7bdf1e9f5933179c75537429bcc5e3b06aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:51:02 +0800 Subject: [PATCH 069/100] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 9ba60c27a..a5da90e2c 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -769,7 +769,7 @@ export function TPMIndexHOC(WrappedComponent) { {...this.dialogObj} />:""} { - mypath&&mypath==="/question"? + mypath&&mypath==="/problemset"? "" : Date: Fri, 6 Mar 2020 21:55:21 +0800 Subject: [PATCH 070/100] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E7=BB=84=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../testpaper/component/Contentpart.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 3f86a30f9..f5c0a5cb4 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -368,18 +368,24 @@ class Contentpart extends Component {
    - - this.xinzenw('/Integeneration')}> -
    -

    智能组卷

    -
    -
    - this.xinzenw('/problemset')}> - :"" } From c26a13cb1807e220ebeb6a53ed51b5ccc51729e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:18:19 +0800 Subject: [PATCH 071/100] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E7=BB=84=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 874eb9bbd..273b53a0f 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -236,7 +236,8 @@ class Paperreview extends Component { .then((result) => { if (result.data.status === 0) { // this.props.showNotification(`组卷成功`); - this.props.history.replace('/paperlibrary'); + // console.log(result.data.exam_id); + this.props.history.replace('/paperlibrary/see/'+result.data.exam_id); } }).catch((error) => { //console.log(error); From 3b933c1be905aed76274d12b7f876870fba2e0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:18:46 +0800 Subject: [PATCH 072/100] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E7=BB=84=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 273b53a0f..f40ad9519 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -237,6 +237,7 @@ class Paperreview extends Component { if (result.data.status === 0) { // this.props.showNotification(`组卷成功`); // console.log(result.data.exam_id); + //本来调试卷库首页的 this.props.history.replace('/paperlibrary/see/'+result.data.exam_id); } }).catch((error) => { From 0f2b00d014c80a9bd643e2b3255b21fb6724f128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:21:50 +0800 Subject: [PATCH 073/100] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/question/questioncss/questioncom.css | 10 +++++----- .../src/modules/testpaper/testioncss/testioncss.css | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index a0c791190..d5ac90d12 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -419,10 +419,10 @@ color: #4CACFF; } .xiaoshou{ - cursor:pointer; + cursor:pointer !important; } .xiaoshout{ - cursor:default; + cursor:default !important; } .mt40{ margin-top: 40px; @@ -1129,7 +1129,7 @@ .typeGreen{ color:#15DB7A; border:1px solid #15DB7A; -} +} .typeBlue{ color:#0CB9F1; border:1px solid #0CB9F1; @@ -1137,8 +1137,8 @@ .typeRed{ color:#FF5555; border:1px solid #FF5555; -} +} .typeYellow{ color:#FFB538; border:1px solid #FFB538; -} \ No newline at end of file +} diff --git a/public/react/src/modules/testpaper/testioncss/testioncss.css b/public/react/src/modules/testpaper/testioncss/testioncss.css index 56c2e36c0..8c9597ed0 100644 --- a/public/react/src/modules/testpaper/testioncss/testioncss.css +++ b/public/react/src/modules/testpaper/testioncss/testioncss.css @@ -400,13 +400,13 @@ color: #4CACFF; } .xiaoshou{ - cursor:pointer; + cursor:pointer !important; } .xiaoshout{ - cursor:default; + cursor:default !important; } .shubiao{ - cursor:default; + cursor:default !important; } .mt40{ margin-top: 40px; From bf3a8fb7af37a1f62e2526ed4ae38d64d1905245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:44:47 +0800 Subject: [PATCH 074/100] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/modals/Bottomsubmit.js | 10 +++++++--- public/react/src/modules/question/Paperreview.js | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/modals/Bottomsubmit.js b/public/react/src/modules/modals/Bottomsubmit.js index 187910cb9..22fb7c8fd 100644 --- a/public/react/src/modules/modals/Bottomsubmit.js +++ b/public/react/src/modules/modals/Bottomsubmit.js @@ -12,9 +12,13 @@ class Bottomsubmit extends Component { cannelfun = () => { // window.location.href= - if(this.props.Cohetepaperbool===true){ - this.props.setCohetepaperbool(false); - }else { + try { + if(this.props.Cohetepaperbool===true){ + this.props.setCohetepaperbool(false); + }else { + this.props.history.replace(this.props.url); + } + }catch (e) { this.props.history.replace(this.props.url); } diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index f40ad9519..fadba71ca 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -463,6 +463,7 @@ class Paperreview extends Component { this.setCohetepaperbool(bool)} + Cohetepaperbool={this.state.Cohetepaperbool} onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/problemset':'/paperlibrary'}>
    ) From cdfd060d39b420f52736ff1103e59c9aa93aade6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:52:33 +0800 Subject: [PATCH 075/100] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index b7553311d..81d70bdb3 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -940,6 +940,15 @@ class Question extends Component { return (
    + { mydisplay===true? @@ -966,11 +975,7 @@ class Question extends Component { :"" } - { - visible===true? +
    - :""} { modalsTypes===true? this.modalCancels()} From 926339043d447d36f21694dd27fadae94bfb3fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:57:25 +0800 Subject: [PATCH 076/100] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/developer/newOrEditTask/index.js | 38 +++++++++---------- .../modules/developer/studentStudy/index.js | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/developer/newOrEditTask/index.js b/public/react/src/modules/developer/newOrEditTask/index.js index 565d6af30..b95668413 100644 --- a/public/react/src/modules/developer/newOrEditTask/index.js +++ b/public/react/src/modules/developer/newOrEditTask/index.js @@ -1,7 +1,7 @@ /* * @Description: 新建或编辑任务 - * @Author: tangjiang - * @Date: 2019-11-15 16:38:34 + * @Author: tangjiang + * @Date: 2019-11-15 16:38:34 * @Last Modified by: tangjiang * @Last Modified time: 2019-11-19 23:23:41 */ @@ -20,7 +20,7 @@ import actions from '../../../redux/actions'; // import {ModalConfirm} from '../../../common/components/ModalConfirm'; const NewOrEditTask = (props) => { - const { + const { publishLoading, handlePublish, // testCases = [], @@ -41,7 +41,7 @@ const NewOrEditTask = (props) => { courseQuestions // updateTestAndValidate, } = props; - + // 表单提交 const handleSubmitForm = () => { // 改变loading状态 @@ -53,7 +53,7 @@ const NewOrEditTask = (props) => { props.handleFormSubmit(props); // 提交表单 } }; - + useEffect(() => { // 获取用户信息 getUserInfoForNew(); @@ -121,7 +121,7 @@ const NewOrEditTask = (props) => { // 清空描述信息 toStore('oj_description', ''); // props.history.push('/problems'); - props.history.push(`/question?${props.searchParams}`); + props.history.push(`/problemset?${props.searchParams}`); } // 发布 @@ -163,8 +163,8 @@ const NewOrEditTask = (props) => { onClick={handleClickCancel} style={{ background: '#666666', color: '#fff', border: 'none' }} >取消 - @@ -174,14 +174,14 @@ const NewOrEditTask = (props) => { // 发布/模拟挑战 const renderPubOrFight = () => { const pubButton = isPublish - ? () - : (); @@ -191,13 +191,13 @@ const NewOrEditTask = (props) => { ) : ( ); - + if (isPublish) { return ( {pubButton} - @@ -207,8 +207,8 @@ const NewOrEditTask = (props) => { } else { return ( - @@ -217,7 +217,7 @@ const NewOrEditTask = (props) => { ); } - + } // 渲染退出 @@ -296,7 +296,7 @@ const mapDispatchToProps = (dispatch) => ({ clearOJFormStore: () => dispatch(actions.clearOJFormStore()), // 按钮状态 changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)), - // 发布按钮状态 + // 发布按钮状态 changePublishLoadingStatus: (flag) => dispatch(actions.changePublishLoadingStatus(flag)), // 测试用例及验证 updateTestAndValidate: (obj) => dispatch(actions.updateTestAndValidate(obj)), diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index 2af70efdf..e6a11482c 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -129,7 +129,7 @@ function StudentStudy (props) { changeShowOrHideControl(false); props.saveEditorCodeForDetail(''); // props.history.push('/problems'); - props.history.push(`/question?${searchParams}`); + props.history.push(`/problemset?${searchParams}`); } return ( From 05c22c1615fc3a2173530ab84636165c6d79b228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 23:21:36 +0800 Subject: [PATCH 077/100] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/redux/actions/ojForUser.js | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js index 87c877fa5..934d12e49 100644 --- a/public/react/src/redux/actions/ojForUser.js +++ b/public/react/src/redux/actions/ojForUser.js @@ -1,17 +1,17 @@ /* - * @Description: + * @Description: * @Author: tangjiang - * @Github: + * @Github: * @Date: 2019-11-27 13:42:11 * @LastEditors : tangjiang * @LastEditTime : 2020-02-10 18:17:00 */ import types from "./actionTypes"; import { Base64 } from 'js-base64'; -import { +import { fetchStartProgram, fetchUserProgramDetail, - fetchDebuggerCode, + fetchDebuggerCode, fetchCodeSubmit, fetchUserCommitRecord, fetchUserCommitRecordDetail, @@ -50,7 +50,7 @@ export const startProgramQuestion = (id, props) => { // console.log(path); // props.history.push(`/myproblems/${identifier}`); props.history.push({ - pathname: `/myproblems/${identifier}?${searchParams}`, + pathname: `/myproblems/${identifier}.json?${searchParams}`, }); } } @@ -90,7 +90,7 @@ export const getUserProgramDetail = (identifier, type) => { type: types.SAVE_USE_TEST_CASE_VALUE, payload: data.test_case || {} }); - // 代码是否更新 + // 代码是否更新 let _modify_code = false; if (data.hack) { _modify_code = data.hack.modify_code; @@ -145,7 +145,7 @@ export const saveUserCodeForInterval = (identifier, code) => { /** * @description 保存或更新之前先更新代码 - * @param {*} identifier + * @param {*} identifier * @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} type 测评类型 debug | submit */ @@ -157,7 +157,7 @@ export const updateCode = (identifier, inputValue, type) => { fetchUpdateCode(identifier, { code: Base64.encode(userCode) }).then(res => { - // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 + // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // TODO 需要优化 if (res.data.status === 401) { dispatch({ // 改变 loading 值 @@ -187,7 +187,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, let count = 1; /** * @param {*} excuteTime 执行时间 - * @param {*} finalTime 总时间 + * @param {*} finalTime 总时间 * @param {*} count 执行次数 * @param {*} timer 定时器 */ @@ -199,7 +199,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, if (+status === 0 || (excuteTime / 1000) > (finalTime + 1)) { clearInterval(timer); // 清除定时器 timer = null; - let returnData = null; + let returnData = null; if (status === 1) { // 结果没有返回 returnData = { error_line: -1, @@ -221,7 +221,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, payload: { type, data: returnData - } + } }); if (!type || type === 'debug') { dispatch({ // 改变 loading 值 @@ -287,13 +287,13 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, /** * @description 调试代码 - * @param {*} identifier + * @param {*} identifier * @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} type 测评类型 debug | submit */ export const debuggerCode = (identifier,value, type) => { return (dispatch, getState) => { - // 调用之前 先保存 code + // 调用之前 先保存 code // TODO // console.log(identifier, value); const { hack } = getState().ojForUserReducer; @@ -398,7 +398,7 @@ export const changeUserCodeTab = (key) => { /** * @description 用户提交代码, 先调用保存代码接口,再调提交接口,成功后调用调试接口 - * @param {*} identifier + * @param {*} identifier */ export const submitUserCode = (identifier, inputValue, type) => { return (dispatch, getState) => { @@ -430,7 +430,7 @@ export const submitUserCode = (identifier, inputValue, type) => { fetchUpdateCode(identifier, { code: userCode }).then(res => { - // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 + // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // TODO 需要优化 if (res.data.status === 401) { dispatch({ @@ -495,7 +495,7 @@ export const saveOpacityType = (type) => { type: types.CLICK_OPERATE_TYPE, payload: type } -} +} export const clearOjForUserReducer = () => { From 1c6f1c412379693c6abb4dea4173d472af6bc6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 6 Mar 2020 23:25:17 +0800 Subject: [PATCH 078/100] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index aafa2e765..f8cec6702 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -221,7 +221,7 @@ function generateNewIndexJsp() { // var result = data .replace(jsMinAllRegex, code) - .replace(flvMinAllRegex) + .replace(flvMinAllRegex,'') // .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) From 2b7caa76abe0acff7f56bb839f6b99f91063df4c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 23:42:49 +0800 Subject: [PATCH 079/100] =?UTF-8?q?=E6=B4=BB=E8=82=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/static_all.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake index 58a11572d..4db09001e 100644 --- a/lib/tasks/static_all.rake +++ b/lib/tasks/static_all.rake @@ -2,7 +2,7 @@ desc "统计每个学校使用数据" namespace :static_all do task :repo => :environment do - school_alls = School.includes(courses: [:homework_commons, :attachments, :course_videos], user_extensions: :user).where(id: 117) + school_alls = School.includes(courses: [:homework_commons, :attachments, :course_videos], user_extensions: :user).all proc_num = ENV['processes'].blank? ? 5 : ENV['processes'].to_i school_alls.find_in_batches(batch_size: 50) do |schools| Parallel.each(schools, in_processes: proc_num) do |school| From d0dd909c992acd966ed7bbf790476437d5957705 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 23:43:10 +0800 Subject: [PATCH 080/100] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/hack_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/hack_set.rb b/app/models/hack_set.rb index 2c21c3c22..fb37f398c 100644 --- a/app/models/hack_set.rb +++ b/app/models/hack_set.rb @@ -1,7 +1,7 @@ class HackSet < ApplicationRecord validates_length_of :input, maximum: 1000, message: "不能超过1000个字符" validates_length_of :output, maximum: 1000, message: "不能超过1000个字符" - validates :input, presence: { message: "测试集输入不能为空" } + #validates :input, presence: { message: "测试集输入不能为空" } validates :output, presence: { message: "测试集输出不能为空" } validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同" # 编程题测试集 From 40c53128f2bf538c0600ff66651a0973884094d5 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 6 Mar 2020 23:44:01 +0800 Subject: [PATCH 081/100] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/coursesPublic/Addcourses.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index fb0a8a920..db0f9afd6 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -275,12 +275,13 @@ class Addcourses extends Component{ }); if(response.data.course_id!=undefined){ this.submitasyn(response.data.course_id) - }else{ - // 无返回课程id则是选择的教师或者助教身份,成功后跳转到课堂首页 - // console.log(this.props); - // console.log(this.props.history.push); - window.location.href="/courses"; } + // else{ + // // 无返回课程id则是选择的教师或者助教身份,成功后跳转到课堂首页 + // // console.log(this.props); + // // console.log(this.props.history.push); + // window.location.href="/courses"; + // } if(Addcoursestype===true){ this.props.hideAddcoursestype(); } From 122d7dc2489cb822042877014748f2662adce28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 23:45:45 +0800 Subject: [PATCH 082/100] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 3 ++- public/react/src/redux/actions/ojForUser.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index aecee799a..99018567c 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1268,7 +1268,8 @@ submittojoinclass=(value)=>{ {shixuntype===true?"":
  • 我的实训项目
  • } {pathstype===true?"":
  • {this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}
  • } {this.props.user&&this.props.user.main_site===true?
  • 我的开发项目
  • :""} - { Periofters === true &&
  • 我的题库
  • } + { Periofters === true &&
  • 我的试题库
  • } + { Periofters === true &&
  • 我的试卷库
  • } {/*
  • 我的众包
  • */}
  • 客户管理 diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js index 934d12e49..87405f43d 100644 --- a/public/react/src/redux/actions/ojForUser.js +++ b/public/react/src/redux/actions/ojForUser.js @@ -50,7 +50,7 @@ export const startProgramQuestion = (id, props) => { // console.log(path); // props.history.push(`/myproblems/${identifier}`); props.history.push({ - pathname: `/myproblems/${identifier}.json?${searchParams}`, + pathname: `/myproblems/${identifier}${searchParams}`, }); } } From 8f5b1dea42afa05ca53107156a105ea2cfe1b0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 7 Mar 2020 00:01:15 +0800 Subject: [PATCH 083/100] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leftpane/editorTab/AddTestDemo.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js index a16f30c18..e3cb54781 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js @@ -1,7 +1,7 @@ /* * @Description: 添加测试用例 * @Author: tangjiang - * @Github: + * @Github: * @Date: 2019-11-21 09:19:38 * @LastEditors : tangjiang * @LastEditTime : 2019-12-27 10:37:41 @@ -19,14 +19,14 @@ const AddTestDemo = (props) => { const { // key, // onSubmitTest, - onDeleteTest, + onDeleteTest, testCase, testCaseValidate, isOpen } = props; // const [isEditor, setIsEditor] = useState(false); // 是否是编辑 - + // 删除操作 const handleDeletePanel = (e) => { // console.log('点击的删除按钮') @@ -63,7 +63,7 @@ const AddTestDemo = (props) => { const value = e.target.value; testCaseOutputChange(value, index); } - + // 右侧删除图标 const genExtra = () => ( { * 文本输入框可编辑的情况 * 1. 新增时 * 2. isAdd 为 false 且 isEditor 为true 时 - * @param {*} testCase + * @param {*} testCase */ // const isDisabled = (testCase) => { // return !testCase.isAdd && !isEditor; @@ -138,21 +138,19 @@ const AddTestDemo = (props) => { // defaultActiveKey: [isOpen ? '1' : ''] // }; // console.log(activePane); - + // 切换手风琴 const handleChangeCollapse = () => { const {index, updateOpenTestCaseIndex} = props; updateOpenTestCaseIndex(index); } - + return ( handleChangeCollapse()}>
    输入} - validateStatus={testCaseValidate.input.validateStatus} - help={testCaseValidate.input.errMsg} colon={ false } >