list.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="phone-list-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. <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.lxName}}</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
  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. if ( data.from == 'shouye') {
  83. uni.redirectTo({
  84. url: '/pages/client/ShouYe/shouye'
  85. })
  86. } else if (data.from == 'my') {
  87. uni.redirectTo({
  88. url: '/pages/client/my/index'
  89. })
  90. } else {
  91. uni.redirectTo({
  92. url: '/pages/client/ShouYe/shouye'
  93. })
  94. }
  95. }
  96. function handleSearch() {
  97. data.page = 0;
  98. refreshData();
  99. }
  100. function checkKaoshi(item) {
  101. uni.redirectTo({
  102. url: `/pages/client/Lianxi/exam?lxId=${item.lxId}&from=lianxiList`
  103. })
  104. }
  105. function onRefresh() {
  106. data.page = 0;
  107. data.list = [];
  108. data.loading = true;
  109. refreshData();
  110. }
  111. function refreshData() {
  112. const opt = {
  113. page: 1,
  114. size: data.size, // 固定查询10条
  115. zyName: data.zyName
  116. }
  117. data.list = [];
  118. // 数学
  119. data.state = 'loading';
  120. data.page++;
  121. opt.page = data.page;
  122. lianxiApi.getClientLianxiList(opt).then(res => {
  123. data.list = data.list.concat(res.data.data);
  124. data.loading = false;
  125. if (res.data.total > data.list.length) {
  126. data.state = 'more';
  127. data.loading = false;
  128. } else {
  129. data.state = 'no-more';
  130. data.loading = false;
  131. }
  132. }).catch(err => {
  133. data.state = 'more';
  134. data.loading = false;
  135. })
  136. }
  137. function getMore() {
  138. const opt = {
  139. page: 1,
  140. size: data.size, // 固定查询10条
  141. zyName: data.zyName
  142. }
  143. if (data.state == 'no-more') return;
  144. data.state = 'loading';
  145. data.page++;
  146. opt.page = data.page;
  147. lianxiApi.getClientLianxiList(opt).then(res => {
  148. data.list = data.list.concat(res.data.data);
  149. data.loading = false;
  150. if (res.data.total > data.list.length) {
  151. data.state = 'more';
  152. data.loading = false;
  153. } else {
  154. data.state = 'no-more';
  155. data.loading = false;
  156. }
  157. }).catch(err => {
  158. data.state = 'more';
  159. data.loading = false;
  160. })
  161. }
  162. onLoad((options) => {
  163. data.from = options.from;
  164. getMore()
  165. })
  166. </script>
  167. <style>
  168. </style>