mast_item_banktwo
杨树林 5 years ago
parent ae8378bf51
commit 8e4f47887f

@ -42,6 +42,7 @@ class Testpaperlibrary extends Component {
modalsType:false, modalsType:false,
timuid:0, timuid:0,
modalsTypeInaudit:false, modalsTypeInaudit:false,
defaultActiveKeybool:false,
} }
} }
getContainer = () => { getContainer = () => {
@ -122,12 +123,21 @@ class Testpaperlibrary extends Component {
} }
this.getdata(data); this.getdata(data);
} }
callback = (key) => { callback = (key,bool) => {
try {
var currenturl = window.location.href;
var newUrl = (currenturl.split("?"))[0];
window.history.pushState('','',newUrl+'?defaultActiveKey='+key);
}catch (e) {
}
this.setState({ this.setState({
defaultActiveKey: key, defaultActiveKey: key,
difficulty:null, difficulty:null,
keyword:null, keyword:null,
page:1, page:1,
defaultActiveKeybool:bool,
}) })
var data={ var data={
page:1, page:1,
@ -477,7 +487,7 @@ class Testpaperlibrary extends Component {
showmodels={(e)=>this.showmodels(e)} showmodels={(e)=>this.showmodels(e)}
showmodelysl={(e)=>this.showmodelysl(e)} showmodelysl={(e)=>this.showmodelysl(e)}
setdatafuns={(key)=>this.setdatafuns(key)} setdatafuns={(key)=>this.setdatafuns(key)}
callback={(key)=>this.callback(key)} callback={(key,bool)=>this.callback(key,bool)}
setdatafunsval={(key)=>this.setdatafunsval(key)} setdatafunsval={(key)=>this.setdatafunsval(key)}
setdifficulty={(bool)=>this.setdifficulty(bool)} setdifficulty={(bool)=>this.setdifficulty(bool)}
showmodelsInaudit={(e)=>this.showmodelsInaudit(e)} showmodelsInaudit={(e)=>this.showmodelsInaudit(e)}

@ -64,24 +64,32 @@ class Contentpart extends Component {
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher: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; 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 {defaultActiveKey} = this.props;
var defaultActiveKeys=defaultActiveKey; let defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0" defaultActiveKeys="0"
}else{ }else{
defaultActiveKeys="1" defaultActiveKeys="1"
} }
if (this.state.defaultActiveKeyss==="0"){ try {
defaultActiveKeys="0" if(this.props.defaultActiveKeybool===false){
} else { if (this.state.defaultActiveKeyss==="0"){
defaultActiveKeys="1" defaultActiveKeys="0"
} else {
defaultActiveKeys="1"
}
}
}catch (e) {
} }
this.props.callback(defaultActiveKeys);
this.props.callback(defaultActiveKeys,false);
} }
} }
render() { render() {
let {page,defaultActiveKeyss}=this.state; let {page,defaultActiveKeyss}=this.state;
let {defaultActiveKey}=this.props; let {defaultActiveKey,defaultActiveKeybool}=this.props;
let 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 isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
@ -104,13 +112,16 @@ class Contentpart extends Component {
</div> </div>
); );
if(defaultActiveKeyss==="0"){ if(defaultActiveKeybool===false){
defaultActiveKeys="0"; if(defaultActiveKeyss==="0"){
}else { defaultActiveKeys="0";
defaultActiveKeys="1"; }else {
defaultActiveKeys="1";
}
} }
return ( return (
<div className=" clearfix mt25"> <div className=" clearfix mt25">
<div className="educontent mt10 pb20 w1200s"> <div className="educontent mt10 pb20 w1200s">
@ -139,14 +150,14 @@ class Contentpart extends Component {
{ {
isysladmins===true||(is_teacher===true&&professional_certification===true)? isysladmins===true||(is_teacher===true&&professional_certification===true)?
<Tabs activeKey={defaultActiveKeys} onChange={(e)=>this.props.callback(e)}> <Tabs activeKey={defaultActiveKeys} onChange={(e)=>this.props.callback(e,true)}>
<TabPane tab="公共" key="1"> <TabPane tab="公共" key="1">
</TabPane> </TabPane>
<TabPane tab="我的" key="0"> <TabPane tab="我的" key="0">
</TabPane> </TabPane>
</Tabs> </Tabs>
: :
<Tabs activeKey={"1"} onChange={(e)=>this.props.callback(e)}> <Tabs activeKey={"1"} onChange={(e)=>this.props.callback(e,true)}>
<TabPane tab="公共" key="1"> <TabPane tab="公共" key="1">
</TabPane> </TabPane>
</Tabs> </Tabs>

Loading…
Cancel
Save