@ -1775,12 +1775,13 @@ class PollNew extends Component {
max _choicess = max _choices ;
min _choicess = min _choices ;
}
axios . post ( urlly , {
question _title : object . question . question _title ,
question _type : number ,
is _necessary : object . question . is _necessary ,
max _choices : max _choicess ,
min _choices : min _choicess ,
max _choices : max _choicess === undefined ? null : max _choicess === null ? null : max _choicess === 0 ? null : max _choicess ,
min _choices : min _choicess === undefined ? null : min _choicess === null ? null : min _choicess === 0 ? null : min _choicess ,
question _answers : option ,
question _other _answer : null ,
insert _id : insert _id
@ -2147,7 +2148,7 @@ class PollNew extends Component {
if ( minbool === true && maxbool === true ) {
for ( var i = 0 ; i < arr . length ; i ++ ) {
if ( index === i ) {
arr [ i ] . question . min _choices = parseInt ( value ) ;
arr [ i ] . question . min _choices = parseInt ( value ) ;
}
}
this . setState ( {
@ -2156,18 +2157,8 @@ class PollNew extends Component {
} else {
for ( var i = 0 ; i < arr . length ; i ++ ) {
if ( index === i ) {
try {
if ( parseInt ( value ) === 0 ) {
arr [ i ] . question . min _choices = 2 ;
arr [ i ] . question . max _choices = length ;
} else {
arr [ i ] . question . min _choices = parseInt ( value ) ;
arr [ i ] . question . max _choices = max ;
}
} catch ( e ) {
arr [ i ] . question . min _choices = 2 ;
arr [ i ] . question . max _choices = length ;
}
arr [ i ] . question . max _choices = length ;
break ;
}
}
@ -2179,7 +2170,7 @@ class PollNew extends Component {
}
//最大值
HandleGradationGroupChangeee = ( value , index , minchoices ) => {
HandleGradationGroupChangeee = ( value , index , minchoices ,length ) => {
// console.log("2112");
// console.log(value);
// console.log(minchoices);
@ -2187,11 +2178,19 @@ class PollNew extends Component {
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 {
}
else {
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 ) ;
}
}
}
@ -2464,9 +2463,8 @@ class PollNew extends Component {
// console.log(this.state.projects===undefined?"":this.state.projects.poll_questions)
var displaymysave = ( mysave === true ) ? "" : "display:none;" ;
return (
< div >
< div >
{ /*提示*/ }
{ Modalstype && Modalstype === true ? < Modals
modalsType = { this . state . Modalstype }
@ -2885,7 +2883,7 @@ class PollNew extends Component {
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 }
>
< Option value = { String ( "0" ) } > -- < / O p t i o n >
< Option value = { "0" } > -- < / O p t i o n >
{ itemo . question . answers === undefined ? "" : itemo . question . answers . map ( ( itemt , indext ) => {
return (
indext >= 1 ? < Option value = { String ( indext + 1 ) } > { indext + 1 } < / O p t i o n > : " "
@ -2896,10 +2894,10 @@ class PollNew extends Component {
className = "ml10 mr10 color-grey-6 lineh-40 fl" > ~ < / s p a n >
{ /*可选最大*/ }
< Select className = "fl w100"
onChange = { ( value ) => this . HandleGradationGroupChangeee ( value , indexo , itemo . question . min _choices )}
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 }
>
< Option value = { String ( "0" ) } > -- < / O p t i o n >
< Option value = { "0" } > -- < / O p t i o n >
{ itemo . question . answers === undefined ? "" : itemo . question . answers . map ( ( itemt , indext ) => {
return (
indext >= 1 ? < Option value = { String ( indext + 1 ) } > { indext + 1 } < / O p t i o n > : " "
@ -3139,7 +3137,7 @@ class PollNew extends Component {
className = "ml10 mr10 color-grey-6 lineh-40 fl" > ~ < / s p a n >
{ /*可选最大*/ }
< Select className = "fl w100"
onChange = { ( value ) => this . HandleGradationGroupChangeee ( value , indexo , itemo . question . min _choices )}
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 }
>
< Option value = { String ( "0" ) } > -- < / O p t i o n >
@ -3391,7 +3389,7 @@ class PollNew extends Component {
className = "ml10 mr10 color-grey-6 lineh-40 fl" > ~ < / s p a n >
{ /*可选最大*/ }
< Select className = "fl w100"
onChange = { ( value ) => this . HandleGradationGroupChangeee ( value , indexo , itemo . question . min _choices )}
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 }
>
< Option value = { String ( "0" ) } > -- < / O p t i o n >