list.vue 4.9 KB

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