diff --git a/public/react/src/modules/testpaper/Paperlibraryeditid.js b/public/react/src/modules/testpaper/Paperlibraryeditid.js index 5b1587022..8700a216f 100644 --- a/public/react/src/modules/testpaper/Paperlibraryeditid.js +++ b/public/react/src/modules/testpaper/Paperlibraryeditid.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { notification, @@ -37,6 +37,7 @@ class Paperlibraryeditid extends Component { disciplmy: [], item_banksedit: [], newmyshixunmodelbool:false, + defaultActiveKey:"0", } @@ -110,6 +111,26 @@ class Paperlibraryeditid extends Component { } }); + const query = this.props.location.search; + const parsed = queryString.parse(query); + if(JSON.stringify(parsed)==="{}"){ + this.setState({ + defaultActiveKey:"0", + }) + }else { + if(parsed.defaultActiveKey==="0"){ + this.setState({ + defaultActiveKey:"0", + }) + }else{ + this.setState({ + defaultActiveKey:"1", + }) + } + + } + + } @@ -206,10 +227,10 @@ class Paperlibraryeditid extends Component { } render() { - let {paperlibrartdata,newmyshixunmodelbool} = this.state; + let {paperlibrartdata,newmyshixunmodelbool,defaultActiveKey} = this.state; const params = this.props && this.props.match && this.props.match.params; - // //console.log("newmyshixunmodelbool"); - // //console.log(newmyshixunmodelbool); + let urlsysl=`/paperlibrary?defaultActiveKey=${defaultActiveKey}`; + return (
试卷库 - 公开试卷库 + {defaultActiveKey==="1"?"公开试卷库":"我的试卷库"} 试卷编辑
@@ -304,7 +325,7 @@ class Paperlibraryeditid extends Component { newmyshixunmodelbool === true ? "" : this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/paperlibrary'}> + onSubmits={() => this.preservation()} url={urlsysl}> }
) diff --git a/public/react/src/modules/testpaper/Paperlibraryseeid.js b/public/react/src/modules/testpaper/Paperlibraryseeid.js index c0f27f13e..d81a0afa7 100644 --- a/public/react/src/modules/testpaper/Paperlibraryseeid.js +++ b/public/react/src/modules/testpaper/Paperlibraryseeid.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { notification, @@ -26,6 +26,7 @@ class Paperlibraryseeid extends Component { this.contentMdRef = React.createRef(); this.state = { paperlibrartdata:[], + defaultActiveKey:"0", } @@ -37,7 +38,24 @@ class Paperlibraryseeid extends Component { componentDidMount() { ////console.log("Paperlibraryseeid"); this.getdata(); + const query = this.props.location.search; + const parsed = queryString.parse(query); + if(JSON.stringify(parsed)==="{}"){ + this.setState({ + defaultActiveKey:"0", + }) + }else { + if(parsed.defaultActiveKey==="0"){ + this.setState({ + defaultActiveKey:"0", + }) + }else{ + this.setState({ + defaultActiveKey:"1", + }) + } + } } @@ -92,9 +110,10 @@ class Paperlibraryseeid extends Component { this.contentMdRef = Ref; } render() { - let {paperlibrartdata} = this.state; + let {paperlibrartdata,defaultActiveKey} = this.state; const params = this.props && this.props.match && this.props.match.params; // ////console.log(params); + let urlsysl=`/paperlibrary?defaultActiveKey=${defaultActiveKey}`; return (
试卷库 - 公开试卷库 + {defaultActiveKey==="1"?"公开试卷库":"我的试卷库"} 试卷查看
@@ -171,7 +190,7 @@ class Paperlibraryseeid extends Component { this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/paperlibrary'}> + onSubmits={() => this.preservation()} url={urlsysl}>
) diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 4d9ad75a9..9c4aa18a6 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -77,6 +77,9 @@ class Testpaperlibrary extends Component { }) } }); + + + } paginationonChange=(pages)=>{ @@ -340,7 +343,7 @@ class Testpaperlibrary extends Component { }; Testpapereditor=(id)=>{ - this.props.history.push(`/paperlibrary/edit/${id}`); + this.props.history.push(`/paperlibrary/edit/${id}?defaultActiveKey=${this.state.defaultActiveKey}`); } diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 7f9b4643f..ad65211a2 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder'; +import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { notification, @@ -24,12 +24,32 @@ class Contentpart extends Component { super(props); this.state = { page:1, + defaultActiveKeyss:"0", } } //初始化 componentDidMount(){ + const query = this.props.location.search; + const parsed = queryString.parse(query); + console.log("Contentpart"); + console.log(parsed); + if(JSON.stringify(parsed)==="{}"){ + this.setState({ + defaultActiveKeyss:"0", + }) + }else { + if(parsed.defaultActiveKey==="0"){ + this.setState({ + defaultActiveKeyss:"0", + }) + }else{ + this.setState({ + defaultActiveKeyss:"1", + }) + } + } } //跳转人工组卷 @@ -50,14 +70,19 @@ class Contentpart extends Component { }else{ defaultActiveKeys="1" } + if (this.state.defaultActiveKeyss==="0"){ + defaultActiveKeys="0" + } else { + defaultActiveKeys="1" + } this.props.callback(defaultActiveKeys); } } render() { - let {page}=this.state; + let {page,defaultActiveKeyss}=this.state; let {defaultActiveKey}=this.props; - const defaultActiveKeys=defaultActiveKey+''; + let defaultActiveKeys=defaultActiveKey+''; 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; @@ -79,6 +104,12 @@ class Contentpart extends Component { ); + if(defaultActiveKeyss==="0"){ + defaultActiveKeys="0"; + }else { + defaultActiveKeys="1"; + } + return (
diff --git a/public/react/src/modules/testpaper/component/Listjihe.js b/public/react/src/modules/testpaper/component/Listjihe.js index 1ae0d3e70..b2f358b96 100644 --- a/public/react/src/modules/testpaper/component/Listjihe.js +++ b/public/react/src/modules/testpaper/component/Listjihe.js @@ -58,7 +58,7 @@ class Listjihe extends Component { gotoseesj=(id)=>{ - this.props.history.push(`/paperlibrary/see/${id}`); + this.props.history.push(`/paperlibrary/see/${id}?defaultActiveKey=${this.props.defaultActiveKey}`); } @@ -73,6 +73,8 @@ class Listjihe extends Component { const update_times=items&&items.update_time&&items.update_time; const quotess =items&&items.quotes&&items.quotes; const authors=items&&items.author&&items.author.name; + + return (