recordDetail.vue 4.7 KB

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