From fa4ee7faf140ed7a59fe0cd3b9205a055872e513 Mon Sep 17 00:00:00 2001 From: SelfRidicule Date: Thu, 14 Mar 2024 15:31:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=8F=E8=BF=B0:=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/api/index/index.js | 11 +++++++++++ miniprogram/pages/index/index.js | 26 ++++++++++++++++---------- miniprogram/pages/index/index.wxml | 2 +- 3 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 miniprogram/api/index/index.js diff --git a/miniprogram/api/index/index.js b/miniprogram/api/index/index.js new file mode 100644 index 0000000..9df9bdb --- /dev/null +++ b/miniprogram/api/index/index.js @@ -0,0 +1,11 @@ +import { + request +} from '../selfRequest'; + +// 轮播图 +export function visitorCarouselRq() { + return request({ + url: '/api/visitor/carousel', + method: "get", + }); +} \ No newline at end of file diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index 94cd7a3..9a5f6bc 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -10,6 +10,10 @@ import { userProfile } from "../../api/user/user.js" +import { + visitorCarouselRq +} from "../../api/index/index.js" + Page({ data: { @@ -148,19 +152,21 @@ Page({ }, ], - bannerList: [{ - bg: '/profile/static/index/banner/1.jpg', - url: '' - }, { - bg: '/profile/static/index/banner/2.jpg', - url: '' - }, { - bg: '/profile/static/index/banner/3.jpg', - url: '' - }], + bannerList: [], userDetail: {}, }, + onLoad() { + let _this = this; + // 轮播图 + visitorCarouselRq().then(res => { + console.log('visitorCarouselRq', res); + _this.setData({ + bannerList: res.data + }) + }) + }, + // 切换tabbar switchTab(e) { const data = e.currentTarget.dataset diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml index e8a4b41..25663dc 100644 --- a/miniprogram/pages/index/index.wxml +++ b/miniprogram/pages/index/index.wxml @@ -16,7 +16,7 @@ - +