list.vue 4.6 KB

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