volunteerHours.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="common_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title="义工时长" bgColor="#FFFFFF"></cus-header>
  4. <view class="member" v-if="!isFamilyMember">
  5. <scroll-view class="scroll-view_H" scroll-x="true" scroll-with-animation="true" :scroll-left="scrollLeft">
  6. <view class="scroll-view-item_H" :id="'svih_'+index" v-for="(item,index) in memberList" :key="index" @click="changeMember(item,index)">
  7. <view class="cl_item" :class="{'active':midx===index}">
  8. <text>{{item.name}}</text>
  9. </view>
  10. </view>
  11. </scroll-view>
  12. </view>
  13. <view class="hours">义工时长:{{volunteerHours||0}}<text>小时</text></view>
  14. <view class="list" v-if="list.length">
  15. <up-list @scrolltolower="scrolltolower" style="height: 100%;">
  16. <up-list-item class="list-item" v-for="(item, index) in list" :key="index">
  17. <view class="time">{{item.createDate||""}}</view>
  18. <view class="content adfacjb">
  19. <view class="left adfac">
  20. <image src="https://oss.familydaf.cn/sxsnfile/20251218/681b23140cde486a8bf4b6844ce9b2e3.png"></image>
  21. <view class="texts">
  22. <view class="p">{{item.activityName??''}}</view>
  23. <view class="p tip">{{item.memberName||''}} - {{item.typeName??''}}</view>
  24. </view>
  25. </view>
  26. <view class="right adfac">
  27. <text>+{{item.volunteerHours??0}}</text>
  28. </view>
  29. </view>
  30. </up-list-item>
  31. </up-list>
  32. </view>
  33. <view class="dataEmpty" v-else>
  34. <page-empty text="暂无义工时长记录"></page-empty>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup name="">
  39. import CusHeader from '@/components/CusHeader/index.vue'
  40. import PageEmpty from '@/components/pageEmpty/index.vue'
  41. import { onLoad } from '@dcloudio/uni-app'
  42. import { ref, getCurrentInstance } from 'vue'
  43. const { proxy } = getCurrentInstance()
  44. const queryParams = ref({
  45. page:1,
  46. limit:10,
  47. memberId:'',
  48. userId:''
  49. })
  50. const midx = ref(0)
  51. const scrollLeft = ref(0)
  52. const memberList = ref([])
  53. const volunteerHours = ref(0)
  54. const isOver = ref(false)
  55. const isFamilyMember = ref(false)
  56. const list = ref([])
  57. const scrolltolower = () => {
  58. if(isOver.value) return
  59. getList()
  60. }
  61. const initList = () => {
  62. queryParams.value.page = 1;
  63. isOver.value = false;
  64. list.value = [];
  65. }
  66. const changeMember = (item,index) => {
  67. midx.value = index;
  68. queryParams.value.memberId = item.id;
  69. initList()
  70. getList()
  71. }
  72. const getMemberList = () => {
  73. let query = JSON.parse(JSON.stringify(queryParams.value))
  74. query.limit = -1;
  75. proxy.$api.get('/core/family/member/page',query).then(({data:res})=>{
  76. if(res.code!==0) return proxy.$showToast(res.msg)
  77. memberList.value = [{id:'',name:'全部'}].concat(res.data.list||[]);
  78. })
  79. }
  80. const getList = () => {
  81. proxy.$api.get('/core/love/value/record/volunteerHoursList',queryParams.value).then(({data:res})=>{
  82. if(res.code!==0) return proxy.$showToast(res.msg)
  83. list.value= [...list.value,...res.data.list];
  84. list.value.forEach(l=>{
  85. l.createDate = new Date(l.createDate).Format('yyyy.MM.dd hh:mm:ss')
  86. })
  87. queryParams.value.page++
  88. if(res.data.list.length===0) isOver.value = true;
  89. })
  90. }
  91. onLoad(options=>{
  92. volunteerHours.value = options.volunteerHours||0;
  93. isFamilyMember.value = uni.getStorageSync('isFamilyMember')?true:false;
  94. queryParams.value.userId = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).id;
  95. if(uni.getStorageSync('familyMemberInfo')) queryParams.value.memberId = JSON.parse(uni.getStorageSync('familyMemberInfo')).id;
  96. getMemberList()
  97. getList()
  98. })
  99. </script>
  100. <style scoped lang="scss">
  101. .scroll-view_H {
  102. white-space: nowrap;
  103. width: 100%;
  104. }
  105. .scroll-view-item_H {
  106. display: inline-block;
  107. height: 100%;
  108. margin-left: 30rpx;
  109. &:first-child{
  110. margin-left: 0;
  111. }
  112. }
  113. .common_page{
  114. .member{
  115. width: 100%;
  116. height: 56rpx;
  117. margin-top: 20rpx;
  118. margin-bottom: 16rpx;
  119. box-sizing: border-box;
  120. .cl_item{
  121. padding: 0 26rpx;
  122. height: 56rpx;
  123. background: #FFFFFF;
  124. border-radius: 10rpx;
  125. font-family: PingFangSC, PingFang SC;
  126. font-weight: 400;
  127. font-size: 26rpx;
  128. color: #252525;
  129. line-height: 56rpx;
  130. text-align: center;
  131. &.active{
  132. background: #B7F358;
  133. }
  134. }
  135. }
  136. .hours{
  137. padding: 0 24rpx;
  138. height: 120rpx;
  139. background: #FFFFFF;
  140. border-radius: 24rpx;
  141. margin-top: 20rpx;
  142. font-family: PingFang-SC, PingFang-SC;
  143. font-weight: bold;
  144. font-size: 32rpx;
  145. color: #151B29;
  146. line-height: 120rpx;
  147. text{
  148. font-family: PingFangSC, PingFang SC;
  149. font-weight: 400;
  150. font-size: 24rpx;
  151. color: #989998;
  152. line-height: 120rpx;
  153. margin-left: 5rpx;
  154. }
  155. }
  156. .list{
  157. height: calc(100% - 160rpx);
  158. background: #FFFFFF;
  159. border-radius: 24rpx;
  160. margin-top: 20rpx;
  161. padding: 0 21rpx;
  162. &-item{
  163. padding: 36rpx 0;
  164. border-bottom: 1rpx solid #E7E7E7;
  165. .time{
  166. font-family: PingFangSC, PingFang SC;
  167. font-weight: 400;
  168. font-size: 24rpx;
  169. color: #989998;
  170. line-height: 24rpx;
  171. }
  172. .content{
  173. margin-top: 36rpx;
  174. .left{
  175. width: calc(100% - 200rpx);
  176. image{
  177. width: 64rpx;
  178. height: 64rpx;
  179. display: table;
  180. }
  181. .texts{
  182. width: 100%;
  183. margin-left: 20rpx;
  184. .p{
  185. font-family: PingFangSC, PingFang SC;
  186. font-weight: 400;
  187. font-size: 32rpx;
  188. color: #151B29;
  189. line-height: 32rpx;
  190. overflow: hidden;
  191. text-overflow: ellipsis;
  192. white-space: nowrap;
  193. &.tip{
  194. font-size: 24rpx;
  195. color: #989998;
  196. line-height: 24rpx;
  197. margin-top: 18rpx;
  198. }
  199. }
  200. }
  201. }
  202. .right{
  203. width: 200rpx;
  204. justify-content: flex-end;
  205. text{
  206. font-family: DINAlternate, DINAlternate;
  207. font-weight: bold;
  208. font-size: 36rpx;
  209. color: #252525;
  210. line-height: 42rpx;
  211. text-align: right;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. </style>