罗世杰:fixed:修改列表组件发送网络请求的位置

This commit is contained in:
LuoShijie
2023-11-19 14:24:58 +08:00
parent 5c0b5d1ede
commit ae5b700362
5 changed files with 83 additions and 30 deletions

View File

@@ -18,8 +18,8 @@
<text>找店列表</text>
</view>
</view>
<SearchShopList v-if="chooseIndex" />
<ShowShopList v-else />
<SearchShopList v-if="chooseIndex" :searchInfoList="searchInfoList"/>
<ShowShopList v-else :shopInfoList = "shopInfoList"/>
</view>
<TabBar :current-page="0"></TabBar>
</view>
@@ -43,12 +43,21 @@
chooseIndex: 0,
statNum: {},
swiperList: [],
shopInfoList: [],
searchInfoList: [],
shopPageSize: 5,
searchPageSize: 5,
shopPageNum: 1,
searchPageNum: 1,
}
},
onLoad() {
this.getBanner()
this.getNotice()
this.getStat()
this.getShopList()
this.getSearchList()
this.open()
this.getClassList()
},
@@ -72,6 +81,31 @@
this.statNum = res.data.data
})
},
getShopList(){
const query = this.$u.queryParams({
type: 1,
pageSize: this.shopPageSize,
pageNum: this.shopPageNum
})
this.$api.getShopList(query).then(res => {
this.shopInfoList = res.data.data
this.shopInfoList.forEach(item=>{
item.pics =this.$api.imgUrl + item.pics
})
})
},
getSearchList(){
const query = this.$u.queryParams({
type: 2,
pageSize: this.searchPageSize,
pageNum: this.searchPageNum
})
this.$api.getShopList(query).then(res => {
this.searchInfoList = res.data.data
console.log(this.searchInfoList);
})
}
,
getClassList() {
this.$api.getClassList().then(res => {
let data = res.data.data