From 9b6dac251dd002033a02b3ed2a6eedfb07ac8ded 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 19:28:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/question/NewMyShixunModel.js | 41 +++++++++++++++---- public/react/src/modules/question/Question.js | 41 +++++++++++++++---- .../modules/question/component/Contentpart.js | 4 +- 3 files changed, 70 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index 4307c5ba2..64595580b 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -24,6 +24,7 @@ import QuestionModalys from "./component/QuestionModalys"; //exam_id 试卷的id var Undoclickable=true; +var myGrandtotal=false; class NewMyShixunModel extends Component { constructor(props) { super(props); @@ -70,6 +71,7 @@ class NewMyShixunModel extends Component { isVisible: false, selectionbools:false, chakanjiexiboolindex:"无", + } } @@ -367,7 +369,9 @@ class NewMyShixunModel extends Component { //计算 getdataslen=(arr)=>{ - var contes=0; + myGrandtotal=false; + let contes=0; + let Grandtotal=0; for(let data of arr) { if(data.item_type==="PROGRAM"){ //编程题 @@ -376,8 +380,10 @@ class NewMyShixunModel extends Component { }else{ //未选用 if(data.program_attr.status===1){ - //已发布 + //已发布1 未发布0 contes=contes+1; + }else { + Grandtotal=Grandtotal+1; } } @@ -399,11 +405,28 @@ class NewMyShixunModel extends Component { selectionbools:false, selectallquestionsonthispages:false, }) - }else { - this.setState({ - selectionbools:true, - selectallquestionsonthispages:true, - }) + } + else { + try { + if(arr.length===Grandtotal){ + myGrandtotal=true; + this.setState({ + selectionbools:false, + selectallquestionsonthispages:false, + }) + }else{ + this.setState({ + selectionbools:true, + selectallquestionsonthispages:true, + }) + } + }catch (e) { + this.setState({ + selectionbools:true, + selectallquestionsonthispages:true, + }) + } + } } @@ -870,6 +893,10 @@ class NewMyShixunModel extends Component { } //全选试题库 selectallquestionsonthispage=(bool)=>{ + if(myGrandtotal===true){ + this.props.showNotification(`本页全部试题未发布,不能选择`); + return + } var item_idsdata=[]; var arr= this.state.Contentdata.items; diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 81d70bdb3..d305574ac 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -24,6 +24,7 @@ import QuestionModalys from "./component/QuestionModalys"; import Certifiedprofessional from "../modals/Certifiedprofessional"; var Undoclickable=true; +var myGrandtotal=false; class Question extends Component { constructor(props) { super(props); @@ -302,7 +303,9 @@ class Question extends Component { //计算 getdataslen=(arr)=>{ - var contes=0; + myGrandtotal=false; + let contes=0; + let Grandtotal=0; for(let data of arr) { if(data.item_type==="PROGRAM"){ //编程题 @@ -311,8 +314,10 @@ class Question extends Component { }else{ //未选用 if(data.program_attr.status===1){ - //已发布 + //已发布1 未发布0 contes=contes+1; + }else{ + Grandtotal=Grandtotal+1; } } @@ -334,11 +339,27 @@ class Question extends Component { selectionbools:false, selectallquestionsonthispages:false, }) - }else { - this.setState({ - selectionbools:true, - selectallquestionsonthispages:true, - }) + } else { + try { + if(arr.length===Grandtotal){ + myGrandtotal=true; + this.setState({ + selectionbools:false, + selectallquestionsonthispages:false, + }) + }else{ + this.setState({ + selectionbools:true, + selectallquestionsonthispages:true, + }) + } + }catch (e) { + this.setState({ + selectionbools:true, + selectallquestionsonthispages:true, + }) + } + } } @@ -767,6 +788,12 @@ class Question extends Component { } //全选试题库 selectallquestionsonthispage=(bool)=>{ + if(myGrandtotal===true){ + this.props.showNotification(`本页全部试题未发布,不能选择`); + return + } + + var item_idsdata=[]; var arr= this.state.Contentdata.items; diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index b58dc9922..ca637b9b5 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -441,12 +441,12 @@ class Contentpart extends Component {