Side_index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 volunteerId = item.volunteerId; // 获取具体的 volunteerId
  78. uni.navigateTo({
  79. url: `/pages/goodsDetails/goodsDetails?volunteerId=${volunteerId}`
  80. });
  81. }
  82. onShow(() => {
  83. getList()
  84. })
  85. </script>
  86. <style scoped>
  87. .demo-warter {
  88. border-radius: 8px;
  89. margin: 5px;
  90. background-color: #ffffff;
  91. padding: 5px;
  92. }
  93. .u-close {
  94. position: absolute;
  95. top: 32rpx;
  96. right: 32rpx;
  97. }
  98. .demo-image {
  99. width: 100%;
  100. border-radius: 4px;
  101. }
  102. .demo-title {
  103. font-size: 30rpx;
  104. margin-top: 5px;
  105. color: $up-main-color;
  106. margin-left: 15rpx;
  107. display: -webkit-box;
  108. -webkit-box-orient: vertical;
  109. -webkit-line-clamp: 3;
  110. overflow: hidden;
  111. text-overflow: ellipsis;
  112. word-break: break-all;
  113. }
  114. .demo-img {
  115. width: 40rpx;
  116. height: 40rpx;
  117. border-radius: 50%;
  118. }
  119. .demo-PriceDome {
  120. display: flex;
  121. font-size: 30rpx;
  122. color: $up-type-error;
  123. margin-top: 20rpx;
  124. }
  125. .demo-price {
  126. display: flex;
  127. }
  128. .name-image {
  129. width: 40rpx;
  130. height: 40rpx;
  131. }
  132. .dome-Like {
  133. margin-left: 140rpx;
  134. display: flex;
  135. justify-content: space-between;
  136. align-items: center;
  137. }
  138. </style>