index.tsx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { Tag, Image, Button, Cell, Icon } from 'vant'
  2. import { defineComponent, nextTick, onMounted, PropType, reactive } from 'vue'
  3. import styles from './index.module.less'
  4. import deepClone from '@/helpers/deep-clone'
  5. import iconSong from '../../images/icon-song.png'
  6. // 单选和多选题
  7. export default defineComponent({
  8. name: 'choice-question',
  9. props: {
  10. value: {
  11. type: [String, Number, Array],
  12. default: ''
  13. },
  14. answers: {
  15. type: Object,
  16. default: {}
  17. },
  18. /* 只读 */
  19. readOnly: {
  20. type: Boolean,
  21. default: false
  22. }
  23. },
  24. emits: ['update:value'],
  25. setup(props, { emit }) {
  26. const state = reactive({
  27. list: [] as any
  28. })
  29. // const onSelect = (item: any) => {
  30. // if (props.type === 'checkbox') {
  31. // // 判断是否已选过
  32. // const value: any = props.value
  33. // if (value.includes(item.index)) {
  34. // const index = value.findIndex((v: any) => v === item.index)
  35. // value.splice(index, 1)
  36. // emit('update:value', [...value])
  37. // } else {
  38. // emit('update:value', [item.index, ...value])
  39. // }
  40. // } else {
  41. // emit('update:value', item.index)
  42. // }
  43. // }
  44. return () => (
  45. <div class={styles.unitSubject}>
  46. <div class={styles.unitSubjectTitle}>
  47. 4、请点击以下曲目进行评测,评测分数达到80分合格
  48. <span class={styles.unitScore}>(5分)</span>
  49. <Tag type="primary">演奏题</Tag>
  50. </div>
  51. <div class={styles.unitTitleSection}>
  52. <Image
  53. class={styles.unitTitleImg}
  54. src="https://lanhu-dds-backend.oss-cn-beijing.aliyuncs.com/merge_image/imgs/dbb27307d428424c8efb9f26032cfa1a_mergeImage.png"
  55. />
  56. </div>
  57. <div class={[styles.unitAnswers]}>
  58. <Cell class={styles.playSection} center titleClass={['van-ellipsis', styles.playTitle]}>
  59. {{
  60. icon: () => <Image class={styles.img} src={iconSong} />,
  61. title: () => <>没开机三江源没开机三江源</>,
  62. value: () => (
  63. <Button round class={styles.playBtn} type="primary">
  64. 点击评测
  65. <Icon name="play" />
  66. </Button>
  67. )
  68. }}
  69. </Cell>
  70. <div class={['van-hairline--top', styles.unitScoreNum]}>
  71. <div class={styles.score}>89</div>
  72. <div class={styles.scoreTitle}>评测分数</div>
  73. <div class={styles.scoreTips}>多次评测取完整评测的最高分数</div>
  74. </div>
  75. </div>
  76. </div>
  77. )
  78. }
  79. })