details.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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. <!-- <up-loadmore bg-color="rgb(240, 240, 240)" :status="loadStatus" @loadmore="addRandomData"></up-loadmore> -->
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script setup>
  76. import {
  77. ref,
  78. onMounted,
  79. reactive
  80. } from 'vue';
  81. import volunteerSide from "@/pages/Volunteerside/Side_index.vue"
  82. import {
  83. typeOptionSelect,
  84. volunteerInfoList,
  85. getDetailsvolunteerId,
  86. dictListlrRstudy,
  87. dictListlrData
  88. } from "@/api/volunteerDetailsApi/details.js"
  89. const value1 = ref(1)
  90. const value2 = ref(2)
  91. const list1 = ref([])
  92. const list2 = ref([])
  93. const list3 = ref([])
  94. const flowList = ref([]); //list数据
  95. const listData = ref([])
  96. const rightList = ref([])
  97. const defaultTab = ref({
  98. dictValue: 1
  99. });
  100. const showDropdown = ref(false)
  101. function toggleDropdown() {
  102. console.log("点击了")
  103. showDropdown.value = !showDropdown.value
  104. }
  105. const getListData = async (dictSort = null) => {
  106. try {
  107. const params = {
  108. pageNum: 1,
  109. pageSize: 10,
  110. dictType: 'lrr_service_category',
  111. dictSort
  112. }
  113. const res = await typeOptionSelect(params)
  114. console.log((res, '获取健值成功'))
  115. if (res.code == 200 && res.rows) {
  116. list1.value = res.rows.map(item => ({
  117. ...item,
  118. name: item.dictLabel,
  119. }))
  120. }
  121. } catch (e) {
  122. console.log('获取失败')
  123. }
  124. }
  125. const getListData2 = async () => {
  126. try {
  127. const params = {
  128. dictType: 'lrr_service_subject',
  129. }
  130. const res = await dictListlrRstudy(params)
  131. if (res.code == 200 && res.rows) {
  132. list2.value = res.rows.map(item => ({
  133. ...item,
  134. name: item.dictLabel,
  135. }))
  136. }
  137. } catch (e) {
  138. console.log('获取失败')
  139. }
  140. }
  141. const getListData3 = async () => {
  142. try {
  143. const params = {
  144. dictType: 'lrr_study',
  145. }
  146. const res = await dictListlrData(params)
  147. if (res.code == 200 && res.rows) {
  148. list3.value = res.rows.map(item => ({
  149. ...item,
  150. name: item.dictLabel,
  151. }))
  152. }
  153. } catch (e) {
  154. console.log('获取失败')
  155. }
  156. }
  157. // tabs选择服务类型
  158. const handlTabs = async (tab) => {
  159. const params = {
  160. serviceCategory: tab.dictValue
  161. }
  162. const res = await volunteerInfoList(params)
  163. // 处理左右数据展示
  164. let leftArr = []
  165. let rightArr = []
  166. console.log(res.data, '>>>res.data');
  167. (res.data || []).forEach((item, index) => {
  168. index % 2 != 0 ? leftArr.push(item) : rightArr.push(item)
  169. })
  170. listData.value = leftArr
  171. rightList.value = rightArr
  172. }
  173. const goToDetail = async (item) => {
  174. const volunteerId = item.volunteerId;
  175. uni.navigateTo({
  176. url: `/pages/goodsDetails/goodsDetails?volunteerId=${volunteerId}`
  177. });
  178. }
  179. const inputStyle = { //input輸入框樣式設置
  180. borderRadius: '140rpx',
  181. border: '1rpx solid #ccc',
  182. height: '70rpx',
  183. paddingLeft: '30rpx',
  184. width: '600rpx',
  185. }
  186. onMounted(() => {
  187. getListData()
  188. getListData2()
  189. getListData3()
  190. handlTabs(defaultTab.value)
  191. })
  192. </script>
  193. <style scoped>
  194. .Wrapper {
  195. display: flex;
  196. align-items: center;
  197. gap: 10rpx;
  198. }
  199. .Wrapper-img {
  200. width: 50rpx;
  201. height: 50rpx;
  202. margin-left: 10rpx;
  203. }
  204. .Wrapper-content {
  205. color: rgba(16, 16, 16, 1);
  206. font-size: 25rpx;
  207. font-family: PingFangSC-regular;
  208. line-height: 20rpx;
  209. }
  210. /* 外层容器 */
  211. .tabs-container {
  212. width: 100%;
  213. background: #fff;
  214. padding: 10px 0;
  215. }
  216. /* Flex 布局容器 */
  217. .tabs-wrapper {
  218. display: flex;
  219. align-items: center;
  220. position: relative;
  221. }
  222. /* 可横向滚动的 scroll-view */
  223. .tabs-scroll {
  224. flex: 1;
  225. /* 占据剩余空间 */
  226. overflow-x: auto;
  227. /* 允许横向滚动 */
  228. white-space: nowrap;
  229. /* 禁止换行 */
  230. -webkit-overflow-scrolling: touch;
  231. /* iOS 平滑滚动 */
  232. }
  233. /* 隐藏滚动条(可选) */
  234. .tabs-scroll::-webkit-scrollbar {
  235. display: none;
  236. }
  237. /* 固定图标(始终显示在右侧) */
  238. .fixed-icon {
  239. width: 30px;
  240. height: 30px;
  241. margin-left: 10px;
  242. /* 与 tabs 的间距 */
  243. flex-shrink: 0;
  244. /* 禁止压缩 */
  245. }
  246. .demo-warter {
  247. border-radius: 8px;
  248. margin: 5px;
  249. background-color: #ffffff;
  250. padding: 5px;
  251. }
  252. .u-close {
  253. position: absolute;
  254. top: 32rpx;
  255. right: 32rpx;
  256. }
  257. .demo-image {
  258. width: 100%;
  259. border-radius: 4px;
  260. }
  261. .demo-title {
  262. font-size: 30rpx;
  263. margin-top: 5px;
  264. color: $up-main-color;
  265. margin-left: 15rpx;
  266. display: -webkit-box;
  267. -webkit-box-orient: vertical;
  268. -webkit-line-clamp: 2;
  269. /* 限制显示两行 */
  270. overflow: hidden;
  271. text-overflow: ellipsis;
  272. /* 超出部分显示省略号 */
  273. word-break: break-all;
  274. }
  275. .demo-img {
  276. width: 40rpx;
  277. height: 40rpx;
  278. border-radius: 50%;
  279. }
  280. .demo-PriceDome {
  281. display: flex;
  282. font-size: 30rpx;
  283. color: $up-type-error;
  284. /* margin-top: 5px; */
  285. margin-top: 20rpx;
  286. }
  287. .demo-price {
  288. display: flex;
  289. }
  290. .name-image {
  291. width: 40rpx;
  292. height: 40rpx;
  293. }
  294. .dome-Like {
  295. margin-left: 120rpx;
  296. display: flex;
  297. justify-content: center;
  298. align-items: center;
  299. }
  300. </style>