services.vue 5.7 KB

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