diff --git a/pages/index/index.vue b/pages/index/index.vue index a929777..f252c4f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,7 +1,7 @@ @@ -22,22 +26,37 @@ export default { data() { return { + //顶部图片 + topImg: "", //轮播图数据列表 swiperList: [], + //场景入口 + sceneList:[] }; }, onLoad() { - this.getSwiperList() }, methods: { + async getSwiperList() { + const { data: res - } = await uni.$http.get('/api/public/v1/home/swiperdata') - if (res.meta.status !== 200) return uni.$showMsg() + } = await uni.$http.post('/small/customImage/listAll') + if (!res.success) return uni.$showMsg() - this.swiperList = res.message + res.data.forEach(item=>{ + item.uploadPath = 'http://localhost:85' +item.uploadPath + if (item.position === "top"){ + this.topImg = item.uploadPath + } else if(item.position === "middle"){ + this.swiperList.push(item.uploadPath) + } else if(item.position === "bottom"){ + this.sceneList.push(item.uploadPath) + } + }) + uni.$showMsg('数据请求成功!') }, } @@ -45,18 +64,34 @@