import React, { useState } from 'react'; import router from 'umi/router'; import styles from './index.less'; import { Button } from 'antd-mobile'; import Option from './option'; const Index = ({ type = 0, analysis, title, total, no, rightAnswer, optionList = [] }) => { const [isShowAnswer, setIsShowAnswer] = useState(false); const [options, setOptions] = useState(optionList); const showAnswer = () => { setIsShowAnswer(true); }; const goSubmitAnalysis = () => { router.push('/exam/question/submit/analysis/0'); }; const handleSelect = (id, isSelected) => { options.forEach(item => { if(type===0){ item.isSelected = false; } if (id === item.id) item.isSelected = isSelected; }); setOptions([...options]); }; /** * 渲染选项 */ const renderOption = () => { return options.map((item, index) => { return