Merge pull request '邓洁 : 点击轮播图跳转到详情' (#61) from djj into master

Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/61
This commit is contained in:
odjbin
2023-11-17 05:12:54 +00:00
3 changed files with 29 additions and 12 deletions

View File

@@ -13,7 +13,8 @@
</u-input> </u-input>
</view> </view>
</view> </view>
<u-swiper :list="bannerURL" height="300rpx" /> <u-swiper :list="bannerURL" keyName="img" height="300rpx" @change="e => currentNum = e.current"
@click="handleSwiperList(currentNum==''?0:currentNum,bannerURL)" />
</view> </view>
</template> </template>
@@ -38,19 +39,23 @@
}, },
data() { data() {
return { return {
position: uni.getStorageSync('city')+uni.getStorageSync('district').slice(0, 2) position: uni.getStorageSync('city') + uni.getStorageSync('district').slice(0, 2),
currentNum: ''
}; };
}, },
options: { options: {
styleIsolation: 'shared', // 解除样式隔离 styleIsolation: 'shared', // 解除样式隔离
}, },
created() { created() {
if (this.type !== '0') {
// this.open()
}
}, },
methods: { methods: {
//点击轮播图
handleSwiperList(currentNum, bannerURL) {
const item=bannerURL[currentNum]
uni.navigateTo({
url: item.link+`?id=${item.param}&type=${item.type}`
})
},
} }
} }
</script> </script>

View File

@@ -94,9 +94,9 @@
}, },
data() { data() {
return { return {
shopInfo:{ // shopInfo:{
} // }
} }
}, },
@@ -112,9 +112,17 @@
} }
}, },
onLoad: function(options) { onLoad: function(options) {
const shopInfomation = JSON.parse(decodeURIComponent(options.shopInfo)) // const shopInfomation = JSON.parse(decodeURIComponent(options.shopInfo))
console.log(shopInfomation); // console.log(shopInfomation);
this.shopInfo = shopInfomation // this.shopInfo = shopInfomation
console.log('detail',options);
//点击轮播图跳转详情, 传递的参数id, type
if(options.id){
}
if(options.type){
}
} }
} }

View File

@@ -55,7 +55,11 @@
methods: { methods: {
getBanner() { getBanner() {
this.$api.getBanner().then(res => { this.$api.getBanner().then(res => {
this.swiperList = res.data.data.map(item => this.$api.imgUrl + item.img) res.data.data.forEach(item=>{
item.img =this.$api.imgUrl + item.img
})
this.swiperList = res.data.data
// .map(item => this.$api.imgUrl + item.img)
}) })
}, },
getNotice() { getNotice() {