list.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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="phone-search-box">
  9. <input class="search-input" placeholder="请输入职业名称" v-model="data.zyName" />
  10. <view class="search-icon" @click="handleSearch">
  11. <uni-icons type="search" size="24" color="#fff"></uni-icons>
  12. </view>
  13. </view>
  14. <!-- 考试列表 -->
  15. <view class="kaoshi-content-box">
  16. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  17. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
  18. class="kaoshi-scroll-view">
  19. <uni-list class="admin-list-box">
  20. <uni-list-item v-for="item in data.list" class="admin-list-item-box">
  21. <template v-slot:body>
  22. <!-- 考试项 -->
  23. <view class="item-kaoshi-row">
  24. <!-- 考试名 + 等级 -->
  25. <view class="ks-item-top">
  26. <view class="ks-name">{{item.lxName}}</view>
  27. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  28. </view>
  29. <!-- 时间 -->
  30. <view class="ks-totalTm">
  31. <icon class="phone-time-icon" />时间:{{item.totalTm}}分钟
  32. </view>
  33. <!-- 分数 -->
  34. <view class="ks-score-content">
  35. <view class="ks-score">
  36. <icon class="phone-zongfen-icon" />总分:<text>{{item.ksScore}}</text>
  37. </view>
  38. <view class="ks-okScore">
  39. <icon class="phone-jigefen-icon" />及格分:<text>{{item.okScore}}</text>
  40. </view>
  41. </view>
  42. <button type="primary" size="mini" @click="checkKsXz(item)"
  43. class="kaoshi-btn">查看内容</button>
  44. </view>
  45. </template>
  46. </uni-list-item>
  47. <uni-load-more :status="data.state" @click="getMore(0)"
  48. :contentText="data.contentText"></uni-load-more>
  49. </uni-list>
  50. </scroll-view>
  51. </view>
  52. <!-- 页面底端 -->
  53. <customTabbarAdminVue></customTabbarAdminVue>
  54. <!-- 考试须知 -->
  55. <lianxixuzhi ref="lxxzRef" @confirm="handleConfirmKs"></lianxixuzhi>
  56. </view>
  57. </template>
  58. <script setup>
  59. import * as lianxiApi from "@/api/lianxi.js";
  60. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  61. import lianxixuzhi from "@/components/kaoshixuzhi/lianxixuzhi.vue";
  62. import {
  63. ref,
  64. reactive
  65. } from "vue";
  66. import {
  67. onLoad
  68. } from "@dcloudio/uni-app";
  69. const lxxzRef = ref(null);
  70. const data = reactive({
  71. zyName: '', // 职业名称
  72. list: [], // 考试列表
  73. loading: false,
  74. page: 0,
  75. size: 8,
  76. state: 'more',
  77. contentText: {
  78. contentdown: '查看更多',
  79. contentrefresh: '加载中',
  80. contentnomore: '没有更多'
  81. }
  82. })
  83. function checkKsXz(data) {
  84. lxxzRef.value.showDialog(data)
  85. }
  86. function handleConfirmKs(lxId) {
  87. checkKaoshi({lxId})
  88. }
  89. function goUpPage() {
  90. uni.redirectTo({
  91. url: '/pages/admin/ShouYe/shouye'
  92. })
  93. }
  94. function handleSearch() {
  95. data.page = 0;
  96. refreshData();
  97. }
  98. function checkKaoshi(item) {
  99. uni.redirectTo({
  100. url: `/pages/admin/Lianxi/lianxi?lxId=${item.lxId}`
  101. })
  102. }
  103. function onRefresh() {
  104. data.page = 0;
  105. data.list = [];
  106. data.loading = true;
  107. refreshData();
  108. }
  109. function refreshData() {
  110. const opt = {
  111. page: 1,
  112. size: data.size, // 固定查询10条
  113. zyName: data.zyName
  114. }
  115. data.list = [];
  116. // 数学
  117. data.state = 'loading';
  118. data.page++;
  119. opt.page = data.page;
  120. lianxiApi.getLianxiList(opt).then(res => {
  121. data.list = data.list.concat(res.data.data);
  122. data.loading = false;
  123. if (res.data.total > data.list.length) {
  124. data.state = 'more';
  125. data.loading = false;
  126. } else {
  127. data.state = 'no-more';
  128. data.loading = false;
  129. }
  130. }).catch(err => {
  131. data.state = 'more';
  132. data.loading = false;
  133. })
  134. }
  135. function getMore() {
  136. const opt = {
  137. page: 1,
  138. size: data.size, // 固定查询10条
  139. zyName: data.zyName
  140. }
  141. if (data.state == 'no-more') return;
  142. data.state = 'loading';
  143. data.page++;
  144. opt.page = data.page;
  145. lianxiApi.getLianxiList(opt).then(res => {
  146. data.list = data.list.concat(res.data.data);
  147. data.loading = false;
  148. if (res.data.total > data.list.length) {
  149. data.state = 'more';
  150. data.loading = false;
  151. } else {
  152. data.state = 'no-more';
  153. data.loading = false;
  154. }
  155. })
  156. }
  157. onLoad(() => {
  158. getMore()
  159. })
  160. </script>
  161. <style>
  162. </style>