index.js 2.54 KB
Newer Older
duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
1 2 3 4 5 6 7 8
import React, { useState } from 'react';
import styles from './index.less';
import config from '@/config';
import { Button } from 'antd-mobile';
import classNames from 'classNames';
const Index = ({}) => {
  const [isShowAnswer, setIsShowAnswer] = useState(false);
  const [isSelected, setIsSelected] = useState(false);
duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
9

duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
  const options = [
    {
      id: 1,
      title: '前交通动脉',
      isRight: true,
    },
    {
      id: 1,
      title: '矩形备份',
      isRight: true,
    },
    {
      id: 1,
      title: '矩形备份',
      isRight: true,
    },
    {
      id: 1,
      title: '矩形备份',
      isRight: false,
    },
    {
      id: 1,
      title: '矩形备份',
      isRight: true,
    },
  ];

  const showAnswer = () => {
    setIsShowAnswer(true);
  };

  const selectOption=()=>{
  }

  const renderOption = () => {
    return options.map((item, index) => {
      return (
        <div
          className={classNames(
            styles.option,
            isShowAnswer && (item.isRight ? styles.right : styles.error),
            isSelected && styles.selected
          )}
        >
          {config.selectNo[index]}.{item.title}
          {isShowAnswer && (
            <img src={`/images/${item.isRight ? 'right' : 'error'}.png`} alt=""></img>
          )}
        </div>
      );
    });
  };
  return (
    <div className={styles.root}>
      <div className={styles.title}>
        2/211脑底动脉环在脑循环中起着非常重要的作用能沟通脑前脑右的血液供应下列哪条动脉不参与脑底动脉环的组成
      </div>
      <div className={styles.options}>{renderOption()}</div>
      {isShowAnswer && (
        <div className={styles.answer}>
          <div className={styles.rightAnswer}>正确答案为B</div>
          <div className={styles.analysis}>
            <span>题型解析</span>
            脑底动脉环的组成包括颈内动脉大脑前动脉起始段前交通动脉大脑后动脉和后交通动脉不包括椎动脉
          </div>
        </div>
      )}
      {!isShowAnswer && (
        <div className={styles.submit}>
          <Button type="primary" onClick={showAnswer}>
            查看答案
          </Button>
        </div>
      )}
      <div className={styles.action}>
        <div className={styles.pre}>上一题</div>
        <div className={styles.input}>
          跳转到
          <input type="text" />
        </div>
        <div className={styles.next}>下一题</div>
      </div>
    </div>
  );
duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
95 96
};

duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
97
export default Index;