list.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="phone-list-page">
  3. <customNavbarVue title="成绩" :show-back-btn="true" @back="goUpPage"></customNavbarVue>
  4. <!-- 课程列表 -->
  5. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  6. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh" @scrolltolower="onScrolltolower"
  7. :style="{ height: `calc(100vh - ${statusBarHeight}px - 212rpx);`}" class="phone-scroll-overflow">
  8. <uni-list class="admin-list-box">
  9. <uni-list-item v-for="item in data.list" class="admin-list-item-box" :key="item.hisId">
  10. <template v-slot:body>
  11. <view class="item-card-row">
  12. <!-- 数量 -->
  13. <view class="ks-item-top">
  14. <view class="ks-name">{{item.zyName}}</view>
  15. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  16. </view>
  17. <!-- 时间 -->
  18. <view class="ks-totalTm">
  19. <icon class="phone-time-icon" :style="{ backgroundImage: 'url(' + data.imgsArr.phoneTimeIcon + ')' }"/>{{item.answerStartTime}} - {{item.answerEndTime}}
  20. </view>
  21. <!-- 分数 -->
  22. <view class="ks-score-content">
  23. <view class="ks-score">
  24. <icon class="phone-zongfen-icon" :style="{ backgroundImage: 'url(' + data.imgsArr.phoneZongfenIcon + ')' }"/>总分:<text>{{item.ksScore}}</text>
  25. </view>
  26. <view class="ks-okScore cj-okScore">
  27. <icon class="phone-jigefen-icon" :style="{ backgroundImage: 'url(' + data.imgsArr.phoneJigefenIcon + ')' }"/>及格分:<text>{{item.okScore}}</text>
  28. </view>
  29. <view class="ks-getScore">
  30. <icon class="phone-defen-icon" :style="{ backgroundImage: 'url(' + data.imgsArr.phoneDefenIcon + ')' }"/>得分:<text>{{item.userScore}}</text>
  31. </view>
  32. </view>
  33. <button @click="checkKecheng(item)" type="primary" size="mini"
  34. class="item-view-btn">查看内容</button>
  35. </view>
  36. </template>
  37. </uni-list-item>
  38. <uni-load-more :status="data.state" @click="getMore(0)" :contentText="data.contentText"></uni-load-more>
  39. </uni-list>
  40. </scroll-view>
  41. <!-- 页面底端 -->
  42. <customTabbarClientVue></customTabbarClientVue>
  43. </view>
  44. </template>
  45. <script setup>
  46. import cacheManager from '@/utils/cacheManager.js';
  47. import customNavbarVue from "@/components/custom-navbar/custom-navbar.vue";
  48. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-client.vue";
  49. import {ref,reactive,onMounted} from "vue";
  50. import {
  51. onLoad
  52. } from "@dcloudio/uni-app";
  53. import * as kaoshiApi from "@/api/kaoshi.js"
  54. import {
  55. formatDuration
  56. } from "@/utils/common.js"
  57. const statusBarHeight = ref(0);
  58. const data = reactive({
  59. list: [], // 考试列表
  60. loading: false,
  61. page: 0,
  62. size: 10,
  63. state: 'more',
  64. contentText: {
  65. contentdown: '查看更多',
  66. contentrefresh: '加载中',
  67. contentnomore: '没有更多'
  68. },
  69. from: '',
  70. imgsArr: {
  71. phoneZongfenIcon: '',
  72. phoneJigefenIcon: '',
  73. phoneDefenIcon: '',
  74. phoneTimeIcon: '',
  75. },
  76. })
  77. function goUpPage() {
  78. const pages = getCurrentPages();
  79. if (pages.length > 1) {
  80. uni.navigateBack()
  81. } else {
  82. /* if (data.from == 'my') {
  83. uni.navigateTo({
  84. url: '/pages/client/my/index'
  85. })
  86. } else if (data.from == 'kaoshi') {
  87. uni.navigateTo({
  88. url: '/pages/client/Kaoshi/list'
  89. })
  90. } else if (data.from == 'shouye'){
  91. uni.navigateTo({
  92. url: '/pages/client/ShouYe/shouye'
  93. })
  94. } else {
  95. uni.navigateTo({
  96. url: '/pages/client/ShouYe/shouye'
  97. })
  98. } */
  99. history.back();
  100. }
  101. }
  102. function onScrolltolower() {
  103. getMore()
  104. }
  105. function handleSearch() {
  106. data.page = 0;
  107. refreshData();
  108. }
  109. function checkKecheng(item) {
  110. uni.navigateTo({
  111. url: `/pages/client/Chengji/ksScoreShijuan?hisId=${item.hisId}&from=chengjiList`
  112. })
  113. }
  114. function onRefresh() {
  115. data.page = 0;
  116. data.list = [];
  117. data.loading = true;
  118. refreshData();
  119. }
  120. function refreshData() {
  121. const opt = {
  122. page: 1,
  123. size: 10, // 固定查询10条
  124. }
  125. data.list = [];
  126. // 数学
  127. data.state = 'loading';
  128. data.page++;
  129. opt.page = data.page;
  130. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  131. data.list = data.list.concat(res.data.data);
  132. data.loading = false;
  133. if (res.data.total > data.list.length) {
  134. data.state = 'more';
  135. data.loading = false;
  136. } else {
  137. data.state = 'no-more';
  138. data.loading = false;
  139. }
  140. }).catch(err => {
  141. data.state = 'more';
  142. data.loading = false;
  143. })
  144. }
  145. function getMore() {
  146. const opt = {
  147. page: 1,
  148. size: 10, // 固定查询10条
  149. }
  150. if (data.state == 'no-more') return;
  151. data.state = 'loading';
  152. data.page++;
  153. opt.page = data.page;
  154. kaoshiApi.getClientKsChengjiList(opt).then(res => {
  155. data.list = data.list.concat(res.data.data);
  156. data.loading = false;
  157. if (res.data.total > data.list.length) {
  158. data.state = 'more';
  159. data.loading = false;
  160. } else {
  161. data.state = 'no-more';
  162. data.loading = false;
  163. }
  164. }).catch(err => {
  165. data.state = 'more';
  166. data.loading = false;
  167. })
  168. }
  169. onMounted(() => {
  170. uni.getSystemInfo({
  171. success: (res) => {
  172. statusBarHeight.value = res.statusBarHeight;
  173. }
  174. });
  175. });
  176. onLoad((options) => {
  177. data.from = options.from;
  178. data.imgsArr.phoneZongfenIcon = cacheManager.get('projectImg').zongfen_icon;
  179. data.imgsArr.phoneJigefenIcon = cacheManager.get('projectImg').jigefen_icon;
  180. data.imgsArr.phoneDefenIcon = cacheManager.get('projectImg').defen_icon;
  181. data.imgsArr.phoneTimeIcon = cacheManager.get('projectImg').time_icon;
  182. getMore()
  183. })
  184. </script>
  185. <style lang="scss" scoped>
  186. .phone-kecheng-page {
  187. background-color: #ccc;
  188. box-sizing: border-box;
  189. }
  190. .phone-search-content {
  191. position: relative;
  192. background-color: #fff;
  193. height: 42px;
  194. .search-input {
  195. height: 42px;
  196. line-height: 40px;
  197. border-radius: 20px;
  198. border: 1px solid #ccc;
  199. padding: 0 70px 0 20px;
  200. }
  201. .search-icon {
  202. position: absolute;
  203. right: 5px;
  204. top: 4px;
  205. padding: 6px;
  206. background-color: #ccc;
  207. border-radius: 20px;
  208. width: 50px;
  209. text-align: center;
  210. }
  211. }
  212. </style>