list.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="phone-list-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. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  9. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
  10. class="phone-scroll-view">
  11. <uni-list class="admin-list-box">
  12. <uni-list-item v-for="item in data.list" class="admin-list-item-box">
  13. <template v-slot:body>
  14. <!-- 考试项 -->
  15. <view class="item-card-row">
  16. <!-- 考试名 + 等级 -->
  17. <view class="ks-item-top">
  18. <view class="ks-name">{{item.zyName}}</view>
  19. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  20. </view>
  21. <!-- 时间 -->
  22. <!-- <view class="ks-totalTm">
  23. <icon class="phone-time-icon" />时间:{{item.totalTm}}分钟
  24. </view> -->
  25. <!-- 分数 -->
  26. <view class="ks-score-content">
  27. <view class="ks-score">
  28. <icon class="phone-zongfen-icon" />总分:<text>{{item.ksScore}}</text>
  29. </view>
  30. <view class="ks-okScore">
  31. <icon class="phone-jigefen-icon" />及格分:<text>{{item.okScore}}</text>
  32. </view>
  33. </view>
  34. <button type="primary" size="mini" @click="checkKsXz(item)"
  35. class="item-view-btn">查看内容</button>
  36. </view>
  37. </template>
  38. </uni-list-item>
  39. <uni-load-more :status="data.state" @click="getMore(0)"
  40. :contentText="data.contentText"></uni-load-more>
  41. </uni-list>
  42. </scroll-view>
  43. <!-- 页面底端 -->
  44. <customTabbarClientVue></customTabbarClientVue>
  45. <!-- 考试须知 -->
  46. <lianxixuzhi ref="lxxzRef" @confirm="handleConfirmKs"></lianxixuzhi>
  47. </view>
  48. </template>
  49. <script setup>
  50. import * as lianxiApi from "@/api/lianxi.js";
  51. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  52. import lianxixuzhi from "@/components/kaoshixuzhi/lianxixuzhi.vue";
  53. import {
  54. ref,
  55. reactive
  56. } from "vue";
  57. import {
  58. onLoad, onShow
  59. } from "@dcloudio/uni-app";
  60. const lxxzRef = 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. from: ''
  74. })
  75. function checkKsXz(data) {
  76. lxxzRef.value.showDialog(data)
  77. }
  78. function handleConfirmKs(data) {
  79. checkKaoshi(data)
  80. }
  81. function goUpPage() {
  82. uni.redirectTo({
  83. url: '/pages/client/ShouYe/shouye'
  84. })
  85. }
  86. function handleSearch() {
  87. data.page = 0;
  88. refreshData();
  89. }
  90. function checkKaoshi(item) {
  91. uni.navigateTo({
  92. url: `/pages/client/Lianxi/exam?lxId=${item.lxId}&from=lianxiList`
  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. lianxiApi.getClientLianxiList(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. lianxiApi.getClientLianxiList(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. onLoad((options) => {
  153. data.from = options.from;
  154. })
  155. onShow(() => {
  156. getMore()
  157. })
  158. </script>
  159. <style>
  160. </style>