list.vue 4.4 KB

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