index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <customNavbarVue title=""></customNavbarVue>
  3. <custom-scroll-list :refreshFn="getExamList" :tabList="tabData" :defaultTab="1" ref="scrollRef">
  4. <template #default="{list}">
  5. <scroll-list-card v-for="(item,index) in list" :key="item.ksId" :data="item"
  6. @btnClick="handleClick"></scroll-list-card>
  7. </template>
  8. </custom-scroll-list>
  9. <!-- 考试须知 -->
  10. <kaoshixuzhi ref="ksxzRef" @confirm="handleConfirm"></kaoshixuzhi>
  11. </template>
  12. <script setup>
  13. import {
  14. getExamList,
  15. kaoShiApply,
  16. getClientKaoshiInfo
  17. } from "@/api/exam.js";
  18. import {
  19. onReady,
  20. } from "@dcloudio/uni-app"
  21. import {
  22. reactive,
  23. ref
  24. } from "vue";
  25. import kaoshixuzhi from "@/components/kaoshixuzhi/kaoshixuzhi.vue"
  26. import customNavbarVue from "@/components/custom-navbar/custom-navbar.vue";
  27. const activeKs = ref(null);
  28. const scrollRef = ref(null);
  29. const examNoticeInfo = ref(null);
  30. const ksxzRef = ref(null);
  31. const tabData = [{
  32. label: "可以考试",
  33. value: 1,
  34. },
  35. {
  36. label: "已结束",
  37. value: 4,
  38. }
  39. ]
  40. function goKaoshiPage(data) {
  41. /* uni.redirectTo({
  42. url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
  43. }) */
  44. uni.navigateTo({
  45. url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
  46. })
  47. }
  48. function handleConfirm() {
  49. goKaoshiPage(activeKs.value)
  50. }
  51. function showKaoshiXuzhi() {
  52. const option = {
  53. ksId: activeKs.value.ksId
  54. }
  55. getClientKaoshiInfo(option).then(res => {
  56. examNoticeInfo.value = res.data;
  57. // 校验抓拍
  58. doCheckZhuapai()
  59. })
  60. }
  61. function doCheckZhuapai() {
  62. if (examNoticeInfo.value.zhuapai) {
  63. // 存在抓拍
  64. } else {
  65. // 不存在抓拍
  66. ksxzRef.value.showDialog(examNoticeInfo.value)
  67. }
  68. }
  69. function handleClick(data) {
  70. activeKs.value = data;
  71. if (data.status == 0) {
  72. // 未开始
  73. // goKaoshiPage(data);
  74. showKaoshiXuzhi()
  75. }
  76. if (data.status == 1) {
  77. // 可以考试
  78. // goKaoshiPage(data);
  79. showKaoshiXuzhi()
  80. }
  81. if (data.status == 2) {
  82. // 再次考试
  83. // goKaoshiPage(data);
  84. showKaoshiXuzhi()
  85. }
  86. if (data.status == 3) {
  87. // 考试中
  88. // goKaoshiPage(data);
  89. showKaoshiXuzhi()
  90. }
  91. if (data.status == 4) {
  92. // 已结束
  93. uni.showToast({
  94. title: '考试已结束',
  95. icon: 'none'
  96. })
  97. }
  98. if (data.status == 5) {
  99. // 未报名
  100. kaoShiApply({
  101. ksId: data.ksId
  102. }).then(res => {
  103. uni.showToast({
  104. title: '报名成功',
  105. icon: 'none'
  106. })
  107. scrollRef.value.onRefresh()
  108. })
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. </style>