邓洁:轮播图

This commit is contained in:
邓洁
2023-11-22 09:25:04 +08:00
parent fa8f90d1f9
commit fead9fb1d2
2 changed files with 42 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="root"> <view class="root">
<InputAndSwiper @getQueryInfo="getInput"></InputAndSwiper> <InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList"></InputAndSwiper>
<view> <view>
<view class="dropdown-bug"> <view class="dropdown-bug">
@@ -32,6 +32,7 @@
pageSize: 3, pageSize: 3,
pageNum: 1, pageNum: 1,
searchInfoList: [], searchInfoList: [],
swiperList: [],
customQuery: {}, customQuery: {},
searchListLength: '', searchListLength: '',
showNull: false, showNull: false,
@@ -62,17 +63,30 @@
this.pageNum = 1 this.pageNum = 1
} }
}, },
created() {
this.getShopList()
this.getBanner()
},
methods: { methods: {
getInput(val){ getBanner() {
console.log('搜索值',val); this.$api.getBanner().then(res => {
if(this.pageNum!==1){ res.data.data.forEach(item => {
this.pageNum=1 item.img = this.$api.imgUrl + item.img
})
this.swiperList = res.data.data
// .map(item => this.$api.imgUrl + item.img)
})
},
getInput(val) {
console.log('搜索值', val);
if (this.pageNum !== 1) {
this.pageNum = 1
} }
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 2, type: 2,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: this.pageNum, pageNum: this.pageNum,
kw:val kw: val
}) })
this.$api.getShopList(q).then(res => { this.$api.getShopList(q).then(res => {
this.searchListLength = res.data.data.length this.searchListLength = res.data.data.length
@@ -118,10 +132,8 @@
}) })
return q return q
} }
},
created() {
this.getShopList()
} }
} }
</script> </script>

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="root"> <view class="root">
<InputAndSwiper @getQueryInfo="getInput"></InputAndSwiper> <InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList"> </InputAndSwiper>
<view> <view>
<view class="dropdown-bug"> <view class="dropdown-bug">
@@ -33,6 +33,7 @@
pageNum: 1, pageNum: 1,
shopInfoList: [], shopInfoList: [],
customQuery: {}, customQuery: {},
swiperList: [],
shopListLength: '', shopListLength: '',
showNull: false, showNull: false,
refresh: false refresh: false
@@ -57,22 +58,36 @@
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
} }
}, },
created() {
this.getShopList()
this.getBanner()
},
methods: { methods: {
getInput(val){ getBanner() {
console.log('搜索值',val); this.$api.getBanner().then(res => {
if(this.pageNum!==1){ res.data.data.forEach(item => {
this.pageNum=1 item.img = this.$api.imgUrl + item.img
})
this.swiperList = res.data.data
// .map(item => this.$api.imgUrl + item.img)
})
},
getInput(val) {
console.log('搜索值', val);
if (this.pageNum !== 1) {
this.pageNum = 1
} }
const q = this.$u.queryParams({ const q = this.$u.queryParams({
type: 1, type: 1,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: this.pageNum, pageNum: this.pageNum,
kw:val kw: val
}) })
this.$api.getShopList(q).then(res => { this.$api.getShopList(q).then(res => {
this.shopListLength = res.data.data.length this.shopListLength = res.data.data.length
@@ -117,9 +132,6 @@
}) })
return q return q
} }
},
created() {
this.getShopList()
} }
} }
</script> </script>