list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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)" :contentText="data.contentText"></uni-load-more>
  40. </uni-list>
  41. </scroll-view>
  42. <!-- 页面底端 -->
  43. <customTabbarClientVue></customTabbarClientVue>
  44. <!-- 考试须知 -->
  45. <lianxixuzhi ref="lxxzRef" @confirm="handleConfirmKs"></lianxixuzhi>
  46. </view>
  47. </template>
  48. <script setup>
  49. import * as lianxiApi from "@/api/lianxi.js";
  50. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  51. import lianxixuzhi from "@/components/kaoshixuzhi/lianxixuzhi.vue";
  52. import {
  53. ref,
  54. reactive
  55. } from "vue";
  56. import {
  57. onLoad,
  58. 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. const pages = getCurrentPages();
  83. if (pages.length > 1) {
  84. uni.navigateBack()
  85. } else {
  86. /* uni.redirectTo({
  87. url: '/pages/client/ShouYe/shouye'
  88. }) */
  89. history.back();
  90. }
  91. }
  92. function handleSearch() {
  93. data.page = 0;
  94. refreshData();
  95. }
  96. function checkKaoshi(item) {
  97. uni.navigateTo({
  98. url: `/pages/client/Lianxi/exam?lxId=${item.lxId}&from=lianxiList`
  99. })
  100. }
  101. function onRefresh() {
  102. data.page = 0;
  103. data.list = [];
  104. data.loading = true;
  105. refreshData();
  106. }
  107. function refreshData() {
  108. const opt = {
  109. page: 1,
  110. size: data.size, // 固定查询10条
  111. zyName: data.zyName
  112. }
  113. data.list = [];
  114. // 数学
  115. data.state = 'loading';
  116. data.page++;
  117. opt.page = data.page;
  118. lianxiApi.getClientLianxiList(opt).then(res => {
  119. data.list = data.list.concat(res.data.data);
  120. data.loading = false;
  121. if (res.data.total > data.list.length) {
  122. data.state = 'more';
  123. data.loading = false;
  124. } else {
  125. data.state = 'no-more';
  126. data.loading = false;
  127. }
  128. }).catch(err => {
  129. data.state = 'more';
  130. data.loading = false;
  131. })
  132. }
  133. function getMore() {
  134. const opt = {
  135. page: 1,
  136. size: data.size, // 固定查询10条
  137. zyName: data.zyName
  138. }
  139. if (data.state == 'no-more') return;
  140. data.state = 'loading';
  141. data.page++;
  142. opt.page = data.page;
  143. lianxiApi.getClientLianxiList(opt).then(res => {
  144. data.list = data.list.concat(res.data.data);
  145. data.loading = false;
  146. if (res.data.total > data.list.length) {
  147. data.state = 'more';
  148. data.loading = false;
  149. } else {
  150. data.state = 'no-more';
  151. data.loading = false;
  152. }
  153. }).catch(err => {
  154. data.state = 'more';
  155. data.loading = false;
  156. })
  157. }
  158. onLoad((options) => {
  159. data.from = options.from;
  160. })
  161. onShow(() => {
  162. getMore()
  163. })
  164. </script>
  165. <style>
  166. </style>