邓洁 : 取消下拉刷新

This commit is contained in:
邓洁
2023-11-20 20:11:38 +08:00
parent 770fc4137a
commit aaee754194
6 changed files with 77 additions and 65 deletions

View File

@@ -54,7 +54,7 @@
// this.pageNum=1 // this.pageNum=1
// } // }
this.getShopList(q, "refresh") this.getShopList(q, "refresh")
// } // }
}, },
onReachBottom() { onReachBottom() {
@@ -62,7 +62,7 @@
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");
}else if (this.shopListLength == 0) { } else if (this.shopListLength == 0) {
this.pageNum = 1 this.pageNum = 1
} }
}, },
@@ -95,6 +95,7 @@
console.log('查询'); console.log('查询');
this.shopInfoList = [...this.shopInfoList, ...res.data.data] this.shopInfoList = [...this.shopInfoList, ...res.data.data]
} }
uni.stopPullDownRefresh()
console.log(this.shopInfoList); console.log(this.shopInfoList);
}) })
}, },
@@ -117,13 +118,15 @@
page { page {
background-color: #F8F8F8; background-color: #F8F8F8;
} }
.showNull {
.showNull {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100rpx; height: 100rpx;
color: darkgray; color: darkgray;
} }
.marginLR10 { .marginLR10 {
margin: 0 10px; margin: 0 10px;
} }

View File

@@ -95,6 +95,7 @@
console.log('查询'); console.log('查询');
this.shopInfoList = [...this.shopInfoList, ...res.data.data] this.shopInfoList = [...this.shopInfoList, ...res.data.data]
} }
uni.stopPullDownRefresh()
console.log(this.shopInfoList); console.log(this.shopInfoList);
}) })
}, },

View File

@@ -94,6 +94,7 @@
console.log('查询'); console.log('查询');
this.searchInfoList = [...this.searchInfoList, ...res.data.data] this.searchInfoList = [...this.searchInfoList, ...res.data.data]
} }
uni.stopPullDownRefresh()
console.log(this.searchInfoList); console.log(this.searchInfoList);
}) })
}, },

View File

