details.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <view style="padding-top: 20rpx; width: 100vw; height: 100vh; overflow: hidden">
  3. <view style="width: 100%; height: 100%; overflow:scroll">
  4. <view class="Wrapper">
  5. <image src="/static/img/Location.png" class="Wrapper-img" />
  6. <span class="Wrapper-content">重庆</span>
  7. <vie class="input-container">
  8. <up-input v-model="value" @click.native="goToDetail" placeholder="请输入内容" prefixIcon="search"
  9. :customStyle="inputStyle"></up-input>
  10. </vie>
  11. </view>
  12. <view class="tabs-container">
  13. <view class="tabs-wrapper">
  14. <!-- 可滑动的 tabs 区域 -->
  15. <scroll-view scroll-x class="tabs-scroll">
  16. <up-tabs :list="list1" @click="handlTabs" class="tabs-content"></up-tabs>
  17. </scroll-view>
  18. <!-- 固定不动的图标 -->
  19. <image ref="iconRef" src="/static/img/分类or广场or其他.png" class="fixed-icon" @click="toggleDropdown" />
  20. </view>
  21. <view v-if="showDropdown" class="custom-dropdown">
  22. <up-tabs :list="list2" @click="click" class="tabs-content" />
  23. <up-tabs :list="list3" @click="click" class="tabs-content" />
  24. </view>
  25. </view>
  26. <!-- 瀑布流 -->
  27. <view>
  28. <up-waterfall v-model="flowList">
  29. <template #left :listData="listData">
  30. <view class="demo-warter" v-for="(item, index) in listData" :key="index"
  31. @click="goToDetail(item)">
  32. <up-lazy-load threshold="-450" border-radius="10" :image="item.image"
  33. :index="index"></up-lazy-load>
  34. <view class="demo-title">
  35. {{item.skillDescribe}}
  36. </view>
  37. <view class="demo-PriceDome">
  38. <view class="demo-price">
  39. <image src="../../static/用户.png" class="name-image"></image>
  40. {{item.name}}
  41. </view>
  42. <view class="dome-Like">
  43. <text style="font-size: 25rpx; color: red;">¥</text>
  44. <text style="font-size: 35rpx; color: red;">1.4w</text>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <template #right :rightList="rightList">
  50. <view class="demo-warter" v-for="(item, index) in rightList" :key="index"
  51. @click="goToDetail(item)">
  52. <up-lazy-load threshold="-450" border-radius="10" :image="item.image"
  53. :index="index"></up-lazy-load>
  54. <view class="demo-title">
  55. {{item.skillDescribe}}
  56. </view>
  57. <view class="demo-PriceDome">
  58. <view class="demo-price">
  59. <image src="../../static/用户.png" class="name-image"></image>
  60. {{item.name}}
  61. </view>
  62. <view class="dome-Like">
  63. <text style="font-size: 25rpx; color: red;">¥</text>
  64. <text style="font-size: 35rpx; color: red;">1.4w</text>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. </up-waterfall>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script setup>
  75. import {
  76. ref,
  77. onMounted,
  78. reactive
  79. } from 'vue';
  80. import volunteerSide from "@/pages/Volunteerside/Side_index.vue"
  81. import {
  82. typeOptionSelect,
  83. volunteerInfoList,
  84. getDetailsvolunteerId,
  85. dictListlrRstudy,
  86. dictListlrData
  87. } from "@/api/volunteerDetailsApi/details.js"
  88. import {
  89. useRoute
  90. } from 'vue-router';
  91. const value1 = ref(1)
  92. const value2 = ref(2)
  93. const list1 = ref([])
  94. const list2 = ref([])
  95. const list3 = ref([])
  96. const flowList = ref([]); //list数据
  97. const listData = ref([])
  98. const rightList = ref([])
  99. const defaultTab = ref({
  100. dictValue: 1
  101. });
  102. // 获取当前路由对象
  103. const route = useRoute();
  104. // 存储服务名称
  105. const serviceName = ref('');
  106. const showDropdown = ref(false)
  107. function toggleDropdown() {
  108. console.log("点击了")
  109. showDropdown.value = !showDropdown.value
  110. }
  111. const getListData = async (dictSort = null) => {
  112. try {
  113. const params = {
  114. pageNum: 1,
  115. pageSize: 10,
  116. dictType: 'lrr_service_category',
  117. dictSort
  118. }
  119. const res = await typeOptionSelect(params)
  120. console.log((res, '获取健值成功'))
  121. if (res.code == 200 && res.rows) {
  122. list1.value = res.rows.map(item => ({
  123. ...item,
  124. name: item.dictLabel,
  125. }))
  126. }
  127. } catch (e) {
  128. console.log('获取失败')
  129. }
  130. }
  131. const getListData2 = async () => {
  132. try {
  133. const params = {
  134. dictType: 'lrr_service_subject',
  135. }
  136. const res = await dictListlrRstudy(params)
  137. if (res.code == 200 && res.rows) {
  138. list2.value = res.rows.map(item => ({
  139. ...item,
  140. name: item.dictLabel,
  141. }))
  142. }
  143. } catch (e) {
  144. console.log('获取失败')
  145. }
  146. }
  147. const getListData3 = async () => {
  148. try {
  149. const params = {
  150. dictType: 'lrr_study',
  151. }
  152. const res = await dictListlrData(params)
  153. if (res.code == 200 && res.rows) {
  154. list3.value = res.rows.map(item => ({
  155. ...item,
  156. name: item.dictLabel,
  157. }))
  158. }
  159. } catch (e) {
  160. console.log('获取失败')
  161. }
  162. }
  163. // tabs选择服务类型
  164. const handlTabs = async (tab) => {
  165. const params = {
  166. serviceCategory: tab.dictValue
  167. }
  168. const res = await volunteerInfoList(params)
  169. // 处理左右数据展示
  170. let leftArr = []
  171. let rightArr = []
  172. console.log(res.data, '>>>res.data');
  173. (res.data || []).forEach((item, index) => {
  174. index % 2 != 0 ? leftArr.push(item) : rightArr.push(item)
  175. })
  176. listData.value = leftArr
  177. rightList.value = rightArr
  178. }
  179. const goToDetail = async (item) => {
  180. const volunteerId = item.volunteerId;
  181. uni.navigateTo({
  182. url: `/pages/goodsDetails/goodsDetails?volunteerId=${volunteerId}`
  183. });
  184. }
  185. const inputStyle = { //input輸入框樣式設置
  186. borderRadius: '140rpx',
  187. border: '1rpx solid #ccc',
  188. height: '70rpx',
  189. paddingLeft: '30rpx',
  190. width: '600rpx',
  191. }
  192. onMounted(() => {
  193. if (route && route.query && route.query.name) {
  194. serviceName.value = decodeURIComponent(route.query.name); // 解码参数
  195. console.log(serviceName.value, '111112333');
  196. }
  197. getListData()
  198. getListData2()
  199. getListData3()
  200. handlTabs(defaultTab.value)
  201. })
  202. </script>
  203. <style scoped>
  204. .Wrapper {
  205. display: flex;
  206. align-items: center;
  207. gap: 10rpx;
  208. }
  209. .Wrapper-img {
  210. width: 50rpx;
  211. height: 50rpx;
  212. margin-left: 10rpx;
  213. }
  214. .Wrapper-content {
  215. color: rgba(16, 16, 16, 1);
  216. font-size: 25rpx;
  217. font-family: PingFangSC-regular;
  218. line-height: 20rpx;
  219. }
  220. /* 外层容器 */
  221. .tabs-container {
  222. width: 100%;
  223. background: #fff;
  224. padding: 10px 0;
  225. }
  226. /* Flex 布局容器 */
  227. .tabs-wrapper {
  228. display: flex;
  229. align-items: center;
  230. position: relative;
  231. }
  232. /* 可横向滚动的 scroll-view */
  233. .tabs-scroll {
  234. flex: 1;
  235. /* 占据剩余空间 */
  236. overflow-x: auto;
  237. /* 允许横向滚动 */
  238. white-space: nowrap;
  239. /* 禁止换行 */
  240. -webkit-overflow-scrolling: touch;
  241. /* iOS 平滑滚动 */
  242. }
  243. /* 隐藏滚动条(可选) */
  244. .tabs-scroll::-webkit-scrollbar {
  245. display: none;
  246. }
  247. /* 固定图标(始终显示在右侧) */
  248. .fixed-icon {
  249. width: 30px;
  250. height: 30px;
  251. margin-left: 10px;
  252. /* 与 tabs 的间距 */
  253. flex-shrink: 0;
  254. /* 禁止压缩 */
  255. }
  256. .demo-warter {
  257. border-radius: 8px;
  258. margin: 5px;
  259. background-color: #ffffff;
  260. padding: 5px;
  261. }
  262. .u-close {
  263. position: absolute;
  264. top: 32rpx;
  265. right: 32rpx;
  266. }
  267. .demo-image {
  268. width: 100%;
  269. border-radius: 4px;
  270. }
  271. .demo-title {
  272. font-size: 30rpx;
  273. margin-top: 5px;
  274. color: $up-main-color;
  275. margin-left: 15rpx;
  276. display: -webkit-box;
  277. -webkit-box-orient: vertical;
  278. -webkit-line-clamp: 2;
  279. /* 限制显示两行 */
  280. overflow: hidden;
  281. text-overflow: ellipsis;
  282. /* 超出部分显示省略号 */
  283. word-break: break-all;
  284. }
  285. .demo-img {
  286. width: 40rpx;
  287. height: 40rpx;
  288. border-radius: 50%;
  289. }
  290. .demo-PriceDome {
  291. display: flex;
  292. font-size: 30rpx;
  293. color: $up-type-error;
  294. /* margin-top: 5px; */
  295. margin-top: 20rpx;
  296. }
  297. .demo-price {
  298. display: flex;
  299. }
  300. .name-image {
  301. width: 40rpx;
  302. height: 40rpx;
  303. }
  304. .dome-Like {
  305. margin-left: 140rpx;
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. }
  310. </style>