import React,{ Component } from "react"; import {Checkbox,Radio} from "antd"; import '../css/members.css' import '../css/busyWork.css' import './pollStyle.css' import axios from 'axios'; const map={1:"单选题",2:"多选题",3:"主观题",4:"主观题"} class PollDetailTabThird extends Component{ constructor(props){ super(props); this.state={ pollDetail:undefined } } getPollInfo=()=>{ let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}.json`; axios.get(url).then((result)=>{ if(result.status==200){ this.setState({ pollDetail:result.data }) } }).catch((error)=>{ console.log(error); }) } componentDidMount=()=>{ this.getPollInfo(); } render(){ let {pollDetail}=this.state; return(
{ pollDetail.poll.polls_description }
}{ pollDetail && pollDetail.question_types.q_counts===0 ? "" : { pollDetail && pollDetail.question_types.q_counts > 0 && 合计{pollDetail.question_types.q_counts}题: } { pollDetail && pollDetail.question_types.q_singles > 0 && 单选题{pollDetail.question_types.q_singles}题 } { pollDetail && pollDetail.question_types.q_doubles > 0 && 多选题{pollDetail.question_types.q_doubles}题 } { pollDetail && pollDetail.question_types.q_mains > 0 && 主观题{pollDetail.question_types.q_mains}题 } }
{ pollDetail && pollDetail.questions.map((item,key)=>{ return({item.question.question_number}、{map[item.question.question_type]} { item.question.is_necessary==1 ? 必答:选答 } { item.question.question_type == 2 && item.question.min_choices && item.question.max_choice ? { item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : "可选"+item.question.min_choices+"-"+item.question.max_choices+"项" } :"" }