diff --git a/pages/index/index.vue b/pages/index/index.vue
index a8a3f59..2d13c47 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -55,14 +55,17 @@
品质保障
-
-
-
-
-
- {{item.price}}元起
+
+
+
+
+
+
+ {{item.price}}元起
+
-
+
+
@@ -114,6 +117,9 @@
page: 1,
total: null,
is_pull: 1, // 1是下拉刷新 2是上拉加载
+ scrollPage: 1, //横向滚动
+ scrollSize:20,
+ scrollTotal:null,
}
},
onLoad() {
@@ -131,9 +137,18 @@
// 上拉加载
onReachBottom() {
this.is_pull = 2;
+ const page = this.page;
+ const size = this.size;
+ const total = this.total;
// 写下限制重复发 以及最后一页
+ if(page * size > total) {
+ this.$functions.showToast('没有更多了')
+ return;
+ }
this.getHouseListPage()
},
+ // 好房源 向右加载
+
// 隐藏微信h5的标题栏
onReady() {
@@ -178,10 +193,35 @@
// console.log(res.records)
// })
},
+ // 向右滚动加载好房源
+ scrollTolowerHotList () {
+ // 是否已经是最后
+ const scrollPage = this.scrollPage;
+ const scrollSize = this.scrollSize;
+ const scrollTotal = this.scrollTotal;
+ if(scrollPage* scrollSize > scrollTotal) {
+ this.$functions.showToast('没有更多了');
+ return;
+ }
+ this.$functions.showLoading();
+ this.getHotList();
+ },
//获取好房源
getHotList(){
+
this.$api.getHotList().then(res => {
+ if(this.scrollTotal !== null){
+ this.scrollPage+=1;
+ const hotList = this.hotList;
+ this.hotList = hotList.concat(res.result.records);
+ this.$functions.hideLoading();
+ }else if(this.scrollTotal === null) {
+ this.scrollSize = res.result.size;
+ this.scrollTotal = res.result.total;
this.hotList = res.result.records;
+ }
+
+
}).catch(err => {
console.log(err,"错误信息")
});
@@ -194,10 +234,17 @@
getHouseListPage() {
// 区分上拉加载和下拉刷新 is_pull 下拉 1 上拉 2
const is_pull = this.is_pull;
+ this.$functions.showLoading();
this.$api.getHouseListPage().then(res => {
- this.list = res.result;
+ // this.list = res.result;
+ if(this.page === 1 || this.total == null || is_pull === 1) {
+ this.total = res.result.total;
+ this.size = res.result.size;
+ }
+ console.log(is_pull)
if(is_pull === 1) {
// 下拉
+ console.log(123132)
this.page = 1;
this.list = res.result.records;
}else {
@@ -205,7 +252,9 @@
this.page +=1;
this.list = this.list.concat(res.result.records);
}
+ this.$functions.hideLoading();
}).catch(err => {
+ this.$functions.hideLoading();
console.log(err,"错误信息")
});
// this.$request('/job-dev/house/applet/indexListPage',{},'GET', (res) => {
@@ -361,6 +410,12 @@
padding: 24rpx 0;
margin-bottom: 24rpx;
+ .scroll-view_H{
+ // width: 100%;
+ white-space: nowrap;
+ width: 100%;
+ height: 300rpx;
+ }
.ant-page-title{
color: #000;
font-size: 32rpx;
@@ -382,6 +437,7 @@
}
.ant-page-image-item{
+ display: inline-block;
border-radius: 4rpx;
width: 240rpx;
height: 300rpx;
@@ -476,7 +532,7 @@
}
-
+