Merge pull request '邓洁 : 首页分页加载' (#83) from dj into master
Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/83
This commit is contained in:
@@ -18,8 +18,8 @@
|
|||||||
<text>找店列表</text>
|
<text>找店列表</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<SearchShopList v-if="chooseIndex" :searchInfoList="searchInfoList"/>
|
<SearchShopList v-if="chooseIndex" :searchInfoList="searchInfoList" />
|
||||||
<ShowShopList v-else :shopInfoList = "shopInfoList"/>
|
<ShowShopList v-else :shopInfoList="shopInfoList" />
|
||||||
</view>
|
</view>
|
||||||
<TabBar :current-page="0"></TabBar>
|
<TabBar :current-page="0"></TabBar>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,7 +49,8 @@
|
|||||||
searchPageSize: 5,
|
searchPageSize: 5,
|
||||||
shopPageNum: 1,
|
shopPageNum: 1,
|
||||||
searchPageNum: 1,
|
searchPageNum: 1,
|
||||||
|
shopListLength: '',
|
||||||
|
shopSearchListLength: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -61,11 +62,21 @@
|
|||||||
this.open()
|
this.open()
|
||||||
this.getClassList()
|
this.getClassList()
|
||||||
},
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
if (this.chooseIndex == 0 && this.shopListLength !== 0) {
|
||||||
|
this.shopPageNum++
|
||||||
|
this.getShopList()
|
||||||
|
}
|
||||||
|
if (this.chooseIndex == 1 && this.shopSearchListLength !== 0) {
|
||||||
|
this.searchPageNum++
|
||||||
|
this.getSearchList()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getBanner() {
|
getBanner() {
|
||||||
this.$api.getBanner().then(res => {
|
this.$api.getBanner().then(res => {
|
||||||
res.data.data.forEach(item=>{
|
res.data.data.forEach(item => {
|
||||||
item.img =this.$api.imgUrl + item.img
|
item.img = this.$api.imgUrl + item.img
|
||||||
})
|
})
|
||||||
this.swiperList = res.data.data
|
this.swiperList = res.data.data
|
||||||
// .map(item => this.$api.imgUrl + item.img)
|
// .map(item => this.$api.imgUrl + item.img)
|
||||||
@@ -81,35 +92,37 @@
|
|||||||
this.statNum = res.data.data
|
this.statNum = res.data.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getShopList(){
|
getShopList() {
|
||||||
const query = this.$u.queryParams({
|
const query = this.$u.queryParams({
|
||||||
type: 1,
|
type: 1,
|
||||||
pageSize: this.shopPageSize,
|
pageSize: this.shopPageSize,
|
||||||
pageNum: this.shopPageNum
|
pageNum: this.shopPageNum
|
||||||
})
|
})
|
||||||
this.$api.getShopList(query).then(res => {
|
this.$api.getShopList(query).then(res => {
|
||||||
this.shopInfoList = res.data.data
|
res.data.data.forEach(item => {
|
||||||
this.shopInfoList.forEach(item=>{
|
item.pics = this.$api.imgUrl + item.pics
|
||||||
item.pics =this.$api.imgUrl + item.pics
|
|
||||||
})
|
})
|
||||||
|
this.shopListLength = res.data.data.length
|
||||||
|
this.shopInfoList = [...this.shopInfoList, ...res.data.data]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getSearchList(){
|
getSearchList() {
|
||||||
const query = this.$u.queryParams({
|
const query = this.$u.queryParams({
|
||||||
type: 2,
|
type: 2,
|
||||||
pageSize: this.searchPageSize,
|
pageSize: this.searchPageSize,
|
||||||
pageNum: this.searchPageNum
|
pageNum: this.searchPageNum
|
||||||
})
|
})
|
||||||
this.$api.getShopList(query).then(res => {
|
this.$api.getShopList(query).then(res => {
|
||||||
this.searchInfoList = res.data.data
|
this.shopSearchListLength = res.data.data.length
|
||||||
|
// 用于触底刷新 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
|
||||||
|
this.searchInfoList = [...this.searchInfoList, ...res.data.data]
|
||||||
console.log(this.searchInfoList);
|
console.log(this.searchInfoList);
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
,
|
|
||||||
getClassList() {
|
getClassList() {
|
||||||
this.$api.getClassList().then(res => {
|
this.$api.getClassList().then(res => {
|
||||||
let data = res.data.data
|
let data = res.data.data
|
||||||
data.sort((a,b)=>{
|
data.sort((a, b) => {
|
||||||
return a.id - b.id
|
return a.id - b.id
|
||||||
})
|
})
|
||||||
data = data.map(item => item.name)
|
data = data.map(item => item.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user