From b31af81a5e151bf8476cc2830d402f2f0593eb25 Mon Sep 17 00:00:00 2001 From: yanyan Date: Mon, 15 Jan 2024 10:51:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 61 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 13 deletions(-) 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 @@