list.vue 4.6 KB

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