volunteerHours.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="common_page" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title="义工时长" bgColor="#FFFFFF"></cus-header>
  4. <view class="hours">义工时长:{{volunteerHours}}<text>小时</text></view>
  5. <view class="list" v-if="list.length">
  6. <up-list @scrolltolower="scrolltolower" style="height: 100%;">
  7. <up-list-item class="list-item" v-for="(item, index) in list" :key="index">
  8. <view class="time">{{item.createDate||""}}</view>
  9. <view class="content adfacjb">
  10. <view class="left adfac">
  11. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/24/d5b79c0e-bcda-49ff-8cc5-5f6275b6bac1.png"></image>
  12. <view class="texts">
  13. <view class="p">{{item.activityName??''}}</view>
  14. <view class="p tip">{{item.typeName??''}}</view>
  15. </view>
  16. </view>
  17. <view class="right adfac">
  18. <text>+{{item.volunteerHours??0}}</text>
  19. </view>
  20. </view>
  21. </up-list-item>
  22. </up-list>
  23. </view>
  24. <view class="dataEmpty" v-else>
  25. <page-empty text="暂无义工时长记录"></page-empty>
  26. </view>
  27. </view>
  28. </template>
  29. <script setup name="">
  30. import CusHeader from '@/components/CusHeader/index.vue'
  31. import PageEmpty from '@/components/pageEmpty/index.vue'
  32. import { onLoad } from '@dcloudio/uni-app'
  33. import { ref, getCurrentInstance } from 'vue'
  34. const { proxy } = getCurrentInstance()
  35. const queryParams = ref({
  36. page:1,
  37. limit:10,
  38. userId:''
  39. })
  40. const volunteerHours = ref(0)
  41. const isOver = ref(false)
  42. const list = ref([])
  43. const scrolltolower = () => {
  44. if(isOver.value) return
  45. getList()
  46. }
  47. const getList = () => {
  48. proxy.$api.get('/core/love/value/record/volunteerHoursList',queryParams.value).then(({data:res})=>{
  49. if(res.code!==0) return proxy.$showToast(res.msg)
  50. list.value= [...list.value,...res.data.list];
  51. queryParams.value.page++
  52. if(res.data.list.length===0) isOver.value = true;
  53. })
  54. }
  55. onLoad(options=>{
  56. volunteerHours.value = options.volunteerHours??0;
  57. queryParams.value.userId = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).id;
  58. getList()
  59. })
  60. </script>
  61. <style scoped lang="scss">
  62. .common_page{
  63. .hours{
  64. padding: 0 24rpx;
  65. height: 120rpx;
  66. background: #FFFFFF;
  67. border-radius: 24rpx;
  68. margin-top: 20rpx;
  69. font-family: PingFang-SC, PingFang-SC;
  70. font-weight: bold;
  71. font-size: 32rpx;
  72. color: #151B29;
  73. line-height: 120rpx;
  74. text{
  75. font-family: PingFangSC, PingFang SC;
  76. font-weight: 400;
  77. font-size: 24rpx;
  78. color: #989998;
  79. line-height: 120rpx;
  80. margin-left: 5rpx;
  81. }
  82. }
  83. .list{
  84. height: calc(100% - 160rpx);
  85. background: #FFFFFF;
  86. border-radius: 24rpx;
  87. margin-top: 20rpx;
  88. padding: 0 21rpx;
  89. &-item{
  90. padding: 36rpx 0;
  91. border-bottom: 1rpx solid #E7E7E7;
  92. .time{
  93. font-family: PingFangSC, PingFang SC;
  94. font-weight: 400;
  95. font-size: 24rpx;
  96. color: #989998;
  97. line-height: 24rpx;
  98. }
  99. .content{
  100. margin-top: 36rpx;
  101. .left{
  102. width: calc(100% - 200rpx);
  103. image{
  104. width: 64rpx;
  105. height: 64rpx;
  106. display: table;
  107. }
  108. .texts{
  109. width: 100%;
  110. margin-left: 20rpx;
  111. .p{
  112. font-family: PingFangSC, PingFang SC;
  113. font-weight: 400;
  114. font-size: 32rpx;
  115. color: #151B29;
  116. line-height: 32rpx;
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. white-space: nowrap;
  120. &.tip{
  121. font-size: 24rpx;
  122. color: #989998;
  123. line-height: 24rpx;
  124. margin-top: 18rpx;
  125. }
  126. }
  127. }
  128. }
  129. .right{
  130. width: 200rpx;
  131. justify-content: flex-end;
  132. text{
  133. font-family: DINAlternate, DINAlternate;
  134. font-weight: bold;
  135. font-size: 36rpx;
  136. color: #252525;
  137. line-height: 42rpx;
  138. text-align: right;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. </style>