Side_index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view v-if="userType == '1'">
  3. <up-waterfall v-model="flowList">
  4. <template #left :listData="listData">
  5. <view class="demo-warter" v-for="(item, index) in listData" :key="index" @click="goToDetail(item)">
  6. <up-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></up-lazy-load>
  7. <view class="demo-title">
  8. {{item.skillDescribe}}
  9. </view>
  10. <view class="demo-PriceDome">
  11. <view class="demo-price">
  12. <image src="../../static/用户.png" class="name-image"></image>
  13. {{item.name}}
  14. </view>
  15. <view class="dome-Like">
  16. <text style="font-size: 25rpx; color: red;">¥</text>
  17. <text style="font-size: 35rpx; color: red;">1.4w</text>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <template #right :rightList="rightList">
  23. <view class="demo-warter" v-for="(item, index) in rightList" :key="index" @click="goToDetail(item)">
  24. <up-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></up-lazy-load>
  25. <view class="demo-title">
  26. {{item.skillDescribe}}
  27. </view>
  28. <view class="demo-PriceDome">
  29. <view class="demo-price">
  30. <image src="../../static/用户.png" class="name-image"></image>
  31. {{item.name}}
  32. </view>
  33. <view class="dome-Like">
  34. <text style="font-size: 25rpx; color: red;">¥</text>
  35. <text style="font-size: 35rpx; color: red;">1.4w</text>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. </up-waterfall>
  41. </view>
  42. </template>
  43. <script setup>
  44. import {
  45. ref,
  46. onMounted,
  47. nextTick
  48. } from 'vue';
  49. import {
  50. onShow
  51. } from '@dcloudio/uni-app'
  52. import {
  53. volunteerinfolist,
  54. getDetailsvolunteerId
  55. } from "@/api/volunteerDetailsApi/details.js"
  56. const flowList = ref([]); //list数据
  57. const loadStatus = ref('loadmore');
  58. const userType = uni.getStorageSync('userType') //读取本地存储
  59. // 用户/志愿者 识别标识
  60. const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
  61. const listData = ref([])
  62. const rightList = ref([])
  63. const getList = async () => {
  64. const res = await volunteerinfolist()
  65. console.log(res, '>>>>>222')
  66. // 处理左右数据展示
  67. let leftArr = []
  68. let rightArr = []
  69. console.log(res.data, '>>>res.data');
  70. (res.data || []).forEach((item, index) => {
  71. index % 2 != 0 ? leftArr.push(item) : rightArr.push(item)
  72. })
  73. listData.value = leftArr
  74. rightList.value = rightArr
  75. }
  76. const goToDetail = async (item) => {
  77. const params = {
  78. volunteerId: item.volunteerId, // 获取 volunteerId
  79. serviceCategory: item.serviceCategory // 获取 serviceCategory
  80. };
  81. // 使用 JSON.stringify 将对象传递给 URL 参数
  82. uni.navigateTo({
  83. url: `/pages/goodsDetails/goodsDetails?params=${JSON.stringify(params)}`
  84. });
  85. }
  86. onShow(() => {
  87. getList()
  88. })
  89. </script>
  90. <style scoped>
  91. .demo-warter {
  92. border-radius: 8px;
  93. margin: 5px;
  94. background-color: #ffffff;
  95. padding: 5px;
  96. }
  97. .u-close {
  98. position: absolute;
  99. top: 32rpx;
  100. right: 32rpx;
  101. }
  102. .demo-image {
  103. width: 100%;
  104. border-radius: 4px;
  105. }
  106. .demo-title {
  107. font-size: 30rpx;
  108. margin-top: 5px;
  109. color: $up-main-color;
  110. margin-left: 15rpx;
  111. display: -webkit-box;
  112. -webkit-box-orient: vertical;
  113. -webkit-line-clamp: 3;
  114. overflow: hidden;
  115. text-overflow: ellipsis;
  116. word-break: break-all;
  117. }
  118. .demo-img {
  119. width: 40rpx;
  120. height: 40rpx;
  121. border-radius: 50%;
  122. }
  123. .demo-PriceDome {
  124. display: flex;
  125. font-size: 30rpx;
  126. color: $up-type-error;
  127. margin-top: 20rpx;
  128. }
  129. .demo-price {
  130. display: flex;
  131. }
  132. .name-image {
  133. width: 40rpx;
  134. height: 40rpx;
  135. }
  136. .dome-Like {
  137. margin-left: 140rpx;
  138. display: flex;
  139. justify-content: space-between;
  140. align-items: center;
  141. }
  142. </style>