list.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. from: ''
  73. })
  74. function goUpPage() {
  75. if (data.from == 'my') {
  76. uni.redirectTo({
  77. url: '/pages/client/my/index'
  78. })
  79. } else if (data.from == 'kaoshi') {
  80. uni.redirectTo({
  81. url: '/pages/client/Kaoshi/list'
  82. })
  83. }
  84. }
  85. function handleSearch() {
  86. data.page = 0;
  87. refreshData();
  88. }
  89. function checkKecheng(item) {
  90. uni.navigateTo({
  91. url: `/pages/client/Chengji/ksScoreShijuan?hisId=${item.hisId}&from=chengjiList`
  92. })
  93. }
  94. function onRefresh() {
  95. data.page = 0;
  96. data.list = [];
  97. data.loading = true;
  98. refreshData();
  99. }
  100. function refreshData() {
  101. const opt = {
  102. page: 1,
  103. size: 10, // 固定查询10条
  104. zyName: data.zyName
  105. }
  106. data.list = [];
  107. // 数学
  108. data.state = 'loading';
  109. data.page++;
  110. opt.page = data.page;
  111. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  112. data.list = data.list.concat(res.data.data);
  113. data.loading = false;
  114. if (res.data.total > data.list.length) {
  115. data.state = 'more';
  116. data.loading = false;
  117. } else {
  118. data.state = 'no-more';
  119. data.loading = false;
  120. }
  121. }).catch(err => {
  122. data.state = 'more';
  123. data.loading = false;
  124. })
  125. }
  126. function getMore() {
  127. const opt = {
  128. page: 1,
  129. size: 10, // 固定查询10条
  130. zyName: data.zyName
  131. }
  132. if (data.state == 'no-more') return;
  133. data.state = 'loading';
  134. data.page++;
  135. opt.page = data.page;
  136. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  137. data.list = data.list.concat(res.data.data);
  138. data.loading = false;
  139. if (res.data.total > data.list.length) {
  140. data.state = 'more';
  141. data.loading = false;
  142. } else {
  143. data.state = 'no-more';
  144. data.loading = false;
  145. }
  146. }).catch(err => {
  147. data.state = 'more';
  148. data.loading = false;
  149. })
  150. }
  151. onLoad(() => {
  152. getMore()
  153. })
  154. </script>
  155. <style lang="scss" scoped>
  156. .phone-kecheng-page {
  157. background-color: #ccc;
  158. box-sizing: border-box;
  159. }
  160. .phone-search-content {
  161. position: relative;
  162. background-color: #fff;
  163. height: 42px;
  164. .search-input {
  165. height: 42px;
  166. line-height: 40px;
  167. border-radius: 20px;
  168. border: 1px solid #ccc;
  169. padding: 0 70px 0 20px;
  170. }
  171. .search-icon {
  172. position: absolute;
  173. right: 5px;
  174. top: 4px;
  175. padding: 6px;
  176. background-color: #ccc;
  177. border-radius: 20px;
  178. width: 50px;
  179. text-align: center;
  180. }
  181. }
  182. </style>