list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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"></kaoshixuzhiVue>
  43. <!-- 身份确认 -->
  44. <!-- <identificationVue ref="shenfenRef"></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 {
  52. ref,
  53. reactive
  54. } from "vue";
  55. import {
  56. onLoad
  57. } from "@dcloudio/uni-app";
  58. import * as kaoshiApi from "@/api/kaoshi.js";
  59. const ksxzRef = ref(null);
  60. const shenfenRef = ref(null)
  61. const data = reactive({
  62. zyName: '', // 职业名称
  63. list: [], // 考试列表
  64. loading: false,
  65. page: 0,
  66. size: 8,
  67. state: 'more',
  68. contentText: {
  69. contentdown: '查看更多',
  70. contentrefresh: '加载中',
  71. contentnomore: '没有更多'
  72. }
  73. })
  74. function goUpPage() {
  75. uni.redirectTo({
  76. url: '/pages/admin/ShouYe/shouye'
  77. })
  78. }
  79. function handleConfirmKs(data) {
  80. console.log('ddd',data)
  81. checkKaoshi(data)
  82. }
  83. function checkKsXz(data) {
  84. ksxzRef.value.showDialog(data)
  85. }
  86. function handleSearch() {
  87. data.page = 0;
  88. refreshData();
  89. }
  90. function checkKaoshi(item) {
  91. uni.navigateTo({
  92. url: `/pages/client/Kaoshi/exam?ksId=${item.ksId}`
  93. })
  94. }
  95. function onRefresh() {
  96. data.page = 0;
  97. data.list = [];
  98. data.loading = true;
  99. refreshData();
  100. }
  101. function refreshData() {
  102. const opt = {
  103. page: 1,
  104. size: data.size, // 固定查询10条
  105. zyName: data.zyName
  106. }
  107. data.list = [];
  108. // 数学
  109. data.state = 'loading';
  110. data.page++;
  111. opt.page = data.page;
  112. kaoshiApi.getClientKaoshiList(opt).then(res => {
  113. data.list = data.list.concat(res.data.data);
  114. data.loading = false;
  115. if (res.data.total > data.list.length) {
  116. data.state = 'more';
  117. data.loading = false;
  118. } else {
  119. data.state = 'no-more';
  120. data.loading = false;
  121. }
  122. }).catch(err => {
  123. data.state = 'more';
  124. data.loading = false;
  125. })
  126. }
  127. function getMore() {
  128. const opt = {
  129. page: 1,
  130. size: data.size, // 固定查询10条
  131. zyName: data.zyName
  132. }
  133. if (data.state == 'no-more') return;
  134. data.state = 'loading';
  135. data.page++;
  136. opt.page = data.page;
  137. // kaoshiApi.getClientKaoshiList(opt).then(res => {
  138. kaoshiApi.getKaoshiList(opt).then(res => {
  139. data.list = data.list.concat(res.data.data);
  140. data.loading = false;
  141. if (res.data.total > data.list.length) {
  142. data.state = 'more';
  143. data.loading = false;
  144. } else {
  145. data.state = 'no-more';
  146. data.loading = false;
  147. }
  148. }).catch(err => {
  149. data.state = 'more';
  150. data.loading = false;
  151. })
  152. }
  153. onLoad(() => {
  154. getMore()
  155. })
  156. </script>