services.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view>
  3. <up-waterfall>
  4. <template #left>
  5. <view class="demo-warter" v-for="(item, index) in props.leftList" :key="index" @click="goToDetail(item)">
  6. <view v-if="item.type == 'slideshow'" class="home-swiper" @click.stop>
  7. <view v-if="ValueZoneSwiper.length > 0">
  8. <up-swiper :list="ValueZoneSwiper" :indicator="false" class="Up-swiper" @click="handleSwiperClick" :height="'516rpx'"></up-swiper>
  9. </view>
  10. </view>
  11. <template v-else>
  12. <up-lazy-load threshold="50" border-radius="10" :image="item.volunteerPicture" :index="index"
  13. mode="aspectFill"></up-lazy-load>
  14. <view class="demo-title-container">
  15. <view class="demo-title">
  16. {{ item.businessTierName }}
  17. </view>
  18. </view>
  19. <view class="demo-skillDescribe">
  20. {{ item.skillDescribe }}
  21. </view>
  22. <!-- <view class="demo-PriceDome">
  23. <view class="demo-price">
  24. <image :src="item.volunteerPicture" class="name-image"></image>
  25. {{ item.name }}
  26. </view>
  27. </view> -->
  28. </template>
  29. </view>
  30. </template>
  31. <template #right>
  32. <view class="demo-warter" v-for="(item, index) in props.rightList" :key="index" @click="goToDetail(item)">
  33. <up-lazy-load threshold="50" border-radius="10" :image="item.volunteerPicture" :index="index"
  34. mode="aspectFill"></up-lazy-load>
  35. <view class="demo-title-container">
  36. <view class="demo-title">
  37. {{ item.businessTierName }}
  38. </view>
  39. </view>
  40. <view class="demo-skillDescribe">
  41. {{ item.skillDescribe }}
  42. </view>
  43. <!-- <view class="demo-PriceDome">
  44. <view class="demo-price">
  45. <image :src="item.volunteerPicture" class="name-image"></image>
  46. {{ item.name }}
  47. </view>
  48. </view> -->
  49. </view>
  50. </template>
  51. </up-waterfall>
  52. </view>
  53. </template>
  54. <script setup>
  55. const props = defineProps({
  56. leftList: {
  57. type: Array,
  58. default: () => []
  59. },
  60. rightList: {
  61. type: Array,
  62. default: () => []
  63. },
  64. ValueZoneSwiper: {
  65. type: Array,
  66. default: () => []
  67. }
  68. });
  69. // 轮播图点击事件
  70. const handleSwiperClick = (item) => {
  71. console.log('轮播图点击', item);
  72. // 这里可以添加轮播图的点击处理逻辑
  73. }
  74. const goToDetail = async (item) => {
  75. const params = {
  76. volunteerId: item.volunteerId, // 获取 volunteerId
  77. serviceCategory: item.serviceCategory, // 获取 serviceCategory
  78. businessManagementId: item.businessManagementId, //获取 businessManagementId
  79. };
  80. const data = encodeURIComponent(JSON.stringify(params))
  81. console.log(data, '>>>>>data');
  82. uni.navigateTo({
  83. url: `/pages_home/pages/Volunteerside/goodsDetails?params=${data}`
  84. });
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. /* 轮播图片 */
  89. .home-swiper {
  90. width: 340rpx;
  91. height: 516rpx;
  92. :deep(.Up-swiper) {
  93. width: 100%;
  94. height: 100%;
  95. }
  96. }
  97. .demo-warter {
  98. border-radius: 8px;
  99. margin: 5px;
  100. background-color: #ffffff;
  101. }
  102. .u-close {
  103. position: absolute;
  104. top: 32rpx;
  105. right: 32rpx;
  106. }
  107. .demo-image {
  108. width: 100%;
  109. border-radius: 4px;
  110. }
  111. .demo-title-container {
  112. display: flex;
  113. flex-direction: column;
  114. justify-content: center;
  115. align-items: center;
  116. padding: 4rpx 12rpx;
  117. // z-index: 0;
  118. margin-top: 10rpx;
  119. border-radius: 10rpx;
  120. box-sizing: border-box;
  121. border: 1rpx solid rgba(237, 93, 49, 0.8);
  122. }
  123. .demo-title {
  124. font-size: 22rpx;
  125. color: #ED5D31;
  126. display: -webkit-box;
  127. -webkit-box-orient: vertical;
  128. -webkit-line-clamp: 3;
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. word-break: break-all;
  132. }
  133. .demo-skillDescribe {
  134. width: 298rpx;
  135. height: 73rpx;
  136. font-family: PingFang SC;
  137. font-size: 26rpx;
  138. font-weight: 500;
  139. line-height: 36rpx;
  140. letter-spacing: normal;
  141. color: #141414;
  142. margin-top: 5px;
  143. display: -webkit-box;
  144. -webkit-box-orient: vertical;
  145. -webkit-line-clamp: 2;
  146. overflow: hidden;
  147. text-overflow: ellipsis;
  148. word-break: break-all;
  149. }
  150. .demo-img {
  151. width: 40rpx;
  152. height: 40rpx;
  153. border-radius: 50%;
  154. }
  155. .demo-PriceDome {
  156. display: flex;
  157. justify-content: space-between;
  158. align-items: center;
  159. width: 100%;
  160. margin-top: 15rpx;
  161. }
  162. .demo-price {
  163. display: flex;
  164. align-items: center;
  165. flex: 1;
  166. overflow: hidden;
  167. /* 防止内容溢出 */
  168. }
  169. .name-image {
  170. width: 40rpx;
  171. height: 40rpx;
  172. margin-right: 10rpx;
  173. border-radius: 50%;
  174. }
  175. .name-text {
  176. white-space: nowrap;
  177. /* 禁止换行 */
  178. overflow: hidden;
  179. /* 超出部分隐藏 */
  180. text-overflow: ellipsis;
  181. /* 显示省略号 */
  182. max-width: 120rpx;
  183. /* 6个中文字符大约占120rpx */
  184. }
  185. </style>