瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.4 KiB

9 months ago
8 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
  1. <template>
  2. <view class="page pageList">
  3. <navbar title="景点" leftClick @leftClick="$utils.navigateBack" />
  4. <view style="padding: 10rpx 30rpx;">
  5. <uv-search bgColor="#fff" @search="getData" :showAction="false" searchIconSize="30rpx"
  6. placeholder="请输入搜索关键字..." v-model="queryParams.title"></uv-search>
  7. </view>
  8. <view class="">
  9. <screenRen @clickItem="clickItem" />
  10. </view>
  11. <view class="waterfall">
  12. <uv-waterfall ref="waterfall" v-model="list"
  13. :add-time="10"
  14. :left-gap="leftGap"
  15. :right-gap="rightGap"
  16. :column-gap="columnGap"
  17. @changeList="changeList">
  18. <!-- 第一列数据 -->
  19. <template v-slot:list1>
  20. <!-- 为了磨平部分平台的BUG必须套一层view -->
  21. <view>
  22. <view v-for="(item, index) in list1" :key="item.id" class="waterfall-item"
  23. @click="$utils.navigateTo('/pages_order/scenicSpot/scenicSpotDetail?id=' + item.id)">
  24. <view class="waterfall-item__image" :style="[imageStyle(item)]">
  25. <image :src="item.titleImage" mode="widthFix" :style="{width:item.width+'px'}"></image>
  26. </view>
  27. <view class="waterfall-item__ft">
  28. <view class="waterfall-item__ft__title">
  29. <text class="value">{{item.name}}</text>
  30. </view>
  31. <view class="waterfall-item__ft__desc uv-line-2">
  32. <text class="value">{{item.address}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <!-- 第二列数据 -->
  39. <template v-slot:list2>
  40. <!-- 为了磨平部分平台的BUG必须套一层view -->
  41. <view>
  42. <view v-for="(item, index) in list2" :key="item.id" class="waterfall-item"
  43. @click="$utils.navigateTo('/pages_order/scenicSpot/scenicSpotDetail?id=' + item.id)">
  44. <view class="waterfall-item__image" :style="[imageStyle(item)]">
  45. <image :src="item.titleImage" mode="widthFix" :style="{width:item.width+'px'}"></image>
  46. </view>
  47. <view class="waterfall-item__ft">
  48. <view class="waterfall-item__ft__title">
  49. <text class="value">{{item.name}}</text>
  50. </view>
  51. <view class="waterfall-item__ft__desc uv-line-2">
  52. <text class="value">{{item.address}}</text>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. </uv-waterfall>
  59. </view>
  60. <!-- <view class="list">
  61. <scenicSpotItem
  62. :key="index"
  63. v-for="(item, index) in list"
  64. :item="item"
  65. @click="$utils.navigateTo('/pages_order/scenicSpot/scenicSpotDetail?id=' + item.id)"
  66. />
  67. </view> -->
  68. </view>
  69. </template>
  70. <script>
  71. import mixinsList from '@/mixins/list.js'
  72. import screenRen from '../components/screen/screenRen.vue'
  73. import scenicSpotItem from '../components/list/scenicSpot/scenicSpotItem.vue'
  74. import { guid } from '@/uni_modules/uv-ui-tools/libs/function/index.js'
  75. export default {
  76. mixins: [mixinsList],
  77. components: {
  78. scenicSpotItem,
  79. screenRen,
  80. },
  81. data() {
  82. return {
  83. mixinsListApi: 'getScenicPage',
  84. list: [], // 瀑布流全部数据
  85. list1: [], // 瀑布流第一列数据
  86. list2: [], // 瀑布流第二列数据
  87. leftGap: 10,
  88. rightGap: 10,
  89. columnGap: 10
  90. }
  91. },
  92. computed: {
  93. imageStyle(item) {
  94. return item => {
  95. const v = uni.upx2px(750) - this.leftGap - this.rightGap - this.columnGap;
  96. const w = v / 2;
  97. const rate = w / item.w;
  98. const h = rate * item.h;
  99. return {
  100. width: w + 'px',
  101. height: h + 'px'
  102. }
  103. }
  104. }
  105. },
  106. methods: {
  107. clickItem(result) {
  108. this.queryParams = {
  109. pageNo: 1,
  110. pageSize: 10,
  111. }
  112. result.forEach(n => {
  113. this.queryParams[n.name] = n.value
  114. })
  115. this.getData()
  116. },
  117. // 这点非常重要:e.name在这里返回是list1或list2,要手动将数据追加到相应列
  118. changeList(e) {
  119. this[e.name].push(e.value);
  120. },
  121. }
  122. }
  123. </script>
  124. <style scoped lang="scss">
  125. .page {
  126. background-color: #fff;
  127. .list {
  128. padding: 0 20rpx;
  129. }
  130. }
  131. $show-lines: 1;
  132. @import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
  133. .waterfall-item {
  134. overflow: hidden;
  135. margin-top: 20rpx;
  136. border-radius: 12rpx;
  137. box-shadow: 0 0 6rpx 6rpx #00000009;
  138. }
  139. .waterfall-item__ft {
  140. padding: 20rpx;
  141. background: #fff;
  142. &__title {
  143. margin-bottom: 10rpx;
  144. line-height: 48rpx;
  145. font-weight: 700;
  146. .value {
  147. font-size: 32rpx;
  148. color: #303133;
  149. }
  150. }
  151. &__desc .value {
  152. font-size: 28rpx;
  153. color: #606266;
  154. }
  155. &__btn {
  156. padding: 20rpx 0;
  157. }
  158. }
  159. </style>