|
|
|
@ -23,6 +23,7 @@ import Bottomsubmit from "../modals/Bottomsubmit";
|
|
|
|
|
import QuestionModalys from "./component/QuestionModalys";
|
|
|
|
|
|
|
|
|
|
//exam_id 试卷的id
|
|
|
|
|
var Undoclickable=true;
|
|
|
|
|
class NewMyShixunModel extends Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
@ -162,11 +163,32 @@ class NewMyShixunModel extends Component {
|
|
|
|
|
|
|
|
|
|
//初始化
|
|
|
|
|
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;
|
|
|
|
|
let isysladmins=false;
|
|
|
|
|
let 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;
|
|
|
|
|
try {
|
|
|
|
|
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(is_teacher===false){
|
|
|
|
|
if(this.props.current_user.user_identity !=="学生"){
|
|
|
|
|
//专业人士
|
|
|
|
|
is_teacher=true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
|
|
|
|
|
defaultActiveKeys="0"
|
|
|
|
|
}else{
|
|
|
|
@ -206,12 +228,33 @@ 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;
|
|
|
|
|
let isysladmins=false;
|
|
|
|
|
let 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;
|
|
|
|
|
try {
|
|
|
|
|
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(is_teacher===false){
|
|
|
|
|
if(this.props.current_user.user_identity !=="学生"){
|
|
|
|
|
//专业人士
|
|
|
|
|
is_teacher=true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
|
|
|
|
|
defaultActiveKeys="0"
|
|
|
|
|
}else{
|
|
|
|
@ -219,6 +262,12 @@ class NewMyShixunModel extends Component {
|
|
|
|
|
}
|
|
|
|
|
this.callback(defaultActiveKeys);
|
|
|
|
|
}
|
|
|
|
|
if(prevProps.Contentdata !== this.props.Contentdata){
|
|
|
|
|
this.setState({
|
|
|
|
|
Contentdata:this.props.Contentdata,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//公共和我的
|
|
|
|
@ -719,57 +768,78 @@ class NewMyShixunModel extends Component {
|
|
|
|
|
}
|
|
|
|
|
// 撤销
|
|
|
|
|
getitem_basketss=(id)=>{
|
|
|
|
|
|
|
|
|
|
let url="";
|
|
|
|
|
if(this.props.exam_id===undefined){
|
|
|
|
|
url=`/item_baskets/${id}.json`;
|
|
|
|
|
axios.delete(url)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
// this.props.showNotification(`撤销成功`);
|
|
|
|
|
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: this.state.defaultActiveKey,
|
|
|
|
|
difficulty: this.state.difficulty,
|
|
|
|
|
item_type: this.state.item_type,
|
|
|
|
|
keyword: this.state.keywords,
|
|
|
|
|
page: this.state.page,
|
|
|
|
|
per_page:10,
|
|
|
|
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
|
|
|
|
};
|
|
|
|
|
this.getdatasy(data);
|
|
|
|
|
this.getbasket_listdata();
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
////console.log(error);
|
|
|
|
|
})
|
|
|
|
|
if(Undoclickable===true) {
|
|
|
|
|
Undoclickable = false;
|
|
|
|
|
url = `/item_baskets/${id}.json`;
|
|
|
|
|
axios.delete(url)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
// this.props.showNotification(`撤销成功`);
|
|
|
|
|
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: this.state.defaultActiveKey,
|
|
|
|
|
difficulty: this.state.difficulty,
|
|
|
|
|
item_type: this.state.item_type,
|
|
|
|
|
keyword: this.state.keywords,
|
|
|
|
|
page: this.state.page,
|
|
|
|
|
per_page: 10,
|
|
|
|
|
exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id),
|
|
|
|
|
};
|
|
|
|
|
this.getdatasy(data);
|
|
|
|
|
this.getbasket_listdata();
|
|
|
|
|
}
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
Undoclickable=true;
|
|
|
|
|
},1000);
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
Undoclickable=true;
|
|
|
|
|
},1000);
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
url=`/examination_banks/${this.props.exam_id}/revoke_item.json`;
|
|
|
|
|
axios.delete(url,{ data: {
|
|
|
|
|
item_id:id===undefined?"":parseInt(id),
|
|
|
|
|
}})
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
// this.props.showNotification(`撤销成功`);
|
|
|
|
|
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: this.state.defaultActiveKey,
|
|
|
|
|
difficulty: this.state.difficulty,
|
|
|
|
|
item_type: this.state.item_type,
|
|
|
|
|
keyword: this.state.keywords,
|
|
|
|
|
page: this.state.page,
|
|
|
|
|
per_page:10,
|
|
|
|
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
|
|
|
|
};
|
|
|
|
|
this.getdatasy(data);
|
|
|
|
|
this.getbasket_listdata();
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
////console.log(error);
|
|
|
|
|
})
|
|
|
|
|
if(Undoclickable===true) {
|
|
|
|
|
Undoclickable = false;
|
|
|
|
|
url = `/examination_banks/${this.props.exam_id}/revoke_item.json`;
|
|
|
|
|
axios.delete(url, {
|
|
|
|
|
data: {
|
|
|
|
|
item_id: id === undefined ? "" : parseInt(id),
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
// this.props.showNotification(`撤销成功`);
|
|
|
|
|
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: this.state.defaultActiveKey,
|
|
|
|
|
difficulty: this.state.difficulty,
|
|
|
|
|
item_type: this.state.item_type,
|
|
|
|
|
keyword: this.state.keywords,
|
|
|
|
|
page: this.state.page,
|
|
|
|
|
per_page: 10,
|
|
|
|
|
exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id),
|
|
|
|
|
};
|
|
|
|
|
this.getdatasy(data);
|
|
|
|
|
this.getbasket_listdata();
|
|
|
|
|
}
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
Undoclickable=true;
|
|
|
|
|
},1000);
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
Undoclickable=true;
|
|
|
|
|
},1000);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -884,7 +954,7 @@ class NewMyShixunModel extends Component {
|
|
|
|
|
page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list,
|
|
|
|
|
completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count,
|
|
|
|
|
program_questions_count, single_questions_count, subjective_questions_count,selectionbools,
|
|
|
|
|
modalsTypeInaudit
|
|
|
|
|
modalsTypeInaudit,Contentdata
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
const Datacount = completion_questions_count + judgement_questions_count
|
|
|
|
@ -893,6 +963,8 @@ class NewMyShixunModel extends Component {
|
|
|
|
|
+ single_questions_count
|
|
|
|
|
+ subjective_questions_count;
|
|
|
|
|
|
|
|
|
|
// console.log("弹出框");
|
|
|
|
|
// console.log(Contentdata)
|
|
|
|
|
return (
|
|
|
|
|
<div className="newMain clearfix " ref={this.saveContainer}>
|
|
|
|
|
|
|
|
|
@ -962,6 +1034,7 @@ class NewMyShixunModel extends Component {
|
|
|
|
|
/>
|
|
|
|
|
{/*头部*/}
|
|
|
|
|
<Contentpart {...this.state} {...this.props}
|
|
|
|
|
Contentdata={Contentdata}
|
|
|
|
|
exam_id={this.props.exam_id}
|
|
|
|
|
Isitapopup={"true"}
|
|
|
|
|
chakanjiexiboolindex={this.state.chakanjiexiboolindex}
|
|
|
|
|