租房小程序前端代码
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.

194 lines
5.6 KiB

3 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
2 months ago
3 months ago
  1. <template>
  2. <view class="uv-page">
  3. <searchVue @onSearch="onSearch($event)" @onParent="onDropDown($event)" />
  4. <view class="se-pb-200">
  5. <view v-if="list.length>0">
  6. <view @click="onDetail(item)" class="se-my-10 se-mx-20 se-px-20 se-py-20 se-br-20 se-bgc-white se-flex" v-for="(item,index) in list" :key="index">
  7. <view class="se-pos se-w-260 se-h-180">
  8. <image v-if="item.iconImage" class="se-a-80 se-pos-lt" :src="item.iconImage" mode=""></image>
  9. <image class="se-w-260 se-h-180 se-br-10" :src="item.images[0]" mode=""></image>
  10. </view>
  11. <view class="se-pl-10 se-w-p-100">
  12. <view class="se-c-black se-fs-28">
  13. {{item.title}}
  14. </view>
  15. <view class="se-flex se-flex-h-sb se-flex-ai-c se-fs-24 se-mt-10 se-c-66">
  16. <text>{{item.homeType}}</text>
  17. <text>{{item.timeGo}}</text>
  18. </view>
  19. <view class="se-flex se-flex-h-sb se-flex-ai-c se-mt-10">
  20. <template v-if="item.iconTitles.length>0">
  21. <view class="se-flex">
  22. <view class="se-display-ib se-c-white se-bgc-orange se-fs-22 se-br-8 se-px-10 se-py-5 se-mr-10" v-for="(items,indexs) in item.iconTitles" :key="indexs">
  23. {{items}}
  24. </view>
  25. </view>
  26. </template>
  27. <template v-else><view></view></template>
  28. <view class="se-c-66 se-flex se-flex-ai-c">
  29. <uv-icon name="eye"></uv-icon>
  30. <text class="se-ml-5 se-fs-18">{{item.num}}</text>
  31. </view>
  32. </view>
  33. <view class="se-flex se-flex-h-sb se-flex-ai-c se-mt-10">
  34. <text class="se-c-red se-fs-24 se-fw-6 se-toe-1">{{item.price}}/{{item.unit}}</text>
  35. <text class="se-c-66 se-fs-22 se-toe-1">{{item.address}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view v-else>
  41. <uv-empty mode="list" ></uv-empty>
  42. </view>
  43. </view>
  44. <!-- <view class="se-my-10 se-mx-20 se-px-20 se-py-20 se-br-20 se-bgc-white se-flex" v-for="(item,index) in 20" :key="index">
  45. <view class="se-pos se-w-260 se-h-180">
  46. <image class="se-a-80 se-pos-lt" src="../../static/image/2x.png" mode=""></image>
  47. <image class="se-w-260 se-h-180 se-br-10" src="https://cdn.uviewui.com/uview/swiper/swiper1.png" mode=""></image>
  48. </view>
  49. <view class="se-pl-10 se-w-p-100">
  50. <view class="se-c-black se-fs-28">
  51. 整租·四季峰景四期 2室2厅1卫
  52. </view>
  53. <view class="se-flex se-flex-h-sb se-flex-ai-c se-fs-24 se-mt-10 se-c-66">
  54. <text>精装修</text>
  55. <text>1</text>
  56. </view>
  57. <view class="se-flex se-flex-h-sb se-flex-ai-c se-mt-10">
  58. <view class="se-display-ib se-c-white se-bgc-orange se-fs-22 se-br-8 se-px-10 se-py-5">
  59. 全新首租
  60. </view>
  61. <view class="se-c-66 se-flex se-flex-ai-c">
  62. <uv-icon name="eye"></uv-icon>
  63. <text class="se-ml-5 se-fs-18">999+</text>
  64. </view>
  65. </view>
  66. <view class="se-flex se-flex-h-sb se-flex-ai-c se-mt-10">
  67. <text class="se-c-red se-fs-28 se-fw-6">1500/</text>
  68. <text class="se-c-66 se-fs-22">四季峰景四期</text>
  69. </view>
  70. </view>
  71. </view> -->
  72. </view>
  73. </template>
  74. <script>
  75. import searchVue from './component/search.vue'
  76. import { housePageList } from "@/common/api.js"
  77. export default{
  78. components:{
  79. searchVue
  80. },
  81. data(){
  82. return{
  83. keyword:"",
  84. id:null,
  85. pageNo:1,
  86. pageSize:10,
  87. areaId:null,
  88. priceId:null,
  89. typeId:null,
  90. yearId:null,
  91. list:[]
  92. }
  93. },
  94. onLoad(options) {
  95. this.id = options.id
  96. uni.setNavigationBarTitle({
  97. title: options.title ? options.title :"分类"
  98. })
  99. this.onHousePageList()
  100. },
  101. onPullDownRefresh() {
  102. let that = this
  103. that.pageNo = 1
  104. that.list = []
  105. that.onHousePageList()
  106. },
  107. onReachBottom() {
  108. let that = this
  109. that.pageNo = that.pageNo + 1
  110. that.onHousePageList()
  111. },
  112. methods:{
  113. onHousePageList(){
  114. let that = this
  115. let params={
  116. iconClass:that.id,
  117. pageNo:that.pageNo,
  118. pageSize:that.pageSize,
  119. title:that.keyword,
  120. areaId:that.areaId,
  121. priceId:that.priceId,
  122. typeId:that.typeId,
  123. yearId:that.yearId
  124. }
  125. housePageList(params).then((response) => {
  126. console.info("responseindexsindexsindexs",response.result.records)
  127. response.result.records.forEach((items,indexs)=>{
  128. if(items.image){
  129. items.images = items.image.split(',')
  130. }else{
  131. items.images = []
  132. }
  133. if(items.homeImage){
  134. items.homeImages = items.homeImage.split(',')
  135. }else{
  136. items.homeImages = []
  137. }
  138. if(items.iconTitle){
  139. items.iconTitles = items.iconTitle.split(',')
  140. }else{
  141. items.iconTitles = []
  142. }
  143. })
  144. console.info('response.resultindexsindexsindexs',response.result.records)
  145. that.list = that.list.concat(response.result.records)
  146. }).catch((error) =>{
  147. })
  148. },
  149. onSearch(event){
  150. console.info('onSearch',event)
  151. // console.info(event)
  152. let that = this
  153. that.keyword = event
  154. that.list=[]
  155. that.onHousePageList()
  156. },
  157. onDropDown(event){
  158. console.info('onDropDown',event)
  159. let that = this
  160. that.areaId = null;
  161. that.priceId = null;
  162. that.typeId = null;
  163. that.yearId = null
  164. event.forEach(items=>{
  165. if(items.name=='region'){
  166. that.areaId = items.value
  167. }else if(items.name=='rent'){
  168. that.priceId = items.value
  169. }else if(items.name=='type'){
  170. that.typeId = items.value
  171. }else if(items.name=='duration'){
  172. that.yearId = items.value
  173. }
  174. })
  175. console.info('that.areaId',that.areaId)
  176. that.list=[]
  177. that.onHousePageList()
  178. },
  179. onDetail(event){
  180. uni.navigateTo({
  181. url:"/pages_subpack/detail/index?id="+event.id
  182. })
  183. }
  184. }
  185. }
  186. </script>
  187. <style>
  188. page{
  189. background-color: #f5f5f5;
  190. }
  191. </style>