From 2e2903ebb3a74f04c674ebc43b7eb2e5bbdd20e1 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 19:44:21 +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 --- .../testpaper/component/Contentpart.js | 130 ++++++++++++++++-- .../modules/testpaper/component/Listjihe.js | 59 +++++++- 2 files changed, 171 insertions(+), 18 deletions(-) diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index eac80dad4..cce165b91 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -28,6 +28,8 @@ class Contentpart extends Component { defaultActiveKeyss:"0", mydisplay:false, occupation:2, + isysladmins:false, + } } @@ -53,6 +55,20 @@ class Contentpart extends Component { } } + 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 + }) } //跳转人工组卷 @@ -64,10 +80,11 @@ class Contentpart extends Component { componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { 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; + let 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; + try { if(this.props){ if(this.props.current_user){ if(this.props.current_user.admin){ @@ -78,6 +95,16 @@ class Contentpart extends Component { } } } + + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true + } + } + }catch (e) { + + } if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -114,7 +141,7 @@ class Contentpart extends Component { } xinzenw=(url)=>{ //只限制了教师 - if(this.props.current_user.professional_certification===false){ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } @@ -122,23 +149,96 @@ class Contentpart extends Component { this.props.history.push(url); } + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } + + Testpapereditor=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.Testpapereditor(e) + + } + + showmodels=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodels(e) + + } + + + showmodelysl=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodelysl(e) + + } + + + showmodelsInaudit=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodelsInaudit(e) + + } + + + + + + render() { let {page,defaultActiveKeyss,mydisplay}=this.state; let {defaultActiveKey,defaultActiveKeybool}=this.props; let defaultActiveKeys=defaultActiveKey+''; 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; + let 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; + try { + 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; + } } - else if(this.props.current_user.business){ - isysladmins=true; + } + + + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true } } + }catch (e) { + } const contents = ( @@ -215,7 +315,7 @@ class Contentpart extends Component { { - 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? + + + :"" + }