diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index b300156b7..e271857ba 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -27,7 +27,7 @@ class NewMyShixunModel extends Component { super(props); this.state = { count: 50, - defaultActiveKey:"0", + defaultActiveKey:"1", Headertop: "", Footerdown: "", visible: false, @@ -148,18 +148,17 @@ class NewMyShixunModel extends Component { //初始化 componentDidMount() { - let {defaultActiveKey} = this.state; - 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: defaultActiveKey, - page:1, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), - }; - this.getdata(data); - + const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin: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(isysladmins===true||(is_teacher===true&&professional_certification===true)){ + defaultActiveKeys="0" + }else{ + defaultActiveKeys="1" + } + this.callback(defaultActiveKeys); let url = `/users/get_navigation_info.json`; axios.get(url, {}).then((response) => { // ////console.log("开始请求/get_navigation_info.json"); @@ -190,6 +189,24 @@ 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; + 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(isysladmins===true||(is_teacher===true&&professional_certification===true)){ + defaultActiveKeys="0" + }else{ + defaultActiveKeys="1" + } + this.callback(defaultActiveKeys); + } + } + //公共和我的 callback = (key) => { this.setState({ diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index b65127c8d..680916d77 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -285,7 +285,7 @@ class Paperreview extends Component { { newmyshixunmodelbool===true?
- this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: "" diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 3b2c3a9bd..c6278db17 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -26,7 +26,7 @@ class Question extends Component { super(props); this.state = { count: 50, - defaultActiveKey:"0", + defaultActiveKey:"1", Headertop: "", Footerdown: "", visible: false, diff --git a/public/react/src/modules/testpaper/Intecomponents.js b/public/react/src/modules/testpaper/Intecomponents.js new file mode 100644 index 000000000..fc0dadd4a --- /dev/null +++ b/public/react/src/modules/testpaper/Intecomponents.js @@ -0,0 +1,334 @@ +import React, {Component} from "react"; +import {Link, NavLink} from 'react-router-dom'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import axios from 'axios'; +import { + notification, + Spin, + Table, + Pagination, + Drawer, + Input, + Button, + Breadcrumb +} from "antd"; +import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import NoneData from './component/NoneData'; +import './testioncss/testioncss.css'; +import '../tpm/newshixuns/css/Newshixuns.css'; +import Bottomsubmit from "../../modules/modals/Bottomsubmit"; +import Seeoagertits from "./component/Seeoagertits"; +import Paperlibraryseeid_item from './component/Paperlibraryseeid_item'; +import Comthetestpaperst from '../question/comthetestpaper/Comthetestpaperst'; +import Paperlibraryseeid_itemss from './component/Paperlibraryseeid_itemss'; +import JudquestionEditor from "../question/component/JudquestionEditor"; +import NewMyShixunModel from "../question/NewMyShixunModel"; + + +//试卷编辑 +class Intecomponents extends Component { + constructor(props) { + super(props); + this.Judquestio = React.createRef(); + this.state = { + paperlibrartdata: [], + disciplinesdata: [], + knowledgepoints: [], + disciplmy: [], + item_banksedit: [], + newmyshixunmodelbool:false, + } + + + } + + getJudquestio = (Ref) => { + console.log("子组件对象"); + console.log(Ref); + this.Judquestio = Ref; + } + + //初始化 + componentDidMount() { + this.getdata(); + let urls = `/disciplines.json`; + axios.get(urls, { + params: { + source: "question" + } + }).then((response) => { + if (response) { + this.setState({ + disciplinesdata: response.data.disciplines, + }) + if (response.data) { + if (response.data.disciplines) { + + const didata = response.data.disciplines; + + for (var i = 0; i < didata.length; i++) { + const childern = []; + //方向 + const fxdidata = didata[i].sub_disciplines; + + + for (var j = 0; j < fxdidata.length; j++) { + //课程 + const zsddata = fxdidata[j].tag_disciplines; + childern.push( + { + value: fxdidata[j].id, + label: fxdidata[j].name, + } + ) + for (var k = 0; k < zsddata.length; k++) { + //知识点 + this.state.knowledgepoints.push(zsddata[k]); + + + } + } + + const datakec = { + value: didata[i].id, + label: didata[i].name, + children: childern, + } + this.state.disciplmy.push(datakec); + } + + this.setState({ + knowledgepoints: this.state.knowledgepoints, + disciplmy: this.state.disciplmy, + }) + + + } + + } + + } + }); + + } + 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; + 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(isysladmins===true||(is_teacher===true&&professional_certification===true)){ + defaultActiveKeys="0" + }else{ + defaultActiveKeys="1" + } + this.props.callback(defaultActiveKeys); + } + } + + getdata = () => { + let urls = `/examination_banks/${this.props.match.params.id}.json`; + axios.get(urls).then((response) => { + if (response) { + this.setState({ + paperlibrartdata: response.data, + item_banksedit: response.data.exam, + }) + } + }); + + } + + + //跳转道描点的地方 + scrollToAnchor = (anchorName) => { + try { + if (anchorName) { + // 找到锚点 + let anchorElement = document.getElementById(anchorName); + // 如果对应id的锚点存在,就跳转到锚点 + if (anchorElement) { + anchorElement.scrollIntoView(); + } + } + } catch (e) { + + } + + } + preservation = () => { + //保存试卷 + if (this.Judquestio.Getdatas().length === 0) { + this.scrollToAnchor("Itembankstopid"); + return; + } + var myrbkc=[]; + var Getdatasdatas=this.Judquestio.Getdatas()[2].rbzsd; + for(let myda of Getdatasdatas) { + myrbkc.push(myda.id); + } + const url = `/examination_banks/${this.props.match.params.id}.json`; + var data={ + difficulty:this.Judquestio.Getdatas()[0].rbnd, + name:this.Judquestio.Getdatas()[4].classroom, + duration:this.Judquestio.Getdatas()[5].kssc, + discipline_id: this.Judquestio.Getdatas()[3].rbkc[0], + sub_discipline_id: this.Judquestio.Getdatas()[3].rbkc[1], + tag_discipline_id: myrbkc, + } + axios.put(url, data) + .then((result) => { + if (result.data.status === 0) { + // this.props.showNotification(`试卷更新成功`); + this.props.history.push('/paperlibrary'); + } + }).catch((error) => { + console.log(error); + }) + + } + + + setitem_type = (item_type) => { + + + } + + setCohetepaperbool = (bool) => { + + } + getcontentMdRef = (Ref) => { + this.contentMdRef = Ref; + } + + setnewmyshixunmodelbool=(bool)=>{ + if(bool===true){ + let scrollToTop = window.setInterval(function() { + let pos = window.pageYOffset; + if ( pos > 0 ) { + window.scrollTo( 0, pos - 20 ); // how far to scroll on each step + } else { + window.clearInterval( scrollToTop ); + } + }, 2); + } + this.setState({ + newmyshixunmodelbool:bool + }) + this.getdata(); + } + + render() { + let {paperlibrartdata,newmyshixunmodelbool} = this.state; + const params = this.props && this.props.match && this.props.match.params; + // console.log("newmyshixunmodelbool"); + // console.log(newmyshixunmodelbool); + return ( +
+
+ { + newmyshixunmodelbool===true? + + :"" + } + + { + newmyshixunmodelbool===true? +
+ this.setnewmyshixunmodelbool(e)}> +
+ : + "" + } + + +
+
+ + 试卷库 + 公告试卷库 + 试卷编辑 + +
+ this.getJudquestio(ref)} + > + + +
+ +
+ 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} + > + +
+ 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 + } + judgement_questions={paperlibrartdata && paperlibrartdata.judgement_questions + && paperlibrartdata.judgement_questions.questions.length > 0 ? paperlibrartdata.judgement_questions : null + } + program_questions={paperlibrartdata && paperlibrartdata.program_questions + && paperlibrartdata.program_questions.questions.length > 0 ? paperlibrartdata.program_questions : null + } + > + + +
+ + +
+ + +
+ { + newmyshixunmodelbool === true ? "" : + this.setCohetepaperbool(bool)} + onSubmits={() => this.preservation()} url={'/paperlibrary'}> + } +
+ ) + + } + + +} + +export default SnackbarHOC()(TPMIndexHOC(Intecomponents)); + + diff --git a/public/react/src/modules/testpaper/Paperlibraryeditid.js b/public/react/src/modules/testpaper/Paperlibraryeditid.js index efcb45496..449de0219 100644 --- a/public/react/src/modules/testpaper/Paperlibraryeditid.js +++ b/public/react/src/modules/testpaper/Paperlibraryeditid.js @@ -227,7 +227,7 @@ class Paperlibraryeditid extends Component { { newmyshixunmodelbool===true?
- this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: "" diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 77192b1b2..fb77352ef 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -36,7 +36,7 @@ class Testpaperlibrary extends Component { booljupyterurls:false, Contentdata:[], items_count:0, - defaultActiveKey:"0", + defaultActiveKey:"1", modalsTypes:false, modalsType:false, timuid:0,