unitDetail.tsx 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import OEmpty from '@/components/o-empty'
  2. import OHeader from '@/components/o-header'
  3. import OSearch from '@/components/o-search'
  4. import OSticky from '@/components/o-sticky'
  5. import { Button, Dialog, Icon, Tab, Tabs } from 'vant'
  6. import { computed, defineComponent, onMounted, reactive, ref } from 'vue'
  7. import questIcon from '@/school/images/quest-icon.png'
  8. import styles from './index.module.less'
  9. import { useRoute, useRouter } from 'vue-router'
  10. import UnitListItem from './models/unit-list-item'
  11. import UnitStudentList from './models/unit-student-list'
  12. import { state } from '@/state'
  13. import request from '@/helpers/request'
  14. export default defineComponent({
  15. name: 'unitDetail',
  16. setup() {
  17. const router = useRouter()
  18. const route = useRoute()
  19. const form = reactive({
  20. studentList: {} as any
  21. })
  22. const refreshing = ref(false)
  23. const loading = ref(false)
  24. const platformApi = state.platformApi
  25. const activeName = ref(1)
  26. const info = ref({} as any)
  27. const showTip = ref(false)
  28. const getDetail = async () => {
  29. try {
  30. const res = await request.post(`${platformApi}/classGroupUnitExamination/detail`, {
  31. data: { classGroupUnitExaminationId: route.query.id },
  32. requestType: 'form'
  33. })
  34. info.value = res.data
  35. console.log('🚀 ~ file: unitDetail.tsx:45 ~ getDetail ~ info.value', info.value)
  36. } catch (e) {
  37. console.log(e)
  38. }
  39. }
  40. const getStudentList = async () => {
  41. try {
  42. const { data } = await request.post(`${platformApi}/studentUnitExamination/studentDetail`, {
  43. data: {
  44. classGroupUnitExaminationId: route.query.id
  45. },
  46. requestType: 'form'
  47. })
  48. console.log(data)
  49. form.studentList = data || {}
  50. } catch {
  51. //
  52. }
  53. }
  54. // 判断是否可以查看测试报名,如果没有学生则不能查看
  55. const activeNameStatus = computed(() =>
  56. form.studentList[activeName.value] && form.studentList[activeName.value].length > 0
  57. ? false
  58. : true
  59. )
  60. onMounted(() => {
  61. getDetail()
  62. getStudentList()
  63. })
  64. return () => (
  65. <div class={styles.unitDetail}>
  66. <UnitListItem item={info.value}></UnitListItem>
  67. <div class={styles.tabsWrap}>
  68. <Icon
  69. class={styles.tabsWrapIcon}
  70. name={questIcon}
  71. size={18}
  72. color="#333"
  73. onClick={() => {
  74. showTip.value = true
  75. }}
  76. />
  77. <Tabs
  78. v-model:active={activeName.value}
  79. class={styles.rankTabs}
  80. background={'#F8F8F8'}
  81. title-active-color={'#333333'}
  82. title-inactive-color={'#777'}
  83. color={'#FF8057'}
  84. shrink
  85. >
  86. <Tab name={1} title="I类学生">
  87. <UnitStudentList type={1}></UnitStudentList>
  88. </Tab>
  89. <Tab name={2} title="II类学生">
  90. <UnitStudentList type={2}></UnitStudentList>
  91. </Tab>
  92. <Tab name={3} title="III类学生">
  93. <UnitStudentList type={3}></UnitStudentList>
  94. </Tab>
  95. </Tabs>
  96. </div>
  97. <OSticky position="bottom">
  98. <div class={['btnGroup']}>
  99. <Button
  100. block
  101. round
  102. type="primary"
  103. disabled={activeNameStatus.value}
  104. onClick={() => {
  105. router.push({
  106. path: '/unit-detail',
  107. query: {
  108. id: route.query.id,
  109. level: activeName.value
  110. }
  111. })
  112. }}
  113. >
  114. 测试报告
  115. </Button>
  116. </div>
  117. </OSticky>
  118. <Dialog
  119. class="exercisDetailDialog"
  120. v-model:show={showTip.value}
  121. title="提示框"
  122. confirmButtonText="我知道了"
  123. v-slots={{
  124. title: () => (
  125. <div class={styles.DialogTitle}>
  126. <span></span>
  127. <p>学生分类</p>
  128. </div>
  129. ),
  130. default: () => (
  131. <div class={styles.DialogConent}>
  132. <p>
  133. 根据学生入团的批次对不同训练阶段的学生进行分类,不同训练阶段的学生可布置不同标准的课后训练和单元测验内容。
  134. </p>
  135. <br />
  136. <p>
  137. <span>I类学生:</span>最新进入本乐团的学员
  138. </p>
  139. <p>
  140. <span>II类学生:</span>较早进入本乐团的学员
  141. </p>
  142. <p>
  143. <span>III类学生:</span>最早进入本乐团的学员
  144. </p>
  145. </div>
  146. )
  147. }}
  148. ></Dialog>
  149. </div>
  150. )
  151. }
  152. })