list.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.zyName}}</view>
  18. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  19. </view>
  20. <!-- 时间 -->
  21. <view class="ks-totalTm">
  22. <icon class="phone-time-icon" />{{item.answerStartTime}} - {{item.answerEndTime}}
  23. </view>
  24. <!-- 分数 -->
  25. <view class="ks-score-content">
  26. <view class="ks-score">
  27. <icon class="phone-zongfen-icon" />总分:<text>{{item.ksScore}}</text>
  28. </view>
  29. <view class="ks-okScore">
  30. <icon class="phone-jigefen-icon" />及格分:<text>{{item.okScore}}</text>
  31. </view>
  32. <view class="ks-getScore">
  33. <icon class="phone-jigefen-icon" />得分:<text>{{item.userScore}}</text>
  34. </view>
  35. </view>
  36. <button @click="checkKecheng(item)" type="primary" size="mini"
  37. class="item-view-btn">查看内容</button>
  38. </view>
  39. </template>
  40. </uni-list-item>
  41. <uni-load-more :status="data.state" @click="getMore(0)" :contentText="data.contentText"></uni-load-more>
  42. </uni-list>
  43. </scroll-view>
  44. <!-- 页面底端 -->
  45. <customTabbarClientVue></customTabbarClientVue>
  46. </view>
  47. </template>
  48. <script setup>
  49. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  50. import {
  51. ref,
  52. reactive
  53. } from "vue";
  54. import {
  55. onLoad
  56. } from "@dcloudio/uni-app";
  57. import * as kaoshiApi from "@/api/kaoshi.js"
  58. import {
  59. formatDuration
  60. } from "@/utils/common.js"
  61. const data = reactive({
  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. const pages = getCurrentPages();
  76. if (pages.length > 1) {
  77. uni.navigateBack()
  78. } else {
  79. /* if (data.from == 'my') {
  80. uni.navigateTo({
  81. url: '/pages/client/my/index'
  82. })
  83. } else if (data.from == 'kaoshi') {
  84. uni.navigateTo({
  85. url: '/pages/client/Kaoshi/list'
  86. })
  87. } else if (data.from == 'shouye'){
  88. uni.navigateTo({
  89. url: '/pages/client/ShouYe/shouye'
  90. })
  91. } else {
  92. uni.navigateTo({
  93. url: '/pages/client/ShouYe/shouye'
  94. })
  95. } */
  96. history.back();
  97. }
  98. }
  99. function handleSearch() {
  100. data.page = 0;
  101. refreshData();
  102. }
  103. function checkKecheng(item) {
  104. uni.navigateTo({
  105. url: `/pages/client/Chengji/ksScoreShijuan?hisId=${item.hisId}&from=chengjiList`
  106. })
  107. }
  108. function onRefresh() {
  109. data.page = 0;
  110. data.list = [];
  111. data.loading = true;
  112. refreshData();
  113. }
  114. function refreshData() {
  115. const opt = {
  116. page: 1,
  117. size: 10, // 固定查询10条
  118. }
  119. data.list = [];
  120. // 数学
  121. data.state = 'loading';
  122. data.page++;
  123. opt.page = data.page;
  124. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  125. data.list = data.list.concat(res.data.data);
  126. data.loading = false;
  127. if (res.data.total > data.list.length) {
  128. data.state = 'more';
  129. data.loading = false;
  130. } else {
  131. data.state = 'no-more';
  132. data.loading = false;
  133. }
  134. }).catch(err => {
  135. data.state = 'more';
  136. data.loading = false;
  137. })
  138. }
  139. function getMore() {
  140. const opt = {
  141. page: 1,
  142. size: 10, // 固定查询10条
  143. }
  144. if (data.state == 'no-more') return;
  145. data.state = 'loading';
  146. data.page++;
  147. opt.page = data.page;
  148. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  149. data.list = data.list.concat(res.data.data);
  150. data.loading = false;
  151. if (res.data.total > data.list.length) {
  152. data.state = 'more';
  153. data.loading = false;
  154. } else {
  155. data.state = 'no-more';
  156. data.loading = false;
  157. }
  158. }).catch(err => {
  159. data.state = 'more';
  160. data.loading = false;
  161. })
  162. }
  163. onLoad((options) => {
  164. data.from = options.from;
  165. getMore()
  166. })
  167. </script>
  168. <style lang="scss" scoped>
  169. .phone-kecheng-page {
  170. background-color: #ccc;
  171. box-sizing: border-box;
  172. }
  173. .phone-search-content {
  174. position: relative;
  175. background-color: #fff;
  176. height: 42px;
  177. .search-input {
  178. height: 42px;
  179. line-height: 40px;
  180. border-radius: 20px;
  181. border: 1px solid #ccc;
  182. padding: 0 70px 0 20px;
  183. }
  184. .search-icon {
  185. position: absolute;
  186. right: 5px;
  187. top: 4px;
  188. padding: 6px;
  189. background-color: #ccc;
  190. border-radius: 20px;
  191. width: 50px;
  192. text-align: center;
  193. }
  194. }
  195. </style>