list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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>
  27. <button @click="checkKecheng(item)" type="primary" size="mini"
  28. class="item-view-btn">查看内容</button>
  29. </view>
  30. </template>
  31. </uni-list-item>
  32. <uni-load-more :status="data.state" @click="getMore(0)"
  33. :contentText="data.contentText"></uni-load-more>
  34. </uni-list>
  35. </scroll-view>
  36. <!-- 页面底端 -->
  37. <customTabbarClientVue></customTabbarClientVue>
  38. </view>
  39. </template>
  40. <script setup>
  41. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  42. import {
  43. ref,
  44. reactive
  45. } from "vue";
  46. import {
  47. onLoad
  48. } from "@dcloudio/uni-app";
  49. import * as kaoshiApi from "@/api/kaoshi.js"
  50. import {
  51. formatDuration
  52. } from "@/utils/common.js"
  53. const data = reactive({
  54. list: [], // 考试列表
  55. loading: false,
  56. page: 0,
  57. size: 10,
  58. state: 'more',
  59. contentText: {
  60. contentdown: '查看更多',
  61. contentrefresh: '加载中',
  62. contentnomore: '没有更多'
  63. },
  64. from: ''
  65. })
  66. function goUpPage() {
  67. if (data.from == 'my') {
  68. uni.redirectTo({
  69. url: '/pages/client/my/index'
  70. })
  71. } else if (data.from == 'kaoshi') {
  72. uni.redirectTo({
  73. url: '/pages/client/Kaoshi/list'
  74. })
  75. } else if (data.from == 'shouye'){
  76. uni.redirectTo({
  77. url: '/pages/client/ShouYe/shouye'
  78. })
  79. } else {
  80. uni.redirectTo({
  81. url: '/pages/client/ShouYe/shouye'
  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. }
  105. data.list = [];
  106. // 数学
  107. data.state = 'loading';
  108. data.page++;
  109. opt.page = data.page;
  110. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  111. data.list = data.list.concat(res.data.data);
  112. data.loading = false;
  113. if (res.data.total > data.list.length) {
  114. data.state = 'more';
  115. data.loading = false;
  116. } else {
  117. data.state = 'no-more';
  118. data.loading = false;
  119. }
  120. }).catch(err => {
  121. data.state = 'more';
  122. data.loading = false;
  123. })
  124. }
  125. function getMore() {
  126. const opt = {
  127. page: 1,
  128. size: 10, // 固定查询10条
  129. }
  130. if (data.state == 'no-more') return;
  131. data.state = 'loading';
  132. data.page++;
  133. opt.page = data.page;
  134. kaoshiApi.getClientKsChengjiList(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>