list.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="client-kaoshi-page">
  3. <view class="icon-title-bjcolor-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">考试管理</text>
  6. </view>
  7. <!-- 考试列表 -->
  8. <view class="kaoshi-content-box">
  9. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  10. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
  11. class="phone-scroll-view kaoshi-scroll-view">
  12. <uni-list class="admin-list-box">
  13. <uni-list-item v-for="item in data.list" class="admin-list-item-box">
  14. <template v-slot:body>
  15. <!-- 考试项 -->
  16. <view class="item-kaoshi-row">
  17. <!-- 考试名 + 等级 -->
  18. <view class="ks-item-top">
  19. <view class="ks-name">{{item.ksName}}</view>
  20. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  21. </view>
  22. <!-- 时间 -->
  23. <view class="ks-totalTm"><icon class="phone-time-icon"/>时间:{{item.totalTm}}分钟</view>
  24. <view class="ks-totalTm"><icon class="phone-cishu-icon"/>次数:{{item.maxTimes}}次</view>
  25. <!-- 分数 -->
  26. <view class="ks-score-content">
  27. <view class="ks-score"><icon class="phone-zongfen-icon"/>总分:<text>{{item.ksScore}}</text></view>
  28. <view class="ks-okScore"><icon class="phone-jigefen-icon"/>及格分:<text>{{item.okScore}}</text></view>
  29. </view>
  30. <button type="primary" size="mini" @click="checkKsXz(item)" class="kaoshi-btn">查看内容</button>
  31. </view>
  32. </template>
  33. </uni-list-item>
  34. <uni-load-more :status="data.state" @click="getMore(0)"
  35. :contentText="data.contentText"></uni-load-more>
  36. </uni-list>
  37. </scroll-view>
  38. </view>
  39. <!-- 页面底端 -->
  40. <customTabbarClientVue></customTabbarClientVue>
  41. <!-- 考试须知 -->
  42. <kaoshixuzhiVue ref="ksxzRef" @confirm="handleConfirmKs" key="1"></kaoshixuzhiVue>
  43. <!-- 身份确认 -->
  44. <identificationVue ref="shenfenRef" @confirm="handleConfirmIdent" @changeData="handleChangeIdentification" key="2"></identificationVue>
  45. </view>
  46. </template>
  47. <script setup>
  48. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  49. import kaoshixuzhiVue from "@/components/kaoshixuzhi/kaoshixuzhi.vue";
  50. import identificationVue from "@/components/identification/identification.vue";
  51. import {useIdentificationTools} from "./examTools.js"
  52. import {
  53. ref,
  54. reactive
  55. } from "vue";
  56. import {
  57. onLoad
  58. } from "@dcloudio/uni-app";
  59. import * as kaoshiApi from "@/api/kaoshi.js";
  60. const { saveIdentCache, getIdentCache, removeIdentCache } = useIdentificationTools();
  61. const ksxzRef = ref(null);
  62. const shenfenRef = ref(null);
  63. const activeks = ref(null);
  64. const data = reactive({
  65. zyName: '', // 职业名称
  66. list: [], // 考试列表
  67. loading: false,
  68. page: 0,
  69. size: 8,
  70. state: 'more',
  71. contentText: {
  72. contentdown: '查看更多',
  73. contentrefresh: '加载中',
  74. contentnomore: '没有更多'
  75. }
  76. })
  77. function goUpPage() {
  78. uni.redirectTo({
  79. url: '/pages/client/ShouYe/shouye'
  80. })
  81. }
  82. // 修改身份
  83. function handleChangeIdentification() {
  84. uni.redirectTo({
  85. url:'/pages/client/my/info'
  86. })
  87. }
  88. function handleConfirmIdent(data) {
  89. saveIdentCache(activeks.value.ksId, true);
  90. ksxzRef.value.showDialog(activeks.value)
  91. }
  92. function handleConfirmKs(data) {
  93. checkKaoshi(data)
  94. }
  95. function checkKsXz(data) {
  96. activeks.value = data;
  97. if (data.status == 3) {
  98. // 考试中 直接进入考试
  99. checkKaoshi(data)
  100. return;
  101. }
  102. const result = getIdentCache(data.ksId);
  103. if (result) {
  104. ksxzRef.value.showDialog(data)
  105. } else {
  106. kaoshiApi.getClientUserInfo({ksId: data.ksId}).then(res => {
  107. shenfenRef.value.showDialog(res.data);
  108. })
  109. }
  110. }
  111. function handleSearch() {
  112. data.page = 0;
  113. refreshData();
  114. }
  115. function checkKaoshi(item) {
  116. uni.navigateTo({
  117. url: `/pages/client/Kaoshi/exam?ksId=${item.ksId}&zhuapai=${activeks.value.zhuapai}`
  118. })
  119. }
  120. function onRefresh() {
  121. data.page = 0;
  122. data.list = [];
  123. data.loading = true;
  124. refreshData();
  125. }
  126. function refreshData() {
  127. const opt = {
  128. page: 1,
  129. size: data.size, // 固定查询10条
  130. zyName: data.zyName
  131. }
  132. data.list = [];
  133. // 数学
  134. data.state = 'loading';
  135. data.page++;
  136. opt.page = data.page;
  137. kaoshiApi.getClientKaoshiList(opt).then(res => {
  138. data.list = data.list.concat(res.data.data);
  139. data.loading = false;
  140. if (res.data.total > data.list.length) {
  141. data.state = 'more';
  142. data.loading = false;
  143. } else {
  144. data.state = 'no-more';
  145. data.loading = false;
  146. }
  147. }).catch(err => {
  148. data.state = 'more';
  149. data.loading = false;
  150. })
  151. }
  152. function getMore() {
  153. const opt = {
  154. page: 1,
  155. size: data.size, // 固定查询10条
  156. zyName: data.zyName
  157. }
  158. if (data.state == 'no-more') return;
  159. data.state = 'loading';
  160. data.page++;
  161. opt.page = data.page;
  162. kaoshiApi.getClientKaoshiList(opt).then(res => {
  163. data.list = data.list.concat(res.data.data);
  164. data.loading = false;
  165. if (res.data.total > data.list.length) {
  166. data.state = 'more';
  167. data.loading = false;
  168. } else {
  169. data.state = 'no-more';
  170. data.loading = false;
  171. }
  172. }).catch(err => {
  173. data.state = 'more';
  174. data.loading = false;
  175. })
  176. }
  177. onLoad(() => {
  178. getMore()
  179. })
  180. </script>