index.vue 2.0 KB

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