kaoshiCard.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="shouye-card-box kaoshi-card-box">
  3. <!-- card title -->
  4. <view class="card-head-box">
  5. <view class="card-line-title">考试</view>
  6. <view class="card-more" @click="checkMore">更多<text class="more-num">{{data.count}}</text><icon class="more-jt"></icon></view>
  7. </view>
  8. <!-- kaoshi title -->
  9. <view class="card-name-box">
  10. <view class="card-name" v-if="data.ksName"><icon></icon>{{data.ksName}}</view>
  11. <text class="card-level">{{data.zyLevelName}}</text>
  12. <!-- <view class="card-name"><icon></icon>考试名称</view>
  13. <text class="card-level">初级</text> -->
  14. </view>
  15. <!-- 内容区域 -->
  16. <view class="card-content-box kaoshi-content-box">
  17. <view class="card-content-item">
  18. <icon class="card-time-icon"></icon>
  19. <view class="content-text-box">
  20. <text>时间</text>
  21. <view>{{data.totalTm}}分钟</view>
  22. </view>
  23. </view>
  24. <view class="card-content-item">
  25. <icon class="card-num-icon"></icon>
  26. <view class="content-text-box">
  27. <text>次数</text>
  28. <view>{{data.joinCount}}次</view>
  29. </view>
  30. </view>
  31. <view class="card-content-item">
  32. <icon class="card-sum-icon"></icon>
  33. <view class="content-text-box">
  34. <text>总分</text>
  35. <view>{{data.ksScore}}分</view>
  36. </view>
  37. </view>
  38. <view class="card-content-item">
  39. <icon class="card-pass-icon"></icon>
  40. <view class="content-text-box">
  41. <text>及格分</text>
  42. <view>{{data.okScore}}分</view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 底部 -->
  47. <view class="card-bottom-box">
  48. <button type="default" class="index-card-btn" v-if="data.status == 1" @click="handleStart(data)">进行考试</button>
  49. <button type="default" class="index-card-btn" v-if="data.status == 2" @click="handleStart(data)">进行考试</button>
  50. <button type="default" class="index-card-btn" v-if="data.status == 3" @click="handleContinue(data)">考试中</button>
  51. </view>
  52. <!-- 考试须知 -->
  53. <kaoshixuzhiVue ref="ksxzRef" @confirm="handleConfirmKs" key="1"></kaoshixuzhiVue>
  54. <!-- 身份确认 -->
  55. <identificationVue ref="shenfenRef" @confirm="handleConfirmIdent" @changeData="handleChangeIdentification" key="2"></identificationVue>
  56. </view>
  57. </template>
  58. <script setup>
  59. import kaoshixuzhiVue from "@/components/kaoshixuzhi/kaoshixuzhi.vue";
  60. import identificationVue from "@/components/identification/identification.vue";
  61. import {useIdentificationTools} from "@/pages/client/Kaoshi/examTools.js"
  62. import * as kaoshiApi from "@/api/kaoshi.js"
  63. import { ref } from "vue"
  64. const { saveIdentCache, getIdentCache, removeIdentCache } = useIdentificationTools();
  65. defineProps({
  66. data: {
  67. type: Object,
  68. }
  69. })
  70. const ksxzRef = ref(null)
  71. const shenfenRef = ref(null)
  72. const activeks = ref(null);
  73. function checkMore() {
  74. uni.redirectTo({
  75. url: '/pages/client/Kaoshi/list'
  76. })
  77. }
  78. // 修改身份
  79. function handleChangeIdentification() {
  80. uni.redirectTo({
  81. url:'/pages/client/my/info?from=shouye'
  82. })
  83. }
  84. function handleConfirmIdent(data) {
  85. saveIdentCache(activeks.value.ksId, true);
  86. ksxzRef.value.showDialog(activeks.value)
  87. }
  88. function handleStart(data) {
  89. activeks.value = data;
  90. const result = getIdentCache(data.ksId);
  91. if (result) {
  92. ksxzRef.value.showDialog(data)
  93. } else {
  94. kaoshiApi.getClientUserInfo({ksId: data.ksId}).then(res => {
  95. shenfenRef.value.showDialog(res.data);
  96. })
  97. }
  98. }
  99. function handleConfirmKs(data) {
  100. checkKaoshi(data)
  101. }
  102. function checkKaoshi(item) {
  103. uni.navigateTo({
  104. url: `/pages/client/Kaoshi/exam?ksId=${item.ksId}&zhuapai=${activeks.value.zhuapai}`
  105. })
  106. }
  107. function handleContinue(data) {
  108. // 考试中 直接进入考试
  109. checkKaoshi(data)
  110. }
  111. </script>
  112. <style>
  113. </style>