list.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="admin-kaoshi-page">
  3. <view class="icon-title-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="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.lxName}}</view>
  20. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  21. </view>
  22. <!-- 时间 -->
  23. <view class="ks-totalTm">
  24. <icon class="phone-time-icon" />时间:{{item.totalTm}}分钟
  25. </view>
  26. <!-- 分数 -->
  27. <view class="ks-score-content">
  28. <view class="ks-score">
  29. <icon class="phone-zongfen-icon" />总分:<text>{{item.ksScore}}</text>
  30. </view>
  31. <view class="ks-okScore">
  32. <icon class="phone-jigefen-icon" />及格分:<text>{{item.okScore}}</text>
  33. </view>
  34. </view>
  35. <button type="primary" size="mini" @click="checkKsXz(item)"
  36. class="kaoshi-btn">查看内容</button>
  37. </view>
  38. </template>
  39. </uni-list-item>
  40. <uni-load-more :status="data.state" @click="getMore(0)"
  41. :contentText="data.contentText"></uni-load-more>
  42. </uni-list>
  43. </scroll-view>
  44. </view>
  45. <!-- 页面底端 -->
  46. <customTabbarClientVue></customTabbarClientVue>
  47. <!-- 考试须知 -->
  48. <lianxixuzhi ref="lxxzRef" @confirm="handleConfirmKs"></lianxixuzhi>
  49. </view>
  50. </template>
  51. <script setup>
  52. import * as lianxiApi from "@/api/lianxi.js";
  53. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  54. import lianxixuzhi from "@/components/kaoshixuzhi/lianxixuzhi.vue";
  55. import {
  56. ref,
  57. reactive
  58. } from "vue";
  59. import {
  60. onLoad
  61. } from "@dcloudio/uni-app";
  62. const lxxzRef = ref(null);
  63. const data = reactive({
  64. zyName: '', // 职业名称
  65. list: [], // 考试列表
  66. loading: false,
  67. page: 0,
  68. size: 8,
  69. state: 'more',
  70. contentText: {
  71. contentdown: '查看更多',
  72. contentrefresh: '加载中',
  73. contentnomore: '没有更多'
  74. }
  75. })
  76. function checkKsXz(data) {
  77. lxxzRef.value.showDialog(data)
  78. }
  79. function handleConfirmKs(data) {
  80. checkKaoshi(data)
  81. }
  82. function goUpPage() {
  83. uni.redirectTo({
  84. url: '/pages/client/ShouYe/shouye'
  85. })
  86. }
  87. function handleSearch() {
  88. data.page = 0;
  89. refreshData();
  90. }
  91. function checkKaoshi(item) {
  92. uni.redirectTo({
  93. url: `/pages/client/Lianxi/exam?lxId=${item.lxId}`
  94. })
  95. }
  96. function onRefresh() {
  97. data.page = 0;
  98. data.list = [];
  99. data.loading = true;
  100. refreshData();
  101. }
  102. function refreshData() {
  103. const opt = {
  104. page: 1,
  105. size: data.size, // 固定查询10条
  106. zyName: data.zyName
  107. }
  108. data.list = [];
  109. // 数学
  110. data.state = 'loading';
  111. data.page++;
  112. opt.page = data.page;
  113. lianxiApi.getClientLianxiList(opt).then(res => {
  114. data.list = data.list.concat(res.data.data);
  115. data.loading = false;
  116. if (res.data.total > data.list.length) {
  117. data.state = 'more';
  118. data.loading = false;
  119. } else {
  120. data.state = 'no-more';
  121. data.loading = false;
  122. }
  123. }).catch(err => {
  124. data.state = 'more';
  125. data.loading = false;
  126. })
  127. }
  128. function getMore() {
  129. const opt = {
  130. page: 1,
  131. size: data.size, // 固定查询10条
  132. zyName: data.zyName
  133. }
  134. if (data.state == 'no-more') return;
  135. data.state = 'loading';
  136. data.page++;
  137. opt.page = data.page;
  138. lianxiApi.getClientLianxiList(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>
  157. <style>
  158. </style>