houseItems.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="house-items">
  3. <view class="house-image">
  4. <image class="image" :src="imageUrl(house.showPicture)" mode="aspectFill">
  5. </image>
  6. </view>
  7. <view class="house-content">
  8. <view class="title">{{house.name}}</view>
  9. <view class="space">
  10. {{house.projectName}}/{{house.projectItemName}}/{{house.projectItemTargetName}}/{{house.roomNumber}}
  11. </view>
  12. <view class="tag">
  13. <text style="margin-right: 6rpx;">{{house.area}}m²</text>
  14. <text v-for="(tag,index) in house.tagList" :key="index"> | {{tag.name}}</text>
  15. </view>
  16. <view class="pirce">
  17. <text class="number">{{house.price}}</text>
  18. <text class="label">/月</text>
  19. </view>
  20. <view class="house-btn" @click="$navigateTo('/pages/house/house?houseId=' + house.id)">
  21. 查看房源
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. props: {
  29. house: {
  30. type: Object,
  31. default: () => {
  32. return {}
  33. }
  34. },
  35. },
  36. data() {
  37. return {}
  38. },
  39. methods: {
  40. imageUrl(data) {
  41. if (!data) return 'https://assets.api.uizard.io/api/cdn/stream/c05650d2-192b-4a56-ae97-05638f53804c.png';
  42. return JSON.parse(data)[0].url;
  43. }
  44. },
  45. }
  46. </script>
  47. <style lang="scss">
  48. .house-items {
  49. width: 100%;
  50. padding: 30rpx;
  51. background: #fff;
  52. border-radius: 16rpx;
  53. box-sizing: border-box;
  54. position: relative;
  55. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  56. margin-bottom: 30rpx;
  57. .house-level {
  58. position: absolute;
  59. top: 50rpx;
  60. right: 50rpx;
  61. color: $uni-warning;
  62. font-weight: bold;
  63. background: rgba(255, 255, 255, 0.7);
  64. width: 80rpx;
  65. text-align: center;
  66. height: 40rpx;
  67. line-height: 40rpx;
  68. border-radius: 40rpx;
  69. }
  70. .house-image {
  71. height: 300rpx;
  72. width: 100%;
  73. overflow: hidden;
  74. border-radius: 8px;
  75. }
  76. .title {
  77. font-size: 32rpx;
  78. font-weight: 500;
  79. padding: 20rpx 0 10rpx 0;
  80. }
  81. .space {
  82. font-weight: 300;
  83. color: $uni-secondary-color;
  84. }
  85. .tag {
  86. font-size: 24rpx;
  87. font-weight: 300;
  88. color: $uni-secondary-color;
  89. padding: 12rpx 0;
  90. }
  91. .pirce {
  92. color: $uni-primary;
  93. .number {
  94. font-weight: 600;
  95. font-size: 48rpx;
  96. }
  97. .label {
  98. font-size: 24rpx;
  99. }
  100. }
  101. .house-btn {
  102. background: $uni-primary;
  103. height: 68rpx;
  104. text-align: center;
  105. line-height: 68rpx;
  106. color: #ffffff;
  107. border-radius: 68rpx;
  108. margin-top: 30rpx;
  109. }
  110. }
  111. </style>