result.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <!--
  2. * @Author: wanglj wanglijie@dashoo.cn
  3. * @Date: 2025-03-17 13:36:58
  4. * @LastEditors: wanglj wanglijie@dashoo.cn
  5. * @LastEditTime: 2025-03-28 13:46:42
  6. * @FilePath: \labsop-h5\src\view\training\index.vue
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. -->
  9. <template>
  10. <div class="app-container">
  11. <h4>考试结果</h4>
  12. <van-cell-group>
  13. <van-cell title="考生姓名" :value="state.form.fullName"></van-cell>
  14. <van-cell title="考试时间" :value="state.form.entryTime"></van-cell>
  15. <van-cell title="试卷总分" :value="state.form.epTotalScore"></van-cell>
  16. <van-cell title="得分" :value="state.form.exScore"></van-cell>
  17. <van-cell title="结果" :value="state.form.exScore >= state.form.passingScore ? '及格' : '不及格'"></van-cell>
  18. <van-cell title="用时" :value="`${useMin}分钟`"></van-cell>
  19. </van-cell-group>
  20. </div>
  21. </template>
  22. <script lang="ts" setup>
  23. import to from 'await-to-js'
  24. import { computed, onMounted, reactive } from 'vue'
  25. import { useRouter, useRoute } from 'vue-router'
  26. import { useTrainingApi } from '/@/api/training'
  27. import { formatDate } from '/@/utils/formatTime'
  28. import { useUserInfo } from '/@/stores/userInfo'
  29. import { showNotify } from 'vant'
  30. const props = defineProps({
  31. isAll: {
  32. type: String,
  33. default: '10'
  34. }
  35. })
  36. const trainingApi = useTrainingApi()
  37. const route = useRoute()
  38. const router = useRouter()
  39. const state = reactive({
  40. answerId: 0,
  41. queryParams: {
  42. pageNum: 1,
  43. pageSize: 10,
  44. isAll: false
  45. },
  46. form: {
  47. fullName: '',
  48. entryTime: '',
  49. epTotalScore: 0,
  50. exScore: 0,
  51. passingScore: 0,
  52. handTime: ''
  53. },
  54. loading: false,
  55. finished: false
  56. })
  57. const useMin = computed(() => {
  58. let startDate = new Date(state.form.entryTime).getTime()
  59. let endDate = new Date(state.form.handTime).getTime()
  60. let min = Math.floor(((endDate - startDate) / 1000 / 60) << 0)
  61. return min
  62. })
  63. const initData = async () => {
  64. const [err, res]: ToResponse = await to(trainingApi.getAnswerInfo({ answerId: state.answerId }))
  65. if (err) return
  66. if (res?.data) {
  67. state.form = res.data
  68. }
  69. }
  70. const dateRemoveSec = (date: any) => {
  71. if (date && typeof date == 'string') {
  72. let dateArr = []
  73. dateArr = date.split(':')
  74. return dateArr[0] + ':' + dateArr[1]
  75. } else {
  76. return '/'
  77. }
  78. }
  79. onMounted(() => {
  80. const id = route.query.id ? Number(route.query.id) : 0
  81. state.answerId = id
  82. initData()
  83. })
  84. </script>
  85. <style lang="scss" scoped>
  86. .app-container {
  87. .van-cell {
  88. background-color: #fff;
  89. margin-top: 10px;
  90. header {
  91. color: #333;
  92. font-size: 16px;
  93. }
  94. footer {
  95. color: #969799;
  96. margin-top: 4px;
  97. white-space: nowrap;
  98. overflow: hidden;
  99. text-overflow: ellipsis;
  100. text-align: right;
  101. }
  102. .title {
  103. font-weight: bold;
  104. }
  105. .inst-title {
  106. color: #333;
  107. text-align: left;
  108. flex: 1;
  109. overflow: hidden;
  110. white-space: nowrap;
  111. text-overflow: ellipsis;
  112. margin-top: 4px;
  113. }
  114. .time {
  115. color: #f69a4d;
  116. }
  117. }
  118. h4 {
  119. height: 18px;
  120. line-height: 18px;
  121. display: flex;
  122. margin: 10px 0;
  123. span {
  124. font-weight: normal;
  125. margin-left: auto;
  126. }
  127. &::before {
  128. display: inline-block;
  129. content: '';
  130. width: 3px;
  131. height: 18px;
  132. background-color: #1c9bfd;
  133. margin-right: 4px;
  134. vertical-align: middle;
  135. }
  136. }
  137. }
  138. </style>