list.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  9. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
  10. class="phone-scroll-view">
  11. <uni-list class="admin-list-box">
  12. <uni-list-item v-for="item in data.list" class="admin-list-item-box">
  13. <template v-slot:body>
  14. <view class="item-card-row">
  15. <!-- 数量 -->
  16. <view class="ks-item-top">
  17. <view class="ks-name">{{item.ksName}}</view>
  18. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  19. </view>
  20. <!-- 时间 -->
  21. <view class="ks-totalTm"><icon class="phone-time-icon"/>{{item.answerStartTime}} - {{item.answerEndTime}}</view>
  22. <!-- 分数 -->
  23. <view class="ks-score-content">
  24. <view class="ks-score"><icon class="phone-zongfen-icon"/>总分:<text>{{item.ksScore}}</text></view>
  25. <view class="ks-okScore"><icon class="phone-jigefen-icon"/>及格分:<text>{{item.okScore}}</text></view>
  26. <view class="ks-okScore"><icon class="phone-jigefen-icon"/>得分:<text>{{item.userScore}}</text></view>
  27. </view>
  28. <button @click="checkKecheng(item)" type="primary" size="mini"
  29. class="item-view-btn">查看内容</button>
  30. </view>
  31. </template>
  32. </uni-list-item>
  33. <uni-load-more :status="data.state" @click="getMore(0)"
  34. :contentText="data.contentText"></uni-load-more>
  35. </uni-list>
  36. </scroll-view>
  37. <!-- 页面底端 -->
  38. <customTabbarClientVue></customTabbarClientVue>
  39. </view>
  40. </template>
  41. <script setup>
  42. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  43. import {
  44. ref,
  45. reactive
  46. } from "vue";
  47. import {
  48. onLoad
  49. } from "@dcloudio/uni-app";
  50. import * as kaoshiApi from "@/api/kaoshi.js"
  51. import {
  52. formatDuration
  53. } from "@/utils/common.js"
  54. const data = reactive({
  55. list: [], // 考试列表
  56. loading: false,
  57. page: 0,
  58. size: 10,
  59. state: 'more',
  60. contentText: {
  61. contentdown: '查看更多',
  62. contentrefresh: '加载中',
  63. contentnomore: '没有更多'
  64. },
  65. from: ''
  66. })
  67. function goUpPage() {
  68. if (data.from == 'my') {
  69. uni.redirectTo({
  70. url: '/pages/client/my/index'
  71. })
  72. } else if (data.from == 'kaoshi') {
  73. uni.redirectTo({
  74. url: '/pages/client/Kaoshi/list'
  75. })
  76. } else if (data.from == 'shouye'){
  77. uni.redirectTo({
  78. url: '/pages/client/ShouYe/shouye'
  79. })
  80. } else {
  81. uni.redirectTo({
  82. url: '/pages/client/ShouYe/shouye'
  83. })
  84. }
  85. }
  86. function handleSearch() {
  87. data.page = 0;
  88. refreshData();
  89. }
  90. function checkKecheng(item) {
  91. uni.navigateTo({
  92. url: `/pages/client/Chengji/ksScoreShijuan?hisId=${item.hisId}&from=chengjiList`
  93. })
  94. }
  95. function onRefresh() {
  96. data.page = 0;
  97. data.list = [];
  98. data.loading = true;
  99. refreshData();
  100. }
  101. function refreshData() {
  102. const opt = {
  103. page: 1,
  104. size: 10, // 固定查询10条
  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. }
  131. if (data.state == 'no-more') return;
  132. data.state = 'loading';
  133. data.page++;
  134. opt.page = data.page;
  135. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  136. data.list = data.list.concat(res.data.data);
  137. data.loading = false;
  138. if (res.data.total > data.list.length) {
  139. data.state = 'more';
  140. data.loading = false;
  141. } else {
  142. data.state = 'no-more';
  143. data.loading = false;
  144. }
  145. }).catch(err => {
  146. data.state = 'more';
  147. data.loading = false;
  148. })
  149. }
  150. onLoad(() => {
  151. getMore()
  152. })
  153. </script>
  154. <style lang="scss" scoped>
  155. .phone-kecheng-page {
  156. background-color: #ccc;
  157. box-sizing: border-box;
  158. }
  159. .phone-search-content {
  160. position: relative;
  161. background-color: #fff;
  162. height: 42px;
  163. .search-input {
  164. height: 42px;
  165. line-height: 40px;
  166. border-radius: 20px;
  167. border: 1px solid #ccc;
  168. padding: 0 70px 0 20px;
  169. }
  170. .search-icon {
  171. position: absolute;
  172. right: 5px;
  173. top: 4px;
  174. padding: 6px;
  175. background-color: #ccc;
  176. border-radius: 20px;
  177. width: 50px;
  178. text-align: center;
  179. }
  180. }
  181. </style>