list.vue 4.5 KB

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