dev_aliyun_beta
杨树林 6 years ago
parent 5493c0f7a6
commit bf1af80b41

@ -1014,7 +1014,37 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1214,6 +1244,37 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1502,7 +1563,37 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1673,6 +1764,37 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -2240,60 +2362,76 @@ class PollNewQuestbank extends Component {
} }
//最小值 //最小值
HandleGradationGroupChangee = (value, index, max, length) => { HandleGradationGroupChangee = (value, index, max, length) => {
// console.log("最小值");
// console.log(value);
// console.log(index);
// console.log(max);
// console.log(length);
// debugger
var minbool = false; var minbool = false;
var maxbool = false; var maxbool = false;
let arr = this.state.adddom; let arr = this.state.adddom;
if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) { // if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
minbool = true; // minbool = true;
} // }
if (max === 0 || max === "0" || max === null || max === undefined) { // if (max === 0 || max === "0" || max === null || max === undefined) {
maxbool = true; // maxbool = true;
} // }
//
if (minbool === true && maxbool === true) { // if (minbool === true && maxbool === true) {
for (var i = 0; i < arr.length; i++) { // for (var i = 0; i < arr.length; i++) {
if (index === i) { // if (index === i) {
arr[i].question.min_choices = parseInt(value); // arr[i].question.min_choices = parseInt(value);
} // }
} // }
this.setState({ // this.setState({
adddom: arr // adddom: arr
}) // })
} else { // } else {
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
arr[i].question.min_choices = parseInt(value); arr[i].question.min_choices = parseInt(value);
arr[i].question.max_choices = length; // arr[i].question.max_choices = length;
break; break;
}
} }
this.setState({
adddom: arr
})
} }
this.setState({
adddom: arr
})
// }
} }
//最大值 //最大值
HandleGradationGroupChangeee = (value, index, minchoices, length) => { HandleGradationGroupChangeee = (value, index, minchoices, length) => {
// console.log("2112");
// console.log(value);
// console.log(minchoices);
// console.log("最大值");
// console.log(value);
// console.log(index);
// console.log(minchoices);
// console.log(length);
let arr = this.state.adddom; let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
if(parseInt(value)===0&&parseInt(minchoices)===0){ // if(parseInt(value)===0&&parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(0); // arr[i].question.min_choices= parseInt(0);
arr[i].question.max_choices = parseInt(0); // arr[i].question.max_choices = parseInt(0);
}else if(parseInt(minchoices)===0){ // }else if(parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(2); // arr[i].question.min_choices= parseInt(2);
arr[i].question.max_choices = parseInt(value); // arr[i].question.max_choices = parseInt(value);
} // }
else if(parseInt(value)===0&&parseInt(minchoices)>0){ // else if(parseInt(value)===0&&parseInt(minchoices)>0){
arr[i].question.min_choices= parseInt(minchoices); // arr[i].question.min_choices= parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); // arr[i].question.max_choices = parseInt(value);
} // }
else { // else {
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); // arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); arr[i].question.max_choices = parseInt(value);
} // }
} }
} }
// console.log(2119); // console.log(2119);
@ -2830,8 +2968,13 @@ class PollNewQuestbank extends Component {
className="color-grey-9 fl">{item.question.question_type === 1 ? "单选题" : item.question.question_type === 2 ? "多选题" : "主观题"}</span> className="color-grey-9 fl">{item.question.question_type === 1 ? "单选题" : item.question.question_type === 2 ? "多选题" : "主观题"}</span>
<span <span
className=" ml10">{item.question.is_necessary === 1 ? "(必答)" : item.question.question_type === 2 ? "(选答)" : "(选答)"}</span> className=" ml10">{item.question.is_necessary === 1 ? "(必答)" : item.question.question_type === 2 ? "(选答)" : "(选答)"}</span>
<span style={{color: "#4B4B4B"}} {
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "" : item.question.min_choices === null && item.question.max_choices === null ? "" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "" : "可选" + item.question.min_choices + "-" + item.question.max_choices + "项")}</span> item.question.question_type === 2?
<span style={{color: "#4B4B4B"}}
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
: ""
}
{ {
polls_status === undefined || polls_status === 1 ? polls_status === undefined || polls_status === 1 ?
<span className="fr"> <span className="fr">
@ -3106,7 +3249,7 @@ class PollNewQuestbank extends Component {
</style> </style>
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} value={itemo.question.min_choices === null || itemo.question.min_choices === undefined ||itemo.question.min_choices === "null"|| itemo.question.min_choices === 0 || itemo.question.min_choices === "0"?"0": itemo.question.min_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
@ -3122,7 +3265,7 @@ class PollNewQuestbank extends Component {
{/*可选最大*/} {/*可选最大*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3416,8 +3559,7 @@ class PollNewQuestbank extends Component {
</style> </style>
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} value={itemo.question.min_choices === null || itemo.question.min_choices === undefined ||itemo.question.min_choices === "null"|| itemo.question.min_choices === 0 || itemo.question.min_choices === "0"?"0": itemo.question.min_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3432,7 +3574,7 @@ class PollNewQuestbank extends Component {
{/*可选最大*/} {/*可选最大*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3736,7 +3878,7 @@ class PollNewQuestbank extends Component {
</style> </style>
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} value={itemo.question.min_choices === null || itemo.question.min_choices === undefined ||itemo.question.min_choices === "null"|| itemo.question.min_choices === 0 || itemo.question.min_choices === "0"?"0": itemo.question.min_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
@ -3752,7 +3894,7 @@ class PollNewQuestbank extends Component {
{/*可选最大*/} {/*可选最大*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {

Loading…
Cancel
Save