调整权限

dev_aliyun2
杨树林 5 years ago committed by harry
parent 9b2effffe3
commit 3201f44b74

@ -152,18 +152,28 @@ class NewMyShixunModel extends Component {
//初始化
componentDidMount() {
let { defaultActiveKey } = this.state;
var data = {
discipline_id: this.state.discipline_id,
sub_discipline_id: this.state.sub_discipline_id,
tag_discipline_id: this.state.tag_discipline_id,
public: defaultActiveKey,
page: 1,
per_page: 10,
item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id),
};
this.getdata(data);
let isysladmins=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.props;
var defaultActiveKeys=defaultActiveKey;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
}
else if(this.props.current_user.business){
isysladmins=true;
}
}
}
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.callback(defaultActiveKeys);
let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => {
// //////console.log("开始请求/get_navigation_info.json");
@ -198,17 +208,27 @@ class NewMyShixunModel extends Component {
}
componentDidUpdate(prevProps) {
if (prevProps.current_user !== this.props.current_user) {
debugger
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.props;
var defaultActiveKeys = defaultActiveKey;
if (isysladmins === true || (is_teacher === true && professional_certification === true)) {
defaultActiveKeys = "0"
} else {
defaultActiveKeys = "1"
if(prevProps.current_user !== this.props.current_user) {
let isysladmins=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.props;
var defaultActiveKeys=defaultActiveKey;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
}
else if(this.props.current_user.business){
isysladmins=true;
}
}
}
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.callback(defaultActiveKeys);
}

@ -848,10 +848,19 @@ class Question extends Component {
+ program_questions_count
+ single_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;
let isysladmins=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;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
}
else if(this.props.current_user.business){
isysladmins=true;
}
}
}
return (
<div className="newMain clearfix" ref={this.saveContainer}>
@ -918,19 +927,6 @@ class Question extends Component {
`
}
</style>
{
isysladmins === true ?
<SiderBars
Datacount={Datacount}
myvisible={visible}
{...this.props}
{...this.state}
showDrawer={() => this.showDrawer()}
Headertop={Headertop}
/>
:
is_teacher === true && professional_certification === true ?
<SiderBars
Datacount={Datacount}
myvisible={visible}
@ -940,11 +936,6 @@ class Question extends Component {
Headertop={Headertop}
/>
:
""
}
{/*顶部*/}

@ -42,11 +42,22 @@ class Contentpart extends Component {
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user) {
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
let isysladmins=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.props;
var defaultActiveKeys=defaultActiveKey;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
}
else if(this.props.current_user.business){
isysladmins=true;
}
}
}
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
@ -120,10 +131,19 @@ class Contentpart extends Component {
let {page,mydisplay}=this.state;
let {defaultActiveKey,item_type,booljupyterurls}=this.props;
const defaultActiveKeys=defaultActiveKey+'';
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
let isysladmins=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;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
}
else if(this.props.current_user.business){
isysladmins=true;
}
}
}
const content = (
<div className="questiontypes" style={{

@ -94,6 +94,22 @@ class SiderBars extends Component {
var mypath= this.props&&this.props.match&&this.props.match.path;
let{myvisible,Datacount,animateStyle}=this.props;
let swsilan=false;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
swsilan=true;
}
else if(this.props.current_user.business){
swsilan=true;
}
else if(this.props.current_user.is_teacher){
swsilan=true;
}else if(this.props.current_user.user_identity !=="学生") {
swsilan=true;
}
}
}
return (
<div className={myvisible===true?"-task-sidebar mystask-sidebar":Datacount&&Datacount>0?"-task-sidebar mystask-sidebars":"-task-sidebar mystask-sidebarss"} >
@ -101,7 +117,7 @@ class SiderBars extends Component {
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div>
{
mypath&&mypath==="/question"?
mypath&&mypath==="/question"&&swsilan===true?
<Tooltip placement="left" title={"试题库"}>
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >
@ -117,7 +133,7 @@ class SiderBars extends Component {
<a target="_blank" className="color_white xiaoshou" >
<i className="iconfont icon-shitilan color-white xiaoshou"></i>
</a>
<p className="color-white font-12 xiaoshou">试题</p>
<p className="color-white font-12 xiaoshou">试题</p>
</div>
</Tooltip>
:""

@ -63,11 +63,21 @@ class Contentpart extends Component {
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user) {
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
let isysladmins=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.props;
let defaultActiveKeys=defaultActiveKey;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
}
else if(this.props.current_user.business){
isysladmins=true;
}
}
}
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
@ -117,9 +127,19 @@ class Contentpart extends Component {
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;
let isysladmins=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;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
}
else if(this.props.current_user.business){
isysladmins=true;
}
}
}
const contents = (
<div className="questiontypes" style={{

Loading…
Cancel
Save