searchlist.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="search-list">
  3. <mescroll-empty v-if="projectList.length == 0 && houseList.length == 0">>
  4. </mescroll-empty>
  5. <view class="search-top" v-if="projectList.length > 0">
  6. <swiper class="swiper" circular :indicator-dots="true">
  7. <swiper-item v-for="(item,index) in projectList" :key="item.id">
  8. <view class="project-item" @click="$navigateTo('/pages/project/project?projectId='+item.id)">
  9. <view class="title">
  10. <view class="name">{{item.name}}</view>
  11. </view>
  12. <image class="image"
  13. src="https://assets.api.uizard.io/api/cdn/stream/0ba939e8-082b-42f9-a314-be3e195b3b25.png"
  14. mode="aspectFill">
  15. </image>
  16. </view>
  17. </swiper-item>
  18. </swiper>
  19. </view>
  20. <view class="house-list" v-if="houseList.length > 0">
  21. <house-item v-for="(item,index) in houseList" :house="item" :key="item.id"></house-item>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import houseItem from "@/components/house/houseItem.vue";
  27. import {
  28. search
  29. } from '@/request/api/house.js'
  30. export default {
  31. data() {
  32. return {
  33. houseList: [],
  34. projectList: [],
  35. searchValue: ''
  36. }
  37. },
  38. onLoad(body) {
  39. this.searchValue = body.searchValue;
  40. this.init();
  41. },
  42. methods: {
  43. init() {
  44. search(this.searchValue).then(res => {
  45. if (res.code === 200) {
  46. let data = res.data;
  47. this.projectList = data.projectList;
  48. this.houseList = data.houseList;
  49. }
  50. })
  51. }
  52. },
  53. components: {
  54. houseItem
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. .search-list {
  60. .search-top {
  61. padding: 30rpx 30rpx 0rpx 30rpx;
  62. .swiper {
  63. border-radius: 16rpx;
  64. overflow: hidden;
  65. height: 400rpx;
  66. }
  67. .project-item {
  68. height: 100%;
  69. background: #fff;
  70. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  71. .title {
  72. display: flex;
  73. padding: 20rpx 30rpx;
  74. align-items: center;
  75. }
  76. .name {
  77. font-weight: bold;
  78. font-size: 32rpx;
  79. flex: 1;
  80. width: 0;
  81. overflow: hidden;
  82. }
  83. .to {
  84. border: 1px solid $uni-primary;
  85. width: 160rpx;
  86. height: 60rpx;
  87. text-align: center;
  88. line-height: 60rpx;
  89. font-size: 24rpx;
  90. border-radius: 60rpx;
  91. color: $uni-primary;
  92. }
  93. .image {
  94. height: 300rpx;
  95. }
  96. }
  97. }
  98. .house-list {
  99. padding: 30rpx;
  100. }
  101. }
  102. </style>