|
|
|
@ -844,12 +844,12 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
if (object.question.question_type === 2) {
|
|
|
|
|
if (object.question.max_choices > 0) {
|
|
|
|
|
if (object.question.min_choices < 2) {
|
|
|
|
|
this.props.showNotification(`可选最小不能少于2个`);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// if (object.question.min_choices < 2) {
|
|
|
|
|
// this.props.showNotification(`可选最小不能少于2个`);
|
|
|
|
|
//
|
|
|
|
|
// return;
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1332,10 +1332,10 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
if (object.question.question_type === 2) {
|
|
|
|
|
if (object.question.max_choices > 0) {
|
|
|
|
|
if (object.question.min_choices < 2) {
|
|
|
|
|
this.props.showNotification(`可选最小不能少于2个`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// if (object.question.min_choices < 2) {
|
|
|
|
|
// this.props.showNotification(`可选最小不能少于2个`);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (object.question.new === "new") {
|
|
|
|
@ -2108,14 +2108,24 @@ class PollNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//最大值
|
|
|
|
|
HandleGradationGroupChangeee = (value, index) => {
|
|
|
|
|
|
|
|
|
|
HandleGradationGroupChangeee = (value, index,minchoices) => {
|
|
|
|
|
// console.log("2112");
|
|
|
|
|
// console.log(value);
|
|
|
|
|
// console.log(minchoices);
|
|
|
|
|
let arr = this.state.adddom;
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
if (index === i) {
|
|
|
|
|
arr[i].question.max_choices = parseInt(value);
|
|
|
|
|
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);
|
|
|
|
|
// console.log(arr);
|
|
|
|
|
this.setState({
|
|
|
|
|
adddom: arr
|
|
|
|
|
})
|
|
|
|
@ -2285,7 +2295,7 @@ class PollNew extends Component {
|
|
|
|
|
readOnlys: "readOnly",
|
|
|
|
|
cancellation: false,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`;
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
@ -2322,7 +2332,7 @@ class PollNew extends Component {
|
|
|
|
|
gotohome=()=>{
|
|
|
|
|
const { current_user} = this.props
|
|
|
|
|
|
|
|
|
|
this.props.history.push(current_user.first_category_url);
|
|
|
|
|
this.props.history.push(current_user && current_user.first_category_url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// let courseId=this.props.match.params.coursesId;
|
|
|
|
@ -2388,7 +2398,7 @@ class PollNew extends Component {
|
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
|
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue"
|
|
|
|
|
to={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
|
|
|
|
|
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
|
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
|
<span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span>
|
|
|
|
|
</p>
|
|
|
|
@ -2772,7 +2782,7 @@ class PollNew extends Component {
|
|
|
|
|
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
|
|
|
|
|
{/*可选最大*/}
|
|
|
|
|
<Select className="fl w100"
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo)}
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
|
|
|
|
|
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")}>--</Option>
|
|
|
|
@ -3015,7 +3025,7 @@ class PollNew extends Component {
|
|
|
|
|
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
|
|
|
|
|
{/*可选最大*/}
|
|
|
|
|
<Select className="fl w100"
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo)}
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
|
|
|
|
|
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")}>--</Option>
|
|
|
|
@ -3267,7 +3277,7 @@ class PollNew extends Component {
|
|
|
|
|
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
|
|
|
|
|
{/*可选最大*/}
|
|
|
|
|
<Select className="fl w100"
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo)}
|
|
|
|
|
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
|
|
|
|
|
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")}>--</Option>
|
|
|
|
|