recordDetail.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 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: 20%;">
  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(20);
  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. status.value = 'loading'
  73. loadCreditDatial(data).then(res => {
  74. uni.hideLoading()
  75. if (res && res?.code === 0) {
  76. count.value = res.count;
  77. list.value = [...list.value, ...res.data];
  78. if(list.value.length === count.value){
  79. status.value = 'nomore'
  80. }else{
  81. status.value = 'loadmore'
  82. }
  83. pageNumber.value = pageNumber.value + 1;
  84. }
  85. })
  86. }
  87. const scrolltolower = () => {
  88. if(status.value === 'nomore'){
  89. return
  90. }
  91. initList()
  92. }
  93. onLoad((options) => {
  94. const {
  95. year
  96. } = options;
  97. // console.log(year)
  98. currentYear.value = year
  99. pageNumber.value = 1
  100. initList()
  101. // console.log('onLoad')
  102. })
  103. </script>
  104. <style lang="scss">
  105. page {
  106. background-color: $uni-bg-color;
  107. }
  108. .container {
  109. box-sizing: border-box;
  110. height: 100vh;
  111. width: 100vw;
  112. background-color: $uni-bg-color;
  113. // background-color: #fff;
  114. // padding: 0 20rpx env(safe-area-inset-bottom, 0);
  115. padding: 30rpx;
  116. }
  117. .scroll-Y {
  118. flex: 1;
  119. overflow: hidden;
  120. }
  121. .list-box {
  122. height: 100%;
  123. display: flex;
  124. flex-direction: column;
  125. // margin: 20rpx 20rpx;
  126. background-color: $uni-bg-color-grey;
  127. border-radius: $uni-card-border-radius;
  128. // padding: 20rpx 15rpx;
  129. // margin-bottom: 30rpx;
  130. .list-item-box {
  131. &:first-child {
  132. border-bottom: 5rpx solid #E6E6E6;
  133. font-size: 26rpx;
  134. font-weight: bold;
  135. flex: 0 0 auto;
  136. .list-item {
  137. width: 30%;
  138. text-align: center;
  139. &:last-child {
  140. color: #303133;
  141. font-weight: bold;
  142. }
  143. }
  144. }
  145. padding: 25rpx 0;
  146. text-align: center;
  147. font-size: 26rpx;
  148. font-weight: bold;
  149. display: flex;
  150. align-items: center;
  151. .list-item {
  152. width: 30%;
  153. text-align: center;
  154. &:last-child {
  155. font-weight: normal;
  156. }
  157. }
  158. .button {
  159. width: fit-content;
  160. border-radius: $uni-card-border-radius;
  161. margin: 0 auto;
  162. }
  163. .primary {
  164. padding: 5rpx 25rpx;
  165. background-color: $uni-color-primary;
  166. }
  167. .error {
  168. padding: 5rpx 15rpx;
  169. background-color: $uni-color-error;
  170. }
  171. }
  172. .list-item-content {
  173. // &:first-child {
  174. // border-bottom: 5rpx solid #E6E6E6;
  175. // font-size: $uni-font-size-1;
  176. // font-weight: bold;
  177. // .list-item {
  178. // width: 25%;
  179. // text-align: center;
  180. // &:last-child {
  181. // color: #303133;
  182. // font-weight: bold;
  183. // }
  184. // }
  185. // }
  186. padding: 25rpx 0;
  187. text-align: center;
  188. font-size: 26rpx;
  189. font-weight: bold;
  190. display: flex;
  191. align-items: center;
  192. .list-item {
  193. width: 30%;
  194. text-align: center;
  195. // &:last-child {
  196. // font-weight: normal;
  197. // }
  198. }
  199. .button {
  200. width: fit-content;
  201. border-radius: $uni-card-border-radius;
  202. margin: 0 auto;
  203. }
  204. .primary {
  205. padding: 5rpx 25rpx;
  206. background-color: $uni-color-primary;
  207. }
  208. .error {
  209. padding: 5rpx 15rpx;
  210. background-color: $uni-color-error;
  211. }
  212. }
  213. }
  214. </style>