index.vue 2.2 KB

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