recordDetail.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="container">
  3. <view class="list-box">
  4. <view class="list-item-box">
  5. <view class="list-item">
  6. 获得时间
  7. </view>
  8. <view class="list-item" style="width: 50%;">
  9. 课程名称
  10. </view>
  11. <view class="list-item" style="width: 20%;">
  12. 学分
  13. </view>
  14. </view>
  15. <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" v-if="list.length > 0">
  16. <view class="list-item-content" v-for="(item, index) in list" :key="index">
  17. <view class="list-item">
  18. {{item.date}}
  19. </view>
  20. <view class="list-item" style="width: 50%;">
  21. {{item.source}}
  22. </view>
  23. <view class="list-item" style="width: 20%;">
  24. {{item.credit}}
  25. </view>
  26. </view>
  27. </scroll-view>
  28. <u-empty v-else text="暂无数据" mode="list" style="margin: 20rpx"></u-empty>
  29. </view>
  30. </view>
  31. </template>
  32. <script setup>
  33. import {
  34. ref
  35. } from 'vue'
  36. import {
  37. onLoad
  38. } from '@dcloudio/uni-app'
  39. import {
  40. loadCreditDatial
  41. } from '@/api/edu.js'
  42. const list = ref([])
  43. const currentYear = ref("");
  44. const pageNumber = ref(1);
  45. const pageSize = ref(20);
  46. const count = ref(0);
  47. const status = ref("loadmore")
  48. const initList = () => {
  49. const data = {
  50. "pageNumber": pageNumber.value,
  51. "pageSize": pageSize.value,
  52. "year": currentYear.value
  53. }
  54. if(pageNumber.value===1){
  55. list.value = []
  56. }
  57. uni.showLoading({
  58. title: '加载中',
  59. })
  60. status.value = 'loading'
  61. loadCreditDatial(data).then(res => {
  62. uni.hideLoading()
  63. if (res && res?.code === 0) {
  64. count.value = res.count;
  65. list.value = [...list.value, ...res.data];
  66. if(list.value.length === count.value){
  67. status.value = 'nomore'
  68. }else{
  69. status.value = 'loadmore'
  70. }
  71. pageNumber.value = pageNumber.value + 1;
  72. }
  73. })
  74. }
  75. const scrolltolower = () => {
  76. if(status.value === 'nomore'){
  77. return
  78. }
  79. initList()
  80. }
  81. onLoad((options) => {
  82. const {
  83. year
  84. } = options;
  85. // console.log(year)
  86. currentYear.value = year
  87. pageNumber.value = 1
  88. initList()
  89. // console.log('onLoad')
  90. })
  91. </script>
  92. <style lang="scss">
  93. page {
  94. background-color: $uni-bg-color;
  95. }
  96. .container {
  97. box-sizing: border-box;
  98. height: 100vh;
  99. width: 100vw;
  100. background-color: $uni-bg-color;
  101. // background-color: #fff;
  102. // padding: 0 20rpx env(safe-area-inset-bottom, 0);
  103. padding: 30rpx;
  104. }
  105. .scroll-Y {
  106. flex: 1;
  107. overflow: hidden;
  108. }
  109. .list-box {
  110. height: 100%;
  111. display: flex;
  112. flex-direction: column;
  113. // margin: 20rpx 20rpx;
  114. background-color: $uni-bg-color-grey;
  115. border-radius: $uni-card-border-radius;
  116. // padding: 20rpx 15rpx;
  117. // margin-bottom: 30rpx;
  118. .list-item-box {
  119. &:first-child {
  120. border-bottom: 5rpx solid #E6E6E6;
  121. font-size: 26rpx;
  122. font-weight: bold;
  123. flex: 0 0 auto;
  124. .list-item {
  125. width: 30%;
  126. text-align: center;
  127. &:last-child {
  128. color: #303133;
  129. font-weight: bold;
  130. }
  131. }
  132. }
  133. padding: 25rpx 0;
  134. text-align: center;
  135. font-size: 26rpx;
  136. font-weight: bold;
  137. display: flex;
  138. align-items: center;
  139. .list-item {
  140. width: 30%;
  141. text-align: center;
  142. &:last-child {
  143. font-weight: normal;
  144. }
  145. }
  146. .button {
  147. width: fit-content;
  148. border-radius: $uni-card-border-radius;
  149. margin: 0 auto;
  150. }
  151. .primary {
  152. padding: 5rpx 25rpx;
  153. background-color: $uni-color-primary;
  154. }
  155. .error {
  156. padding: 5rpx 15rpx;
  157. background-color: $uni-color-error;
  158. }
  159. }
  160. .list-item-content {
  161. // &:first-child {
  162. // border-bottom: 5rpx solid #E6E6E6;
  163. // font-size: $uni-font-size-1;
  164. // font-weight: bold;
  165. // .list-item {
  166. // width: 25%;
  167. // text-align: center;
  168. // &:last-child {
  169. // color: #303133;
  170. // font-weight: bold;
  171. // }
  172. // }
  173. // }
  174. padding: 25rpx 0;
  175. text-align: center;
  176. font-size: 26rpx;
  177. font-weight: bold;
  178. display: flex;
  179. align-items: center;
  180. .list-item {
  181. width: 30%;
  182. text-align: center;
  183. // &:last-child {
  184. // font-weight: normal;
  185. // }
  186. }
  187. .button {
  188. width: fit-content;
  189. border-radius: $uni-card-border-radius;
  190. margin: 0 auto;
  191. }
  192. .primary {
  193. padding: 5rpx 25rpx;
  194. background-color: $uni-color-primary;
  195. }
  196. .error {
  197. padding: 5rpx 15rpx;
  198. background-color: $uni-color-error;
  199. }
  200. }
  201. }
  202. </style>