Merge branch 'dev_item_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository

dev_new_shixunsrepository
杨树林 5 years ago
commit 2c3f48c1a6

@ -163,16 +163,30 @@ class Question extends Component {
//初始化 //初始化
componentDidMount() { componentDidMount() {
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.state; let {defaultActiveKey} = this.state;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="1"
}
var data = { var data = {
discipline_id:this.state.discipline_id, discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id, sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id, tag_discipline_id:this.state.tag_discipline_id,
public: defaultActiveKey, public: defaultActiveKeys,
page:1, page:1,
per_page:10, per_page:10,
}; };
this.getdata(data); this.getdata(data);
this.setState({
defaultActiveKey:defaultActiveKeys
})
let url = `/users/get_navigation_info.json`; let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => { axios.get(url, {}).then((response) => {
@ -816,7 +830,9 @@ class Question extends Component {
+ program_questions_count + program_questions_count
+ single_questions_count + single_questions_count
+ subjective_questions_count; + subjective_questions_count;
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;
return ( return (
@ -878,6 +894,19 @@ class Question extends Component {
` `
} }
</style> </style>
{
isysladmins===true?
<SiderBars
Datacount={Datacount}
myvisible={visible}
{...this.props}
{...this.state}
showDrawer={() => this.showDrawer()}
Headertop={Headertop}
/>
:
is_teacher===true&&professional_certification===true?
<SiderBars <SiderBars
Datacount={Datacount} Datacount={Datacount}
myvisible={visible} myvisible={visible}
@ -887,6 +916,11 @@ class Question extends Component {
Headertop={Headertop} Headertop={Headertop}
/> />
:
""
}
{/*顶部*/} {/*顶部*/}

@ -82,6 +82,11 @@ class Contentpart extends Component {
render() { render() {
let {page}=this.state; let {page}=this.state;
let {defaultActiveKey,item_type,booljupyterurls}=this.props; let {defaultActiveKey,item_type,booljupyterurls}=this.props;
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;
const content = ( const content = (
<div className="questiontypes" style={{ <div className="questiontypes" style={{
width:'93px', width:'93px',
@ -115,8 +120,6 @@ class Contentpart extends Component {
); );
const buttonWidth = 70; const buttonWidth = 70;
//console.log("Contentpart");
//console.log(this.props);
return ( return (
<div className=" clearfix mt25"> <div className=" clearfix mt25">
<div className="educontent mt10 pb20 w1200s"> <div className="educontent mt10 pb20 w1200s">
@ -141,12 +144,23 @@ class Contentpart extends Component {
` `
} }
</style> </style>
<Tabs defaultActiveKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
{
isysladmins===true||(is_teacher===true&&professional_certification===true)?
<Tabs activeKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
<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)}>
<TabPane tab="公共" key="1">
</TabPane>
</Tabs>
}
<div className=" mt19" style={{ <div className=" mt19" style={{
position:"absolute", position:"absolute",
@ -181,12 +195,14 @@ class Contentpart extends Component {
<div className="xaxisreverseorder"> <div className="xaxisreverseorder">
{ {
defaultActiveKey===0||defaultActiveKey==="0"? defaultActiveKey===0||defaultActiveKey==="0"?
isysladmins===true||(is_teacher===true&&professional_certification===true)?
<a onClick={(e)=>this.xinzenw(e)}> <a onClick={(e)=>this.xinzenw(e)}>
<div className="newbutoon"> <div className="newbutoon">
<p className="newbutoontes" >新增</p> <p className="newbutoontes" >新增</p>
</div> </div>
</a> </a>
:"" :""
:""
} }
{item_type==="PROGRAM"? {item_type==="PROGRAM"?
@ -208,7 +224,7 @@ class Contentpart extends Component {
{ {
defaultActiveKey===0||defaultActiveKey==="0"? defaultActiveKey===0||defaultActiveKey==="0"?
<Search <Search
style={{ marginRight:"30px"}} style={isysladmins===true||(is_teacher===true&&professional_certification)?{ marginRight:"30px"}:{marginRight:"0px"}}
className={"xaxisreverseorder searchwidth"} className={"xaxisreverseorder searchwidth"}
placeholder="请输入题目名称、内容" placeholder="请输入题目名称、内容"
enterButton enterButton

@ -51,6 +51,17 @@ class Testpaperlibrary extends Component {
//初始化 //初始化
componentDidMount() { componentDidMount() {
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.state;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="1"
}
this.setState({
defaultActiveKey:defaultActiveKeys
})
let url = `/users/get_navigation_info.json`; let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => { axios.get(url, {}).then((response) => {
// ////console.log("开始请求/get_navigation_info.json"); // ////console.log("开始请求/get_navigation_info.json");
@ -80,7 +91,7 @@ class Testpaperlibrary extends Component {
discipline_id:this.state.discipline_id, discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id, sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id, tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey, public: defaultActiveKeys,
difficulty: this.state.difficulty, difficulty: this.state.difficulty,
keywords: this.state.keywords, keywords: this.state.keywords,
page: 1, page: 1,
@ -417,6 +428,12 @@ class Testpaperlibrary extends Component {
render() { render() {
let{Headertop,items_count,page,per_page,modalsTypes,modalsType}=this.state; let{Headertop,items_count,page,per_page,modalsTypes,modalsType}=this.state;
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;
return ( return (
<div className="newMain clearfix" ref={this.saveContainer}> <div className="newMain clearfix" ref={this.saveContainer}>
{ {

@ -41,6 +41,12 @@ class Contentpart extends Component {
render() { render() {
let {page}=this.state; let {page}=this.state;
let {defaultActiveKey}=this.props; let {defaultActiveKey}=this.props;
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;
const contents = ( const contents = (
<div className="questiontypes" style={{ <div className="questiontypes" style={{
width:'93px', width:'93px',
@ -82,12 +88,20 @@ class Contentpart extends Component {
} }
</style> </style>
<Tabs defaultActiveKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}> {
isysladmins===true||(is_teacher===true&&professional_certification===true)?
<Tabs activeKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
<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)}>
<TabPane tab="公共" key="1">
</TabPane>
</Tabs>
}
<div className=" mt19" style={{ <div className=" mt19" style={{
position:"absolute", position:"absolute",
top: "0px", top: "0px",
@ -112,7 +126,7 @@ class Contentpart extends Component {
` `
} }
</style> </style>
<div className="sortinxdirection"> <div className={isysladmins===true||(is_teacher===true&&professional_certification===true)?"sortinxdirection":"xaxisreverseorder"}>
<Search <Search
style={{ width: "347px",marginRight:"60px",}} style={{ width: "347px",marginRight:"60px",}}
placeholder="请输入题目名称、内容" placeholder="请输入题目名称、内容"
@ -123,7 +137,8 @@ class Contentpart extends Component {
value={this.props.keywords} value={this.props.keywords}
/> />
{
isysladmins===true||(is_teacher===true&&professional_certification===true)?
<div className="xaxisreverseorder" style={{ <div className="xaxisreverseorder" style={{
width:"50%" width:"50%"
}}> }}>
@ -140,9 +155,8 @@ class Contentpart extends Component {
</div> </div>
</a> </a>
</div> </div>
:""
}
</div> </div>

Loading…
Cancel
Save