|
|
|
@ -73,6 +73,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
Newdisplay: false,
|
|
|
|
|
first_category_url: "",
|
|
|
|
|
left_banner_id: "",
|
|
|
|
|
publishtimeid_int:0,
|
|
|
|
|
}
|
|
|
|
|
// console.log("试卷新建和编辑");
|
|
|
|
|
// console.log(JSON.stringify(props));
|
|
|
|
@ -390,7 +391,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
//添加单选题目
|
|
|
|
|
addmysingles = () => {
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
this.scrollToAnchor("publishtimeid");
|
|
|
|
|
this.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int);
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
@ -411,14 +412,14 @@ class PollNewQuestbank 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.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int);
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
@ -440,7 +441,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.addMytopic(2, this.state.pollid, Insertposition, false, 0);
|
|
|
|
|
this.addMytopic(2, this.state.pollid, Insertposition, false, 0,0);
|
|
|
|
|
this.scrollToAnchor("publishtimeids");
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
@ -449,7 +450,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
//添加主观题目
|
|
|
|
|
addmymainsint = () => {
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
this.scrollToAnchor("publishtimeid");
|
|
|
|
|
this.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int);
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -466,21 +467,23 @@ class PollNewQuestbank 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) => {
|
|
|
|
|
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;
|
|
|
|
@ -634,7 +637,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//新增添加题目 有new
|
|
|
|
|
addMytopic = (index, pollid, Insertposition, Whether, id) => {
|
|
|
|
|
addMytopic = (index, pollid, Insertposition, Whether, id,inty) => {
|
|
|
|
|
//Whether 是否插入
|
|
|
|
|
// console.log("addMytopic 90")
|
|
|
|
|
// console.log(index)
|
|
|
|
@ -643,6 +646,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
// console.log(Whether)
|
|
|
|
|
console.log("addMytopic");
|
|
|
|
|
console.log(id);
|
|
|
|
|
|
|
|
|
|
if (this.state.q_countst > 0) {
|
|
|
|
|
if(Whether===true){
|
|
|
|
|
this.scrollToAnchor("publishtimeids");
|
|
|
|
@ -650,6 +654,11 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
this.props.showNotification(`不能同时编辑两题`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(Whether===true){
|
|
|
|
|
this.setState({
|
|
|
|
|
publishtimeid_int:inty,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.state.Insertposition = Insertposition;
|
|
|
|
|
var Whethername = null;
|
|
|
|
|
if (Whether === true) {
|
|
|
|
@ -2738,16 +2747,25 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
// this.props.initPublic(undefined);
|
|
|
|
|
};
|
|
|
|
|
//跳转道描点的地方
|
|
|
|
|
scrollToAnchor = (anchorName) => {
|
|
|
|
|
if (anchorName) {
|
|
|
|
|
// 找到锚点
|
|
|
|
|
let anchorElement = document.getElementById(anchorName);
|
|
|
|
|
// 如果对应id的锚点存在,就跳转到锚点
|
|
|
|
|
if(anchorElement) { anchorElement.scrollIntoView(); }
|
|
|
|
|
// scrollToAnchor = (anchorName) => {
|
|
|
|
|
// if (anchorName) {
|
|
|
|
|
// // 找到锚点
|
|
|
|
|
// let anchorElement = document.getElementById(anchorName);
|
|
|
|
|
// // 如果对应id的锚点存在,就跳转到锚点
|
|
|
|
|
// if(anchorElement) { anchorElement.scrollIntoView(false); }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
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})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
let {
|
|
|
|
|
addonAfter,
|
|
|
|
@ -3039,12 +3057,12 @@ class PollNewQuestbank 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>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3120,7 +3138,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
|
let resultDomtwo;
|
|
|
|
|
resultDomtwo =
|
|
|
|
|
<div id={"publishtimeid"}>
|
|
|
|
|
<div id={"publishtimeid"+index}>
|
|
|
|
|
<span className="color-grey-6">{itemo&&itemo.question&&itemo.question.question_number}、</span>
|
|
|
|
|
<span
|
|
|
|
|
id={"ceshiyong3"}
|
|
|
|
@ -3426,7 +3444,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
</div>
|
|
|
|
|
</div> : "")
|
|
|
|
|
:
|
|
|
|
|
<div className="bor-bottom-greyE problemShow" id={"publishtimeid"}>
|
|
|
|
|
<div className="bor-bottom-greyE problemShow" >
|
|
|
|
|
{resultDom}
|
|
|
|
|
{this.state.Newdisplay === false ?
|
|
|
|
|
|
|
|
|
@ -3435,7 +3453,7 @@ class PollNewQuestbank extends Component {
|
|
|
|
|
let arrid = itemo.question.id;
|
|
|
|
|
let resultDomtwo;
|
|
|
|
|
resultDomtwo =
|
|
|
|
|
<div id={"publishtimeid"}>
|
|
|
|
|
<div id={"publishtimeid"+index}>
|
|
|
|
|
<span className="color-grey-6">{itemo&&itemo.question&&itemo.question.question_number}、</span>
|
|
|
|
|
|
|
|
|
|
<span
|
|
|
|
|