@@ -42,27 +42,27 @@
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.refresh=true this.refresh = true
// if (this.showNull = true) { // if (this.showNull = true) {
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 1, type: 1,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: 1, pageNum: 1,
}) })
// if(this.showNull=true){ // if(this.showNull=true){
// this.pageNum=1 // this.pageNum=1
// } // }
this.getShopList(q, "refresh") this.getShopList(q, "refresh")
// } // }
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh&&this.shopListLength !== 0) { if (!this.refresh && this.shopListLength !== 0) {
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");
}else if(this.shopListLength == 0){ } else if (this.shopListLength == 0) {
this.pageNum=1 this.pageNum = 1
} }
}, },
onLoad() { onLoad() {
@@ -80,11 +80,11 @@
this.$api.getShopList(query).then(res => { this.$api.getShopList(query).then(res => {
this.shopListLength = res.data.data.length this.shopListLength = res.data.data.length
if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query
.includes('region')||this.refresh) { .includes('region') || this.refresh) {
console.log('筛选'); console.log('筛选');
// this.resetQuery(q) // this.resetQuery(q)
this.shopInfoList = res.data.data this.shopInfoList = res.data.data
this.refresh=false this.refresh = false
if (res.data.data.length == 0) { if (res.data.data.length == 0) {
this.showNull = true this.showNull = true
} else { } else {
@@ -95,6 +95,7 @@
this.shopInfoList = [...this.shopInfoList, ...res.data.data] this.shopInfoList = [...this.shopInfoList, ...res.data.data]
} }
console.log(this.shopInfoList); console.log(this.shopInfoList);
uni.stopPullDownRefresh()
}) })
}, },
getQueryInfo(query) { getQueryInfo(query) {
@@ -116,13 +117,15 @@
page { page {
background-color: #F8F8F8; background-color: #F8F8F8;
} }
.showNull {
.showNull {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100rpx; height: 100rpx;
color: darkgray; color: darkgray;
} }
.marginLR10 { .marginLR10 {
margin: 0 10px; margin: 0 10px;
} }

View File

@@ -1,16 +1,16 @@
<template> <template>
<view class="root"> <view class="root">
<InputAndSwiper></InputAndSwiper> <InputAndSwiper></InputAndSwiper>
<view> <view>
<view class="dropdown-bug"> <view class="dropdown-bug">
</view> </view>
<view class="marginLR10"> <view class="marginLR10">
<DropDown @getQueryInfo = "getShopList"></DropDown> <DropDown @getQueryInfo="getShopList"></DropDown>
</view> </view>
<view class="marginLR10"> <view class="marginLR10">
<SearchShopList :showStyle="1" :searchInfoList="searchInfoList"/> <SearchShopList :showStyle="1" :searchInfoList="searchInfoList" />
</view> </view>
</view> </view>
<view v-if="showNull" class="showNull"> <view v-if="showNull" class="showNull">
@@ -39,46 +39,46 @@
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.refresh=true this.refresh = true
// if (this.showNull = true) { // if (this.showNull = true) {
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 2, type: 2,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: 1, pageNum: 1,
}) })
// if(this.showNull=true){ // if(this.showNull=true){
// this.pageNum=1 // this.pageNum=1
// } // }
this.getShopList(q, "refresh") this.getShopList(q, "refresh")
// } // }
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh&&this.searchListLength !== 0) { if (!this.refresh && this.searchListLength !== 0) {
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");
}else if(this.searchListLength == 0){ } else if (this.searchListLength == 0) {
this.pageNum=1 this.pageNum = 1
} }
}, },
methods: { methods: {
getShopList(q, type){ getShopList(q, type) {
let query = {} let query = {}
if (type == "refresh") { if (type == "refresh") {
query = q query = q
} else { } else {
query = this.getQueryInfo(q) query = this.getQueryInfo(q)
} }
console.log("listquery",query); console.log("listquery", query);
this.$api.getShopList(query).then(res => { this.$api.getShopList(query).then(res => {
this.searchListLength = res.data.data.length this.searchListLength = res.data.data.length
if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query
.includes('region')||this.refresh) { .includes('region') || this.refresh) {
console.log('筛选'); console.log('筛选');
// this.resetQuery(q) // this.resetQuery(q)
this.searchInfoList = res.data.data this.searchInfoList = res.data.data
this.refresh=false this.refresh = false
if (res.data.data.length == 0) { if (res.data.data.length == 0) {
this.showNull = true this.showNull = true
} else { } else {
@@ -89,10 +89,11 @@
this.searchInfoList = [...this.searchInfoList, ...res.data.data] this.searchInfoList = [...this.searchInfoList, ...res.data.data]
} }
console.log(this.searchInfoList); console.log(this.searchInfoList);
uni.stopPullDownRefresh()
}) })
}, },
getQueryInfo(query){ getQueryInfo(query) {
console.log("getQueryInfo",query); console.log("getQueryInfo", query);
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 2, type: 2,
pageSize: this.pageSize, pageSize: this.pageSize,
@@ -116,12 +117,15 @@
height: 100rpx; height: 100rpx;
color: darkgray; color: darkgray;
} }
page { page {
background-color: $uni-bg-color-grey; background-color: $uni-bg-color-grey;
} }
.root{
.root {
position: relative; position: relative;
} }
.dropdown-bug { .dropdown-bug {
position: absolute; position: absolute;
background-color: $uni-bg-color-grey; background-color: $uni-bg-color-grey;
@@ -130,8 +134,8 @@
transform: translateY(-20rpx); transform: translateY(-20rpx);
z-index: 2; z-index: 2;
} }
.marginLR10{
.marginLR10 {
margin: 0 10px; margin: 0 10px;
} }
</style>
</style>

View File

@@ -39,27 +39,27 @@
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.refresh=true this.refresh = true
// if (this.showNull = true) { // if (this.showNull = true) {
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 1, type: 1,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: 1, pageNum: 1,
}) })
// if(this.showNull=true){ // if(this.showNull=true){
// this.pageNum=1 // this.pageNum=1
// } // }
this.getShopList(q, "refresh") this.getShopList(q, "refresh")
// } // }
}, },
onReachBottom() { onReachBottom() {
if (!this.refresh&&this.shopListLength !== 0) { if (!this.refresh && this.shopListLength !== 0) {
this.pageNum++ this.pageNum++
this.getShopList() this.getShopList()
console.log("触底加载"); console.log("触底加载");
}else if(this.shopListLength == 0){ } else if (this.shopListLength == 0) {
this.pageNum=1 this.pageNum = 1
} }
}, },
methods: { methods: {
@@ -74,11 +74,11 @@
this.$api.getShopList(query).then(res => { this.$api.getShopList(query).then(res => {
this.shopListLength = res.data.data.length this.shopListLength = res.data.data.length
if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query
.includes('region')||this.refresh) { .includes('region') || this.refresh) {
console.log('筛选'); console.log('筛选');
// this.resetQuery(q) // this.resetQuery(q)
this.shopInfoList = res.data.data this.shopInfoList = res.data.data
this.refresh=false this.refresh = false
if (res.data.data.length == 0) { if (res.data.data.length == 0) {
this.showNull = true this.showNull = true
} else { } else {
@@ -88,7 +88,7 @@
console.log('查询'); console.log('查询');
this.shopInfoList = [...this.shopInfoList, ...res.data.data] this.shopInfoList = [...this.shopInfoList, ...res.data.data]
} }
uni.stopPullDownRefresh()
console.log(this.shopInfoList); console.log(this.shopInfoList);
}) })
}, },