|
|
|
@ -995,6 +995,37 @@ class PollNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 other = [];
|
|
|
|
|
var option = [];
|
|
|
|
@ -1196,6 +1227,40 @@ class PollNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
|
// this.props.showNotification('可选的最大限制不能小于最小限制!');
|
|
|
|
|
//
|
|
|
|
@ -1482,11 +1547,44 @@ class PollNew extends Component {
|
|
|
|
|
if(object.question.max_choices>0){
|
|
|
|
|
if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
|
this.props.showNotification(`可选的最大限制不能小于最小限制`);
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
|
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
|
|
|
|
|
//
|
|
|
|
@ -1665,11 +1763,38 @@ class PollNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if (object.question.max_choices < object.question.min_choices) {
|
|
|
|
|
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
|
|
|
|
|
//
|
|
|
|
|
// 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 other = [];
|
|
|
|
|
var option = [];
|
|
|
|
@ -2240,34 +2365,34 @@ class PollNew extends Component {
|
|
|
|
|
var minbool = false;
|
|
|
|
|
var maxbool = false;
|
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
|
if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
|
|
|
|
|
minbool = true;
|
|
|
|
|
}
|
|
|
|
|
if (max === 0 || max === "0" || max === null || max === undefined) {
|
|
|
|
|
maxbool = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (minbool === true && maxbool === true) {
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
if (index === i) {
|
|
|
|
|
arr[i].question.min_choices = parseInt(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
adddom: arr
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
|
|
|
|
|
// minbool = true;
|
|
|
|
|
// }
|
|
|
|
|
// if (max === 0 || max === "0" || max === null || max === undefined) {
|
|
|
|
|
// maxbool = true;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (minbool === true && maxbool === true) {
|
|
|
|
|
// for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
// if (index === i) {
|
|
|
|
|
// arr[i].question.min_choices = parseInt(value);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// this.setState({
|
|
|
|
|
// adddom: arr
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
if (index === i) {
|
|
|
|
|
arr[i].question.min_choices = parseInt(value);
|
|
|
|
|
arr[i].question.max_choices = length;
|
|
|
|
|
// arr[i].question.max_choices = length;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
adddom: arr
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2284,21 +2409,21 @@ class PollNew extends Component {
|
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
if (index === i) {
|
|
|
|
|
if(parseInt(value)===0&&parseInt(minchoices)===0){
|
|
|
|
|
arr[i].question.min_choices= parseInt(0);
|
|
|
|
|
arr[i].question.max_choices = parseInt(0);
|
|
|
|
|
}else if(parseInt(minchoices)===0){
|
|
|
|
|
arr[i].question.min_choices= parseInt(2);
|
|
|
|
|
arr[i].question.max_choices = parseInt(value);
|
|
|
|
|
}
|
|
|
|
|
else if(parseInt(value)===0&&parseInt(minchoices)>0){
|
|
|
|
|
arr[i].question.min_choices= parseInt(minchoices);
|
|
|
|
|
arr[i].question.max_choices = parseInt(value);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
|
|
|
|
|
// if(parseInt(value)===0&&parseInt(minchoices)===0){
|
|
|
|
|
// arr[i].question.min_choices= parseInt(0);
|
|
|
|
|
// arr[i].question.max_choices = parseInt(0);
|
|
|
|
|
// }else if(parseInt(minchoices)===0){
|
|
|
|
|
// arr[i].question.min_choices= parseInt(2);
|
|
|
|
|
// arr[i].question.max_choices = parseInt(value);
|
|
|
|
|
// }
|
|
|
|
|
// else if(parseInt(value)===0&&parseInt(minchoices)>0){
|
|
|
|
|
// arr[i].question.min_choices= parseInt(minchoices);
|
|
|
|
|
// arr[i].question.max_choices = parseInt(value);
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
|
|
|
|
|
arr[i].question.max_choices = parseInt(value);
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// console.log(2119);
|
|
|
|
@ -2774,8 +2899,13 @@ class PollNew extends Component {
|
|
|
|
|
className="color-grey-9 fl">{item.question.question_type === 1 ? "(单选题)" : item.question.question_type === 2 ? "(多选题)" : "(主观题)"}</span>
|
|
|
|
|
<span
|
|
|
|
|
className="selectAnswer 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 === "null" && item.question.max_choices === "null" ? "不限制" : "可选" + 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>
|
|
|
|
|
{
|
|
|
|
|
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 ?
|
|
|
|
|
<span className="fr">
|
|
|
|
@ -2963,7 +3093,7 @@ class PollNew extends Component {
|
|
|
|
|
<span
|
|
|
|
|
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
|
|
|
|
|
<div className="mr40 flex1 ">
|
|
|
|
|
{/*可选最小2*/}
|
|
|
|
|
{/*可选最小1*/}
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
@ -3205,7 +3335,7 @@ class PollNew extends Component {
|
|
|
|
|
<span
|
|
|
|
|
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
|
|
|
|
|
<div className="mr40 flex1 ">
|
|
|
|
|
{/*可选最小1*/}
|
|
|
|
|
{/*可选最小*/}
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
@ -3234,7 +3364,7 @@ class PollNew extends Component {
|
|
|
|
|
</Select>
|
|
|
|
|
<span
|
|
|
|
|
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
|
|
|
|
|
{/*可选最大1*/}
|
|
|
|
|
{/*可选最大*/}
|
|
|
|
|
<Select className="fl w100"
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
|
|
|
|
|
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}
|
|
|
|
@ -3456,7 +3586,7 @@ class PollNew extends Component {
|
|
|
|
|
<span
|
|
|
|
|
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
|
|
|
|
|
<div className="mr40 flex1 ">
|
|
|
|
|
{/*可选最小3*/}
|
|
|
|
|
{/*可选最小*/}
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
@ -3485,7 +3615,7 @@ class PollNew extends Component {
|
|
|
|
|
</Select>
|
|
|
|
|
<span
|
|
|
|
|
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
|
|
|
|
|
{/*可选最大3*/}
|
|
|
|
|
{/*可选最大*/}
|
|
|
|
|
<Select className="fl w100"
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
|
|
|
|
|
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}
|
|
|
|
|