|
|
|
@ -70,6 +70,7 @@ class PollNew extends Component {
|
|
|
|
|
Newdisplay:false,
|
|
|
|
|
first_category_url:"",
|
|
|
|
|
left_banner_id:"",
|
|
|
|
|
publishtimeid_int:0,
|
|
|
|
|
}
|
|
|
|
|
// console.log("试卷新建和编辑");
|
|
|
|
|
// console.log(JSON.stringify(props));
|
|
|
|
@ -366,7 +367,12 @@ class PollNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
//添加单选题目
|
|
|
|
|
addmysingles = () => {
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
this.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int);
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.state.newoption === true) {
|
|
|
|
|
this.setState({
|
|
|
|
|
newoption: false
|
|
|
|
@ -383,12 +389,18 @@ class PollNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.addMytopic(1, this.state.pollid, Insertposition, false, 0);
|
|
|
|
|
// }
|
|
|
|
|
this.addMytopic(1, this.state.pollid, Insertposition, false, 0,0);
|
|
|
|
|
this.scrollToAnchor("publishtimeids");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//添加多选题目
|
|
|
|
|
addmydoubles = () => {
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
this.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int);
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// console.log("addmymainsint 70")
|
|
|
|
|
if (this.state.newoption === true) {
|
|
|
|
|
this.setState({
|
|
|
|
@ -407,13 +419,17 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.addMytopic(2, this.state.pollid, Insertposition, false, 0);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
this.addMytopic(2, this.state.pollid, Insertposition, false, 0,0);
|
|
|
|
|
this.scrollToAnchor("publishtimeids");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//添加主观题目
|
|
|
|
|
addmymainsint = () => {
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
this.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int);
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
Newdisplay:true,
|
|
|
|
|
})
|
|
|
|
@ -427,22 +443,23 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.addMytopic(3, this.state.pollid, Insertposition, false, 0);
|
|
|
|
|
// }
|
|
|
|
|
this.addMytopic(3, this.state.pollid, Insertposition, false, 0,0);
|
|
|
|
|
this.scrollToAnchor("publishtimeids");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//编辑方法
|
|
|
|
|
adddomedit = (object) => {
|
|
|
|
|
adddomedit = (object,indexysl) => {
|
|
|
|
|
// console.log("adddomedit 76");
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
this.scrollToAnchor("publishtimeids");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var anserbool = false;
|
|
|
|
|
this.setState({
|
|
|
|
|
q_countst: 1,
|
|
|
|
|
bindingid:object.question.id
|
|
|
|
|
bindingid:object.question.id,
|
|
|
|
|
publishtimeid_int:indexysl
|
|
|
|
|
})
|
|
|
|
|
// window.scrollTo(0, this.refs.targetElement.offsetTops)
|
|
|
|
|
let {adddom} = this.state;
|
|
|
|
@ -581,9 +598,19 @@ class PollNew extends Component {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//滚动
|
|
|
|
|
scrollToAnchor=(index)=>{
|
|
|
|
|
// let name="Anchor_"+index;
|
|
|
|
|
console.log("scrollToAnchor");
|
|
|
|
|
console.log(index);
|
|
|
|
|
if (index) {
|
|
|
|
|
let anchorElement = document.getElementById(index);
|
|
|
|
|
// if(anchorElement) { anchorElement.scrollIntoView(); }
|
|
|
|
|
$("html").animate({ scrollTop: $(anchorElement).offset().top - 150})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//新增添加题目 有new
|
|
|
|
|
addMytopic = (index, pollid, Insertposition, Whether, id) => {
|
|
|
|
|
addMytopic = (index, pollid, Insertposition, Whether, id,inty) => {
|
|
|
|
|
//Whether 是否插入
|
|
|
|
|
// console.log("addMytopic 90")
|
|
|
|
|
// console.log(index)
|
|
|
|
@ -593,10 +620,17 @@ class PollNew extends Component {
|
|
|
|
|
console.log("addMytopic");
|
|
|
|
|
console.log(id);
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
if(Whether===true){
|
|
|
|
|
this.scrollToAnchor("publishtimeids");
|
|
|
|
|
}
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(Whether===true){
|
|
|
|
|
this.setState({
|
|
|
|
|
publishtimeid_int:inty,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.state.Insertposition = Insertposition;
|
|
|
|
|
var Whethername = null;
|
|
|
|
|
if (Whether === true) {
|
|
|
|
@ -2081,32 +2115,67 @@ class PollNew extends Component {
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
opr: "up",
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
// try {
|
|
|
|
|
// if (result.data.status === 0) {
|
|
|
|
|
// this.props.showNotification(`上移成功`);
|
|
|
|
|
// thiss.thisinitializationdatanew();
|
|
|
|
|
// }
|
|
|
|
|
// // console.log(JSON.stringify(result))
|
|
|
|
|
// } catch (e) {
|
|
|
|
|
// // console.log("上移题目成功 错误")
|
|
|
|
|
// console.log(e)
|
|
|
|
|
// }
|
|
|
|
|
try {
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
|
this.props.showNotification(`上移成功`);
|
|
|
|
|
thiss.thisinitializationdatanew();
|
|
|
|
|
if(result){
|
|
|
|
|
if(result.data){
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
|
this.props.showNotification(`上移成功`);
|
|
|
|
|
thiss.thisinitializationdatanew();
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
}
|
|
|
|
|
// console.log(JSON.stringify(result))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// console.log("上移题目成功 错误")
|
|
|
|
|
console.log(e)
|
|
|
|
|
}
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
var url = `/poll_questions/${poll_question_id}/up_down.json`;
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
opr: "down",
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
// try {
|
|
|
|
|
// if (result.data.status === 0) {
|
|
|
|
|
// // message.success("下移题目成功", 1)
|
|
|
|
|
// this.props.showNotification(`下移成功`);
|
|
|
|
|
// thiss.thisinitializationdatanew();
|
|
|
|
|
// }
|
|
|
|
|
// // console.log(JSON.stringify(result))
|
|
|
|
|
// } catch (e) {
|
|
|
|
|
// // console.log("下移题目成功 错误")
|
|
|
|
|
// console.log(e)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
|
// message.success("下移题目成功", 1)
|
|
|
|
|
this.props.showNotification(`下移成功`);
|
|
|
|
|
thiss.thisinitializationdatanew();
|
|
|
|
|
if(result){
|
|
|
|
|
if(result.data){
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
|
this.props.showNotification(`下移成功`);
|
|
|
|
|
thiss.thisinitializationdatanew();
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`下移失败`);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// console.log(JSON.stringify(result))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// console.log("下移题目成功 错误")
|
|
|
|
|
this.props.showNotification(`上移失败`);
|
|
|
|
|
console.log(e)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -2243,17 +2312,17 @@ class PollNew extends Component {
|
|
|
|
|
//点击向上排序按钮事件
|
|
|
|
|
handleClickBySortUp = (index, object) => {
|
|
|
|
|
// console.log("handleClickBySortUp 521")
|
|
|
|
|
let arr = this.state.poll_questions;
|
|
|
|
|
let newarr = [...arr];
|
|
|
|
|
// let arr = this.state.poll_questions;
|
|
|
|
|
// let newarr = [...arr];
|
|
|
|
|
// console.log(newarr)
|
|
|
|
|
if (index != 0) {
|
|
|
|
|
this.Upanddownmovementof(true, object.question.id);
|
|
|
|
|
let temp = newarr[index - 1];
|
|
|
|
|
newarr[index - 1] = newarr[index];
|
|
|
|
|
newarr[index] = temp;
|
|
|
|
|
this.setState({
|
|
|
|
|
poll_questions: newarr,
|
|
|
|
|
});
|
|
|
|
|
// let temp = newarr[index - 1];
|
|
|
|
|
// newarr[index - 1] = newarr[index];
|
|
|
|
|
// newarr[index] = temp;
|
|
|
|
|
// this.setState({
|
|
|
|
|
// poll_questions: newarr,
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2265,12 +2334,12 @@ class PollNew extends Component {
|
|
|
|
|
//
|
|
|
|
|
if (index != newarr.length - 1) {
|
|
|
|
|
this.Upanddownmovementof(false, object.question.id);
|
|
|
|
|
let temp = newarr[index + 1];
|
|
|
|
|
newarr[index + 1] = newarr[index];
|
|
|
|
|
newarr[index] = temp;
|
|
|
|
|
this.setState({
|
|
|
|
|
poll_questions: newarr,
|
|
|
|
|
});
|
|
|
|
|
// let temp = newarr[index + 1];
|
|
|
|
|
// newarr[index + 1] = newarr[index];
|
|
|
|
|
// newarr[index] = temp;
|
|
|
|
|
// this.setState({
|
|
|
|
|
// poll_questions: newarr,
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
// console.log("2222index==arr.length");
|
|
|
|
|
// console.log(this.state.poll_questions);
|
|
|
|
@ -2897,12 +2966,12 @@ class PollNew extends Component {
|
|
|
|
|
title="下移"><i
|
|
|
|
|
className="color-green font-18 iconfont icon-xiangxiayi"></i></Tooltip></a>}
|
|
|
|
|
<a className="mr30"
|
|
|
|
|
onClick={() => this.addMytopic(item.question.question_type, this.state.pollid, index + 1, true, item.question.id)}><Tooltip
|
|
|
|
|
onClick={() => this.addMytopic(item.question.question_type, this.state.pollid, index + 1, true, item.question.id,index)}><Tooltip
|
|
|
|
|
title={item.question.question_type === 1 ? "插入单选题" : item.question.question_type === 2 ? "插入多选题" : "插入主观题"}><i
|
|
|
|
|
className="color-green font-18 iconfont icon-roundaddfill"></i></Tooltip></a>
|
|
|
|
|
<a onClick={() => this.adddomedit(item)}><Tooltip title="编辑"><i
|
|
|
|
|
<a onClick={() => this.adddomedit(item,index)}><Tooltip title="编辑"><i
|
|
|
|
|
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a>
|
|
|
|
|
</span> : <span className="fr"> <a onClick={() => this.adddomedit(item)}><Tooltip title="编辑"><i
|
|
|
|
|
</span> : <span className="fr"> <a onClick={() => this.adddomedit(item,index)}><Tooltip title="编辑"><i
|
|
|
|
|
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a> </span>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2959,7 +3028,7 @@ class PollNew extends Component {
|
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
|
let resultDomtwo;
|
|
|
|
|
resultDomtwo =
|
|
|
|
|
<div >
|
|
|
|
|
<div id={"publishtimeid"+index}>
|
|
|
|
|
<span
|
|
|
|
|
className="font-16 color-grey-6 mb20" id={"yslproblms3"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
|
|
|
|
|
<Checkbox value={itemo.question.is_necessary}
|
|
|
|
@ -3201,7 +3270,7 @@ class PollNew extends Component {
|
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
|
let resultDomtwo;
|
|
|
|
|
resultDomtwo =
|
|
|
|
|
<div >
|
|
|
|
|
<div id={"publishtimeid"+index}>
|
|
|
|
|
<span
|
|
|
|
|
className="font-16 color-grey-6 mb20" id={"yslproblms2"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
|
|
|
|
|
<Checkbox value={itemo.question.is_necessary}
|
|
|
|
@ -3452,7 +3521,7 @@ class PollNew extends Component {
|
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
|
let resultDomtwo;
|
|
|
|
|
resultDomtwo =
|
|
|
|
|
<div className="problemShow">
|
|
|
|
|
<div className="problemShow" id={"publishtimeids"}>
|
|
|
|
|
<span
|
|
|
|
|
className="font-16 color-grey-6 mb20" id={"yslproblms"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
|
|
|
|
|
<Checkbox value={itemo.question.is_necessary}
|
|
|
|
|