diff --git a/public/react/src/modules/testpaper/Paperlibraryeditid.js b/public/react/src/modules/testpaper/Paperlibraryeditid.js index e1bf902c0..4cb0a23a6 100644 --- a/public/react/src/modules/testpaper/Paperlibraryeditid.js +++ b/public/react/src/modules/testpaper/Paperlibraryeditid.js @@ -1,5 +1,6 @@ -import React, { Component } from "react"; -import { SnackbarHOC } from 'educoder'; +import React, {Component} from "react"; +import {Link, NavLink} from 'react-router-dom'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { Breadcrumb @@ -26,7 +27,8 @@ class Paperlibraryeditid extends Component { knowledgepoints: [], disciplmy: [], item_banksedit: [], - newmyshixunmodelbool: false, + newmyshixunmodelbool:false, + defaultActiveKey:"0", } @@ -100,6 +102,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", + }) + } + + } + + } @@ -196,10 +218,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"?"公开试卷库":"我的试卷库"} 试卷编辑
@@ -293,8 +315,8 @@ class Paperlibraryeditid extends Component { { newmyshixunmodelbool === true ? "" : this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/paperlibrary'}> + setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)} + onSubmits={() => this.preservation()} url={urlsysl}> }
) diff --git a/public/react/src/modules/testpaper/Paperlibraryseeid.js b/public/react/src/modules/testpaper/Paperlibraryseeid.js index 115448971..5012c4f24 100644 --- a/public/react/src/modules/testpaper/Paperlibraryseeid.js +++ b/public/react/src/modules/testpaper/Paperlibraryseeid.js @@ -1,5 +1,6 @@ -import React, { Component } from "react"; -import { SnackbarHOC } from 'educoder'; +import React, {Component} from "react"; +import {Link, NavLink} from 'react-router-dom'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { Breadcrumb } from "antd"; import TPMIndexHOC from "../tpm/TPMIndexHOC"; @@ -14,7 +15,8 @@ class Paperlibraryseeid extends Component { super(props); this.contentMdRef = React.createRef(); this.state = { - paperlibrartdata: [], + paperlibrartdata:[], + defaultActiveKey:"0", } @@ -26,7 +28,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", + }) + } + } } @@ -81,9 +100,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"?"公开试卷库":"我的试卷库"} 试卷查看
@@ -159,8 +179,8 @@ class Paperlibraryseeid extends Component {
this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/paperlibrary'}> + setCohetepaperbool={(bool)=>this.setCohetepaperbool(bool)} + onSubmits={() => this.preservation()} url={urlsysl}> ) diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 2ef3bfda7..e58cfb3e8 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -70,6 +70,9 @@ class Testpaperlibrary extends Component { }) } }); + + + } paginationonChange = (pages) => { @@ -332,8 +335,13 @@ class Testpaperlibrary extends Component { }) }; +<<<<<<< HEAD Testpapereditor = (id) => { this.props.history.push(`/paperlibrary/edit/${id}`); +======= + Testpapereditor=(id)=>{ + this.props.history.push(`/paperlibrary/edit/${id}?defaultActiveKey=${this.state.defaultActiveKey}`); +>>>>>>> ae8378b... 调整 } 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 (