list.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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="phone-scroll-view 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. <view class="item-kaoshi-row">
  23. <!-- 数量 -->
  24. <view class="ks-item-top">
  25. <view>{{item.name}}</view>
  26. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  27. </view>
  28. <view class="ks-totalTm">
  29. <icon class="phone-time-icon" /> {{item.answerStartTime}} - {{item.answerEndTime}}
  30. </view>
  31. <view class="ks-totalTm">
  32. <icon class="phone-time-icon" /> {{item.okScore}} / {{item.ksScore}}
  33. </view>
  34. <button @click="checkKecheng(item)" type="primary" size="mini"
  35. class="kaoshi-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. </view>
  44. <!-- 页面底端 -->
  45. <customTabbarAdminVue></customTabbarAdminVue>
  46. </view>
  47. </template>
  48. <script setup>
  49. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  50. import {
  51. ref,
  52. reactive
  53. } from "vue";
  54. import {
  55. onLoad
  56. } from "@dcloudio/uni-app";
  57. import * as kaoshiApi from "@/api/kaoshi.js"
  58. import {
  59. formatDuration
  60. } from "@/utils/common.js"
  61. const data = reactive({
  62. zyName: '', // 职业名称
  63. list: [], // 考试列表
  64. loading: false,
  65. page: 0,
  66. size: 10,
  67. state: 'more',
  68. contentText: {
  69. contentdown: '查看更多',
  70. contentrefresh: '加载中',
  71. contentnomore: '没有更多'
  72. }
  73. })
  74. function goUpPage() {
  75. uni.redirectTo({
  76. url: '/pages/client/ShouYe/shouye'
  77. })
  78. }
  79. function handleSearch() {
  80. data.page = 0;
  81. refreshData();
  82. }
  83. function checkKecheng(item) {
  84. uni.navigateTo({
  85. url: `/pages/client/Chengji/ksScoreShijuan?hisId=${item.hisId}`
  86. })
  87. }
  88. function onRefresh() {
  89. data.page = 0;
  90. data.list = [];
  91. data.loading = true;
  92. refreshData();
  93. }
  94. function refreshData() {
  95. const opt = {
  96. page: 1,
  97. size: 10, // 固定查询10条
  98. zyName: data.zyName
  99. }
  100. data.list = [];
  101. // 数学
  102. data.state = 'loading';
  103. data.page++;
  104. opt.page = data.page;
  105. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  106. data.list = data.list.concat(res.data.data);
  107. data.loading = false;
  108. if (res.data.total > data.list.length) {
  109. data.state = 'more';
  110. data.loading = false;
  111. } else {
  112. data.state = 'no-more';
  113. data.loading = false;
  114. }
  115. }).catch(err => {
  116. data.state = 'more';
  117. data.loading = false;
  118. })
  119. }
  120. function getMore() {
  121. const opt = {
  122. page: 1,
  123. size: 10, // 固定查询10条
  124. zyName: data.zyName
  125. }
  126. if (data.state == 'no-more') return;
  127. data.state = 'loading';
  128. data.page++;
  129. opt.page = data.page;
  130. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  131. data.list = data.list.concat(res.data.data);
  132. data.loading = false;
  133. if (res.data.total > data.list.length) {
  134. data.state = 'more';
  135. data.loading = false;
  136. } else {
  137. data.state = 'no-more';
  138. data.loading = false;
  139. }
  140. }).catch(err => {
  141. data.state = 'more';
  142. data.loading = false;
  143. })
  144. }
  145. onLoad(() => {
  146. getMore()
  147. })
  148. </script>
  149. <style lang="scss" scoped>
  150. .phone-kecheng-page {
  151. background-color: #ccc;
  152. box-sizing: border-box;
  153. }
  154. .phone-search-content {
  155. position: relative;
  156. background-color: #fff;
  157. height: 42px;
  158. .search-input {
  159. height: 42px;
  160. line-height: 40px;
  161. border-radius: 20px;
  162. border: 1px solid #ccc;
  163. padding: 0 70px 0 20px;
  164. }
  165. .search-icon {
  166. position: absolute;
  167. right: 5px;
  168. top: 4px;
  169. padding: 6px;
  170. background-color: #ccc;
  171. border-radius: 20px;
  172. width: 50px;
  173. text-align: center;
  174. }
  175. }
  176. </style>