兼兼街租房小程序
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.

484 lines
10 KiB

  1. <template>
  2. <view class="container">
  3. <view class="ant-banner-box">
  4. <image class="ant-banner" mode="scaleToFill" :src="bannerList[3].image"/>
  5. <view class="ant-title">
  6. <p>一个有温度的家</p>
  7. <p class="ant-font-24">超多房源等你来挑</p>
  8. </view>
  9. </view>
  10. <view class="ant-float">
  11. <view class="ant-flex-line">
  12. <view class="ant-select">江华</view>
  13. <!-- <input class="ant-input" value="" placeholder="试试输入你想住的地点"/> -->
  14. </view>
  15. </view>
  16. <view class="ant-menu-card">
  17. <view class="ant-flex-line">
  18. <view class="ant-icon-menu">
  19. <view class="ant-icon">
  20. <image :src="image"></image>
  21. </view>
  22. <view class="ant-text">整租</view>
  23. </view>
  24. <view class="ant-icon-menu">
  25. <view class="ant-icon">
  26. <image :src="image"></image>
  27. </view>
  28. <view class="ant-text">新房源</view>
  29. </view>
  30. <view class="ant-icon-menu">
  31. <view class="ant-icon">
  32. <image :src="image"></image>
  33. </view>
  34. <view class="ant-text">合租</view>
  35. </view>
  36. <view class="ant-icon-menu">
  37. <view class="ant-icon">
  38. <image :src="image"></image>
  39. </view>
  40. <view class="ant-text">转租</view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="ant-content">
  45. <view class="ant-content-page">
  46. <view class="ant-flex-line">
  47. <view class="ant-page-title">好房源</view>
  48. <view class="ant-page-span">平台甄选</view>
  49. <view class="ant-page-span">品质保障</view>
  50. </view>
  51. <view class="ant-flex-line">
  52. <view class="ant-page-image-item" v-for="(item,index) in hotList">
  53. <image class="ant-page-image-item" mode="aspectFill" :src="item.image === null? image:item.image"/>
  54. <view class="ant-img-tags">
  55. <!-- <view class="ant-tags-title">{{item.title}}</view> -->
  56. <view class="ant-tags-text">{{item.price}}元起</view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="ant-content-page">
  62. <view class="ant-flex-line ant-head-line" @click="test">
  63. <view class="ant-page-title">推荐房源</view>
  64. </view>
  65. <view class="ant-item-box" v-for="(item,index) in list" >
  66. <view>
  67. <image class="ant-item-image" mode="aspectFill"
  68. :src="item.image === null? image:item.image"/>
  69. </view>
  70. <view class="ant-item-content">
  71. <view class="ant-item-title">{{item.title}}</view>
  72. <view class="ant-item-span">{{item.titleText}}</view>
  73. <view class="ant-item-span">{{item.address}}</view>
  74. <view class="ant-item-span"><span>{{item.payType}}</span></view>
  75. <view class="ant-item-price">{{item.price}} <span>/</span></view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="content-end">
  81. <view class="line"/>
  82. <view class="center">湖南瀚海黎明·技术支持</view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. export default{
  88. data(){
  89. return{
  90. image:"https://vrlab-image4.ljcdn.com/release/auto3dhd/eba09229a901cb5cba66fda38f281405/screenshot/1657677701_15/pc0_m7ks1AA5Y.jpg?imageMogr2/quality/70/thumbnail/1024x",
  91. bannerList:[],
  92. addressList:[],
  93. classList:[],
  94. hotList:[],
  95. list:[],
  96. lock: true,
  97. size: 20,
  98. page: 1,
  99. total: null,
  100. is_pull: 1, // 1是下拉刷新 2是上拉加载
  101. }
  102. },
  103. onLoad() {
  104. this.getBannerList();
  105. this.getAddressList();
  106. this.getClassList();
  107. this.getHotList();
  108. this.getHouseListPage();
  109. },
  110. // 下拉刷新首页推荐房源
  111. onPullDownRefresh() {
  112. this.is_pull = 1;
  113. this.getHouseListPage()
  114. },
  115. // 上拉加载
  116. onReachBottom() {
  117. this.is_pull = 2;
  118. // 写下限制重复发 以及最后一页
  119. this.getHouseListPage()
  120. },
  121. // 隐藏微信h5的标题栏
  122. onReady() {
  123. },
  124. methods:{
  125. //获取轮播图
  126. getBannerList(){
  127. // this.getBannerList()
  128. this.$api.getBannerList().then(res => {
  129. this.bannerList = res.result;
  130. }).catch(err => {
  131. console.log(err,"错误信息")
  132. });
  133. // this.$request('/job-dev/house/applet/banner',{},'GET', (res) => {
  134. // this.bannerList = res;
  135. // console.log("111111")
  136. // console.log(res[0].image)
  137. // })
  138. },
  139. //获取地区
  140. getAddressList(){
  141. this.$api.getAddressList().then(res => {
  142. this.addressList = res.result;
  143. }).catch(err => {
  144. console.log(err,"错误信息")
  145. });
  146. // this.$request('/job-dev/house/applet/indexListPage',{},'GET', (res) => {
  147. // this.addressList = res.records;
  148. // console.log(res.records)
  149. // })
  150. },
  151. //获取分类
  152. getClassList(){
  153. this.$api.getClassList().then(res => {
  154. this.classList = res.result;
  155. }).catch(err => {
  156. console.log(err,"错误信息")
  157. });
  158. // this.$request('/job-dev/house/applet/indexClass',{},'GET', (res) => {
  159. // this.classList = res.records;
  160. // console.log(res.records)
  161. // })
  162. },
  163. //获取好房源
  164. getHotList(){
  165. this.$api.getHotList().then(res => {
  166. this.hotList = res.result.records;
  167. }).catch(err => {
  168. console.log(err,"错误信息")
  169. });
  170. // this.$request('/job-dev/house/applet/indexHotList',{},'GET', (res) => {
  171. // this.hotList = res.records;
  172. // console.log(res.records)
  173. // })
  174. },
  175. //请求接口获得后台列表数据信息 = 推荐房源
  176. getHouseListPage() {
  177. // 区分上拉加载和下拉刷新 is_pull 下拉 1 上拉 2
  178. const is_pull = this.is_pull;
  179. this.$api.getHouseListPage().then(res => {
  180. this.list = res.result;
  181. if(is_pull === 1) {
  182. // 下拉
  183. this.page = 1;
  184. this.list = res.result.records;
  185. }else {
  186. // 加载
  187. this.page +=1;
  188. this.list = this.list.concat(res.result.records);
  189. }
  190. }).catch(err => {
  191. console.log(err,"错误信息")
  192. });
  193. // this.$request('/job-dev/house/applet/indexListPage',{},'GET', (res) => {
  194. // this.list = res.records;
  195. // console.log(res.records)
  196. // })
  197. }
  198. // 下拉刷新 首页推荐房源分页下拉加载,上拉刷新。如果加载完了提示 没有更多了
  199. // 上拉加载
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. .container{
  205. background-color: #FFF !important;
  206. position: relative;
  207. }
  208. .ant-float{
  209. position: fixed;
  210. top: 60rpx;
  211. left: 24rpx;
  212. z-index: -2;
  213. .ant-select{
  214. width: 120rpx;
  215. padding: 10rpx 24rpx;
  216. color: #fff;
  217. font-weight: bolder;
  218. position: relative;
  219. }
  220. .ant-select::after{
  221. content: "";
  222. position: absolute;
  223. top: 8rpx;
  224. right: 55rpx;
  225. width: 12rpx;
  226. height: 12rpx;
  227. border-bottom: 2rpx solid #FFF;
  228. border-right: 2rpx solid #FFF;
  229. transform: rotate(45deg);
  230. }
  231. .ant-input{
  232. height: 48rpx;
  233. min-width: 460rpx;
  234. line-height: 48rpx;
  235. background: rgba(255, 255, 255, .4);
  236. border-radius: 8rpx;
  237. padding: 6rpx 24rpx;
  238. color: #333;
  239. font-size: 20rpx;
  240. }
  241. .ant-input::placeholder{
  242. color: #FFF;
  243. font-size: 20rpx;
  244. }
  245. }
  246. .ant-banner-box{
  247. position: fixed;
  248. top: 0;
  249. z-index: -3;
  250. background-color: #FFF;
  251. .ant-banner{
  252. width: 100vw;
  253. height: 500rpx;
  254. border-bottom-left-radius: 100rpx;
  255. border-bottom-right-radius: 100rpx;
  256. }
  257. .ant-title{
  258. color: #FFF;
  259. font-size: 42rpx;
  260. font-weight: bolder;
  261. text-align: center;
  262. position: absolute;
  263. top: 45%;
  264. width: 100%;
  265. line-height: 50rpx;
  266. }
  267. }
  268. .ant-menu-card{
  269. position: absolute;
  270. top: -40rpx;
  271. z-index: 1;
  272. margin: 0 24rpx;
  273. width: calc(100vw - 96rpx);
  274. background-color: #FFF;
  275. border-radius: 16rpx;
  276. min-height: 100rpx;
  277. padding: 24rpx;
  278. box-shadow: 10rpx 10rpx 20rpx rgba(134, 136, 136, 0.2);
  279. .ant-icon-menu{
  280. width: 150rpx;
  281. flex: 1;
  282. .ant-icon{
  283. width: 80rpx;
  284. height: 80rpx;
  285. margin: 8rpx auto;
  286. border-radius: 50%;
  287. // border: 1rpx dashed red;
  288. image{
  289. width: 80rpx;
  290. height: 80rpx;
  291. border-radius: 50%;
  292. }
  293. }
  294. .ant-text{
  295. width: 100%;
  296. font-size: 22rpx;
  297. color: #222;
  298. font-weight: bold;
  299. line-height: 40rpx;
  300. text-align: center;
  301. }
  302. }
  303. }
  304. .ant-content{
  305. margin-top: 520rpx;
  306. padding: 120rpx 24rpx 20rpx;
  307. width: calc(100vw - 48rpx);
  308. overflow: hidden;
  309. .ant-content-page{
  310. border-radius: 16rpx;
  311. min-height: 100rpx;
  312. padding: 24rpx 0;
  313. margin-bottom: 24rpx;
  314. .ant-page-title{
  315. color: #000;
  316. font-size: 32rpx;
  317. font-weight: bolder;
  318. line-height: 62rpx;
  319. width: 140rpx;
  320. }
  321. .ant-head-line{
  322. width: 100%;
  323. border-bottom: 1rpx solid #ccc;
  324. margin-bottom: 20rpx;
  325. }
  326. .ant-page-span{
  327. color: #aaa;
  328. font-size: 20rpx;
  329. margin-right: 10rpx;
  330. }
  331. .ant-page-image-item{
  332. border-radius: 4rpx;
  333. width: 240rpx;
  334. height: 300rpx;
  335. margin: 0 10rpx 0 0;
  336. flex-shrink: 0;
  337. position: relative;
  338. .ant-img-tags{
  339. background-color: rgba(255, 255, 255, .8);
  340. width: calc(240rpx - 36rpx);
  341. height: 50rpx;
  342. position: absolute;
  343. bottom: 8rpx;
  344. left: 8rpx;
  345. padding: 20rpx 10rpx;
  346. border-radius: 4rpx;
  347. .ant-tags-title{
  348. line-height: 30rpx;
  349. color: #000;
  350. font-size: 24rpx;
  351. }
  352. .ant-tags-text{
  353. font-size: 18rpx;
  354. color: #888;
  355. line-height: 40rpx;
  356. }
  357. }
  358. }
  359. }
  360. }
  361. .ant-item-box{
  362. display: flex;
  363. min-height: 80rpx;
  364. margin-bottom: 20rpx;
  365. .ant-item-image{
  366. width: 200rpx;
  367. height: 200rpx;
  368. border-radius: 4rpx;
  369. }
  370. .ant-item-content{
  371. color: #888;
  372. font-size: 28rpx;
  373. line-height: 42rpx;
  374. padding: 0 20rpx;
  375. .ant-item-title{
  376. color: #000;
  377. font-weight: bold;
  378. font-size: 32rpx;
  379. }
  380. .ant-item-span{
  381. color: #888;
  382. line-height: 40rpx;
  383. font-size: 24rpx;
  384. span{
  385. margin-right: 20rpx;
  386. font-size: 18rpx;
  387. background-color: #eee;
  388. padding: 5rpx 8rpx;
  389. border-radius: 4rpx;
  390. }
  391. }
  392. .ant-item-price{
  393. color: #4996f5;
  394. line-height: 48rpx;
  395. font-size: 34rpx;
  396. font-weight: bolder;
  397. span{
  398. line-height: 42rpx;
  399. font-size: 22rpx;
  400. font-weight: normal;
  401. margin-left: 10rpx
  402. }
  403. }
  404. }
  405. }
  406. </style>