|
|
@ -108,7 +108,12 @@ |
|
|
|
addressList:[], |
|
|
|
classList:[], |
|
|
|
hotList:[], |
|
|
|
list:[] |
|
|
|
list:[], |
|
|
|
lock: true, |
|
|
|
size: 20, |
|
|
|
page: 1, |
|
|
|
total: null, |
|
|
|
is_pull: 1, // 1是下拉刷新 2是上拉加载 |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
@ -118,6 +123,17 @@ |
|
|
|
this.getHotList(); |
|
|
|
this.getHouseListPage(); |
|
|
|
}, |
|
|
|
// 下拉刷新首页推荐房源 |
|
|
|
onPullDownRefresh() { |
|
|
|
this.is_pull = 1; |
|
|
|
this.getHouseListPage() |
|
|
|
}, |
|
|
|
// 上拉加载 |
|
|
|
onReachBottom() { |
|
|
|
this.is_pull = 2; |
|
|
|
// 写下限制重复发 以及最后一页 |
|
|
|
this.getHouseListPage() |
|
|
|
}, |
|
|
|
// 隐藏微信h5的标题栏 |
|
|
|
onReady() { |
|
|
|
|
|
|
@ -126,41 +142,83 @@ |
|
|
|
|
|
|
|
//获取轮播图 |
|
|
|
getBannerList(){ |
|
|
|
this.$request('/job-dev/house/applet/banner',{},'GET', (res) => { |
|
|
|
this.bannerList = res; |
|
|
|
console.log("111111") |
|
|
|
console.log(res[0].image) |
|
|
|
}) |
|
|
|
// this.getBannerList() |
|
|
|
this.$api.getBannerList().then(res => { |
|
|
|
this.bannerList = res.result; |
|
|
|
}).catch(err => { |
|
|
|
console.log(err,"错误信息") |
|
|
|
}); |
|
|
|
// this.$request('/job-dev/house/applet/banner',{},'GET', (res) => { |
|
|
|
// this.bannerList = res; |
|
|
|
// console.log("111111") |
|
|
|
// console.log(res[0].image) |
|
|
|
// }) |
|
|
|
}, |
|
|
|
//获取地区 |
|
|
|
getAddressList(){ |
|
|
|
this.$request('/job-dev/house/applet/indexListPage',{},'GET', (res) => { |
|
|
|
this.addressList = res.records; |
|
|
|
console.log(res.records) |
|
|
|
}) |
|
|
|
this.$api.getAddressList().then(res => { |
|
|
|
this.addressList = res.result; |
|
|
|
}).catch(err => { |
|
|
|
console.log(err,"错误信息") |
|
|
|
}); |
|
|
|
// this.$request('/job-dev/house/applet/indexListPage',{},'GET', (res) => { |
|
|
|
// this.addressList = res.records; |
|
|
|
// console.log(res.records) |
|
|
|
// }) |
|
|
|
}, |
|
|
|
//获取分类 |
|
|
|
getClassList(){ |
|
|
|
this.$request('/job-dev/house/applet/indexClass',{},'GET', (res) => { |
|
|
|
this.classList = res.records; |
|
|
|
console.log(res.records) |
|
|
|
}) |
|
|
|
this.$api.getClassList().then(res => { |
|
|
|
this.classList = res.result; |
|
|
|
}).catch(err => { |
|
|
|
console.log(err,"错误信息") |
|
|
|
}); |
|
|
|
// this.$request('/job-dev/house/applet/indexClass',{},'GET', (res) => { |
|
|
|
// this.classList = res.records; |
|
|
|
// console.log(res.records) |
|
|
|
// }) |
|
|
|
}, |
|
|
|
//获取好房源 |
|
|
|
getHotList(){ |
|
|
|
this.$request('/job-dev/house/applet/indexHotList',{},'GET', (res) => { |
|
|
|
this.hotList = res.records; |
|
|
|
console.log(res.records) |
|
|
|
}) |
|
|
|
this.$api.getHotList().then(res => { |
|
|
|
this.hotList = res.result.records; |
|
|
|
}).catch(err => { |
|
|
|
console.log(err,"错误信息") |
|
|
|
}); |
|
|
|
// this.$request('/job-dev/house/applet/indexHotList',{},'GET', (res) => { |
|
|
|
// this.hotList = res.records; |
|
|
|
// console.log(res.records) |
|
|
|
// }) |
|
|
|
}, |
|
|
|
//请求接口获得后台列表数据信息 = 推荐房源 |
|
|
|
getHouseListPage() { |
|
|
|
this.$request('/job-dev/house/applet/indexListPage',{},'GET', (res) => { |
|
|
|
this.list = res.records; |
|
|
|
console.log(res.records) |
|
|
|
}) |
|
|
|
// 区分上拉加载和下拉刷新 is_pull 下拉 1 上拉 2 |
|
|
|
const is_pull = this.is_pull; |
|
|
|
this.$api.getHouseListPage().then(res => { |
|
|
|
this.list = res.result; |
|
|
|
if(is_pull === 1) { |
|
|
|
// 下拉 |
|
|
|
this.page = 1; |
|
|
|
this.list = res.result.records; |
|
|
|
}else { |
|
|
|
// 加载 |
|
|
|
this.page +=1; |
|
|
|
this.list = this.list.concat(res.result.records); |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err,"错误信息") |
|
|
|
}); |
|
|
|
// this.$request('/job-dev/house/applet/indexListPage',{},'GET', (res) => { |
|
|
|
// this.list = res.records; |
|
|
|
// console.log(res.records) |
|
|
|
// }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 下拉刷新 首页推荐房源分页下拉加载,上拉刷新。如果加载完了提示 没有更多了 |
|
|
|
|
|
|
|
|
|
|
|
// 上拉加载 |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|