dev_aliyun2
杨树林 5 years ago committed by harry
parent d771065aaa
commit 9c1df0debf

@ -33,6 +33,7 @@ class Testpaperlibrary extends Component {
modalsType:false,
timuid:0,
modalsTypeInaudit:false,
defaultActiveKeybool:false,
}
}
getContainer = () => {
@ -115,12 +116,21 @@ class Testpaperlibrary extends Component {
}
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({
defaultActiveKey: key,
difficulty:null,
keyword:null,
page:1,
defaultActiveKeybool:bool,
})
var data = {
page: 1,
@ -335,13 +345,8 @@ 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... 调整
}
@ -475,7 +480,7 @@ class Testpaperlibrary extends Component {
showmodels={(e)=>this.showmodels(e)}
showmodelysl={(e)=>this.showmodelysl(e)}
setdatafuns={(key)=>this.setdatafuns(key)}
callback={(key)=>this.callback(key)}
callback={(key,bool)=>this.callback(key,bool)}
setdatafunsval={(key)=>this.setdatafunsval(key)}
setdifficulty={(bool)=>this.setdifficulty(bool)}
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 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;
let defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
try {
if(this.props.defaultActiveKeybool===false){
if (this.state.defaultActiveKeyss==="0"){
defaultActiveKeys="0"
} else {
defaultActiveKeys="1"
}
this.props.callback(defaultActiveKeys);
}
}catch (e) {
}
this.props.callback(defaultActiveKeys,false);
}
}
render() {
let {page,defaultActiveKeyss}=this.state;
let {defaultActiveKey}=this.props;
let {defaultActiveKey,defaultActiveKeybool}=this.props;
let defaultActiveKeys=defaultActiveKey+'';
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
@ -104,11 +112,14 @@ class Contentpart extends Component {
</div>
);
if(defaultActiveKeybool===false){
if(defaultActiveKeyss==="0"){
defaultActiveKeys="0";
}else {
defaultActiveKeys="1";
}
}
return (
@ -139,14 +150,14 @@ class Contentpart extends Component {
{
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>
<TabPane tab="我的" key="0">
</TabPane>
</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>
</Tabs>

Loading…
Cancel
Save