Side_index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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"
  7. :index="index"></up-lazy-load>
  8. <view class="demo-title">
  9. {{item.skillDescribe}}
  10. </view>
  11. <view class="demo-PriceDome">
  12. <view class="demo-price">
  13. <image src="../../static/用户.png" class="name-image"></image>
  14. {{item.name}}
  15. </view>
  16. <view class="dome-Like">
  17. <text style="font-size: 25rpx; color: red;" >¥</text>
  18. <text style="font-size: 35rpx; color: red;">1.4w</text>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <template #right :rightList="rightList">
  24. <view class="demo-warter" v-for="(item, index) in rightList" :key="index" @click="goToDetail(item)">
  25. <up-lazy-load threshold="-450" border-radius="10" :image="item.image"
  26. :index="index"></up-lazy-load>
  27. <view class="demo-title">
  28. {{item.skillDescribe}}
  29. </view>
  30. <view class="demo-PriceDome">
  31. <view class="demo-price">
  32. <image src="../../static/用户.png" class="name-image"></image>
  33. {{item.name}}
  34. </view>
  35. <view class="dome-Like">
  36. <text style="font-size: 25rpx; color: red;" >¥</text>
  37. <text style="font-size: 35rpx; color: red;">1.4w</text>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. </up-waterfall>
  43. <!-- <up-loadmore bg-color="rgb(240, 240, 240)" :status="loadStatus" @loadmore="addRandomData"></up-loadmore> -->
  44. </view>
  45. <!-- 志愿者 -->
  46. <view class="container" v-else-if="userType == '2'">
  47. <view v-for="(item, index) in list" :key="index" class="item">
  48. <!-- 左侧:图片 -->
  49. <view class="Wrap-img">
  50. <image :src="item.image" mode="aspectFit" class="image"></image>
  51. </view>
  52. <!-- 中间:姓名、分类、技能介绍 -->
  53. <view class="middle">
  54. <view class="name">姓名:{{ item.name }}</view>
  55. <view class="category">类别:{{ item.category }}</view>
  56. <view class="title">技能介绍:{{ item.title }}</view>
  57. </view>
  58. <!-- 右侧:评分 + 按钮 -->
  59. <view class="right">
  60. <view class="score">评分:{{ item.score }}</view>
  61. <up-button type="error" text="购买" size="mini" custom-style="
  62. width: 120rpx;
  63. height: 50rpx;
  64. font-size: 24rpx;
  65. border-radius: 25rpx;
  66. margin-left: 40rpx;
  67. "></up-button>
  68. </view>
  69. </view>
  70. </view>
  71. </template>
  72. <script setup>
  73. import {
  74. ref,
  75. onMounted,
  76. nextTick
  77. } from 'vue';
  78. import {
  79. onShow
  80. } from '@dcloudio/uni-app'
  81. import {volunteerinfolist,getDetailsvolunteerId} from "@/api/volunteerDetailsApi/details.js"
  82. const flowList = ref([]); //list数据
  83. const loadStatus = ref('loadmore');
  84. const userType = uni.getStorageSync('userType') //读取本地存储
  85. // 用户/志愿者 识别标识
  86. const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
  87. const listData = ref([])
  88. const rightList = ref([])
  89. const getList = async() =>{
  90. const res = await volunteerinfolist()
  91. console.log(res,'>>>>>222')
  92. // 处理左右数据展示
  93. let leftArr = []
  94. let rightArr = []
  95. console.log(res.data, '>>>res.data');
  96. (res.data || []).forEach((item, index) => {
  97. index%2 != 0 ? leftArr.push(item) : rightArr.push(item)
  98. })
  99. listData.value = leftArr
  100. rightList.value = rightArr
  101. }
  102. const goToDetail = async(item) => {
  103. console.log("11111")
  104. const volunteerId = item.volunteerId; // 获取具体的 volunteerId
  105. uni.navigateTo({
  106. url: `/pages/goodsDetails/goodsDetails?volunteerId=${volunteerId}`
  107. });
  108. }
  109. onShow(() => {
  110. getList()
  111. })
  112. </script>
  113. <style scoped>
  114. .demo-warter {
  115. border-radius: 8px;
  116. margin: 5px;
  117. background-color: #ffffff;
  118. padding: 5px;
  119. }
  120. .u-close {
  121. position: absolute;
  122. top: 32rpx;
  123. right: 32rpx;
  124. }
  125. .demo-image {
  126. width: 100%;
  127. border-radius: 4px;
  128. }
  129. .demo-title {
  130. font-size: 30rpx;
  131. margin-top: 5px;
  132. color: $up-main-color;
  133. margin-left: 15rpx;
  134. display: -webkit-box;
  135. -webkit-box-orient: vertical;
  136. -webkit-line-clamp: 2;
  137. /* 限制显示两行 */
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. /* 超出部分显示省略号 */
  141. word-break: break-all;
  142. }
  143. .demo-img {
  144. width: 40rpx;
  145. height: 40rpx;
  146. border-radius: 50%;
  147. }
  148. .demo-PriceDome {
  149. display: flex;
  150. font-size: 30rpx;
  151. color: $up-type-error;
  152. /* margin-top: 5px; */
  153. margin-top: 20rpx;
  154. }
  155. .demo-price{
  156. display: flex;
  157. }
  158. .name-image{
  159. width: 40rpx;
  160. height: 40rpx;
  161. }
  162. .dome-Like {
  163. margin-left: 120rpx;
  164. display: flex;
  165. justify-content: center;
  166. align-items: center;
  167. }
  168. /* 志愿者列表 */
  169. /* 容器样式 */
  170. .container {
  171. padding: 20rpx;
  172. }
  173. /* 每个 item 使用 Flex 布局 */
  174. .item {
  175. display: flex;
  176. align-items: flex-start;
  177. margin-bottom: 30rpx;
  178. padding: 20rpx;
  179. border: 1rpx solid #eee;
  180. border-radius: 16rpx;
  181. }
  182. /* 图片固定宽度 */
  183. .image {
  184. width: 230rpx;
  185. height: 180rpx;
  186. border-radius: 8rpx;
  187. margin-right: 20rpx;
  188. }
  189. /* 中间部分:自动填充剩余空间 */
  190. .middle {
  191. flex: 1;
  192. margin-right: 20rpx;
  193. }
  194. /* 姓名样式 */
  195. .name {
  196. font-weight: bold;
  197. font-size: 32rpx;
  198. margin-bottom: 8rpx;
  199. }
  200. /* 分类样式 */
  201. .category {
  202. color: #666;
  203. font-size: 28rpx;
  204. margin-bottom: 8rpx;
  205. }
  206. .title {
  207. font-size: 28rpx;
  208. color: #888;
  209. line-height: 1.4;
  210. display: -webkit-box;
  211. -webkit-box-orient: vertical;
  212. -webkit-line-clamp: 2;
  213. overflow: hidden;
  214. text-overflow: ellipsis;
  215. word-break: break-all;
  216. /* 可选:长单词强制换行 */
  217. }
  218. /* 右侧:评分和按钮 */
  219. .right {
  220. display: flex;
  221. flex-direction: column;
  222. align-items: flex-end;
  223. min-width: 160rpx;
  224. }
  225. /* 评分样式 */
  226. .score {
  227. color: orange;
  228. font-size: 28rpx;
  229. margin-bottom: 10rpx;
  230. height: 120rpx;
  231. }
  232. </style>