list.vue 4.3 KB

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