news.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view class="newHouses">
  3. <view class="newHouses-bg"></view>
  4. <view class="renqi-box u-flex">
  5. <u-icon name="heart-fill" color="#fff" size="26"></u-icon>
  6. <text class="text">累计人气值 {{popularity}}</text>
  7. </view>
  8. <view class="swiper-box">
  9. <u-swiper :list="swiperlisi" height="376" name="logo" @click="tobanner" border-radius="20"></u-swiper>
  10. </view>
  11. <view class="newHouses-list">
  12. <view class="newHouses-title u-flex u-row-between">
  13. <text>全部楼盘</text>
  14. <image src="../../static/images/shaixuan.png" @click="opensearch" mode=""></image>
  15. </view>
  16. <view class="u-flex u-row-between u-flex-wrap">
  17. <view v-for="(item,index) in list" :key="index">
  18. <gf-goods :data="item"></gf-goods>
  19. </view>
  20. </view>
  21. </view>
  22. <gf-search ref="search" @shaixuan="shaixuan"></gf-search>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. mapState,
  28. mapActions,
  29. mapMutations,
  30. mapGetters
  31. } from 'vuex'
  32. export default {
  33. data() {
  34. return {
  35. title: '',
  36. swiperlisi: [],
  37. page: 1,
  38. list: [],
  39. params: {}
  40. }
  41. },
  42. onLoad(options) {
  43. this.title = options.title
  44. this.getlist()
  45. this.getbanner()
  46. },
  47. onShow() {
  48. if(this.title!=''){
  49. uni.setNavigationBarTitle({
  50. title: this.title //这是修改后的导航栏文字
  51. })
  52. }
  53. },
  54. computed: {
  55. ...mapState(["popularity"])
  56. },
  57. onReachBottom() {
  58. if (this.list.length % 20 == 0) {
  59. this.page++
  60. this.getlist()
  61. }
  62. },
  63. methods: {
  64. shaixuan(e) {
  65. this.params = e
  66. this.page = 1
  67. this.list = []
  68. this.getlist()
  69. },
  70. tobanner(e) {
  71. if (this.swiperlisi[e].url) {
  72. uni.navigateTo({
  73. url: this.swiperlisi[e].url
  74. })
  75. }
  76. },
  77. getbanner() {
  78. this.$u.post('/api/Index/banner', {
  79. location: 2
  80. }).then(res => {
  81. this.swiperlisi = res.data
  82. })
  83. },
  84. getlist() {
  85. console.log(this.params);
  86. this.$u.post('/api/Index/property_list', {
  87. page: this.page,
  88. page_num: 20,
  89. cate_name: this.title,
  90. ...this.params
  91. }).then(res => {
  92. this.list = this.list.concat(res.data)
  93. })
  94. },
  95. opensearch() {
  96. this.$refs.search.show = true
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. page {
  103. background-color: #F6F6F6;
  104. }
  105. .newHouses {
  106. position: relative;
  107. z-index: 1;
  108. .newHouses-list {
  109. width: 702rpx;
  110. background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 38%, rgba(255, 255, 255, 0) 100%);
  111. border-radius: 20rpx;
  112. margin: 20rpx auto;
  113. padding: 0 20rpx;
  114. .newHouses-title {
  115. padding: 20rpx 0;
  116. text {
  117. font-size: 34rpx;
  118. font-family: PingFangSC-Medium, PingFang SC;
  119. font-weight: 500;
  120. color: #131415;
  121. }
  122. image {
  123. width: 32rpx;
  124. height: 32rpx;
  125. }
  126. }
  127. }
  128. .swiper-box {
  129. padding: 0 24rpx;
  130. margin-bottom: 20rpx;
  131. }
  132. .renqi-box {
  133. width: 750rpx;
  134. height: 56rpx;
  135. background: rgba(256, 256, 256, 0.1);
  136. padding: 0 24rpx;
  137. margin-bottom: 24rpx;
  138. .text {
  139. font-size: 24rpx;
  140. font-family: Helvetica;
  141. color: #FFFFFF;
  142. margin-left: 10rpx;
  143. }
  144. }
  145. .newHouses-bg {
  146. position: absolute;
  147. top: 0;
  148. left: 0;
  149. width: 750rpx;
  150. height: 556rpx;
  151. background: linear-gradient(180deg, #1E7DFF 0%, #F6F6F6 100%);
  152. z-index: -1;
  153. }
  154. }
  155. </style>