From 89331c91dbe4eb0f0bc777e528af49c374cd13d0 Mon Sep 17 00:00:00 2001 From: kola-web Date: Fri, 6 Dec 2024 16:38:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5banner=E6=8C=91=E6=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.json | 3 ++- src/pages/home/index.scss | 11 ++++++++-- src/pages/home/index.ts | 43 ++++++++++++++++++++++++++++++++++++++-- src/pages/home/index.wxml | 36 ++++++++++++++++++++++++--------- src/pages/longPicture/index.json | 5 +++++ src/pages/longPicture/index.scss | 3 +++ src/pages/longPicture/index.ts | 17 ++++++++++++++++ src/pages/longPicture/index.wxml | 1 + 8 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 src/pages/longPicture/index.json create mode 100644 src/pages/longPicture/index.scss create mode 100644 src/pages/longPicture/index.ts create mode 100644 src/pages/longPicture/index.wxml diff --git a/src/app.json b/src/app.json index 044f216..90d605c 100644 --- a/src/app.json +++ b/src/app.json @@ -11,7 +11,8 @@ "pages/article/index", "pages/search/index", "pages/protocol/index", - "pages/userInfo/index" + "pages/userInfo/index", + "pages/longPicture/index" ], "preloadRule": {}, "window": { diff --git a/src/pages/home/index.scss b/src/pages/home/index.scss index b93694a..1d7f26a 100644 --- a/src/pages/home/index.scss +++ b/src/pages/home/index.scss @@ -48,6 +48,12 @@ page { .wx-swiper-dots { bottom: 60rpx; + display: flex; + align-items: center; + } + .wx-swiper-dot{ + width: 8rpx; + height: 8rpx; } .wx-swiper-dot-active { width: 24rpx !important; @@ -65,9 +71,10 @@ page { display: block; width: 100%; height: 274rpx; + border-radius: 32rpx; } &::after { - content: ""; + content: ''; position: absolute; bottom: 74rpx; left: 40rpx; @@ -123,7 +130,7 @@ page { color: #222222; font-weight: bold; &::before { - content: ""; + content: ''; width: 8rpx; height: 34rpx; background-color: #3795f7; diff --git a/src/pages/home/index.ts b/src/pages/home/index.ts index ff29c0f..03512a6 100644 --- a/src/pages/home/index.ts +++ b/src/pages/home/index.ts @@ -5,16 +5,44 @@ Page({ cateList: [] as any, remark: '', - isLogin: 0, + feedbackCount: 0, + bannerList: [], }, onLoad() { app.waitLogin().then(() => { this.getCateList(); + this.getBanner(); + this.getRemarkCount(); + }); + }, + getBanner() { + wx.ajax({ + method: 'GET', + url: '?r=shizhong/index/index', + data: {}, + }).then((res) => { this.setData({ - isLogin: app.globalData.isLogin, + bannerList: res, }); }); }, + handleTap(e) { + const { index } = e.currentTarget.dataset; + const bannerItem: any = this.data.bannerList[index]; + if (bannerItem.configType === '1') { + wx.navigateTo({ + url: `/pages/article/index?id=${bannerItem.configContent}`, + }); + } else if (bannerItem.configType === '2') { + wx.navigateTo({ + url: `/pages/article/index?id=${bannerItem.configContent}`, + }); + } else if (bannerItem.configType === '3') { + wx.navigateTo({ + url: `/pages/longPicture/index?url=${encodeURIComponent(bannerItem.configContent)}`, + }); + } + }, getCateList() { wx.ajax({ method: 'GET', @@ -38,6 +66,17 @@ Page({ url: '/pages/search/index', }); }, + getRemarkCount() { + wx.ajax({ + method: 'GET', + url: '?r=shizhong/account/get-can-feedback-count', + data: {}, + }).then((res) => { + this.setData({ + feedbackCount: res, + }); + }); + }, handleRemark() { const { remark } = this.data; wx.ajax({ diff --git a/src/pages/home/index.wxml b/src/pages/home/index.wxml index 7717e13..09678ce 100644 --- a/src/pages/home/index.wxml +++ b/src/pages/home/index.wxml @@ -1,7 +1,4 @@ - + 人人都是家庭健康师,让生活更有质量 @@ -17,9 +14,24 @@ placeholder="请输入要搜索的内容" /> - - - + + + @@ -35,7 +47,7 @@ {{item.Intro}} - + 留言板 - 提交 + + 提交 + diff --git a/src/pages/longPicture/index.json b/src/pages/longPicture/index.json new file mode 100644 index 0000000..1cf0579 --- /dev/null +++ b/src/pages/longPicture/index.json @@ -0,0 +1,5 @@ +{ + "navigationStyle": "default", + "navigationBarTitleText": "预览", + "usingComponents": {} +} diff --git a/src/pages/longPicture/index.scss b/src/pages/longPicture/index.scss new file mode 100644 index 0000000..019048d --- /dev/null +++ b/src/pages/longPicture/index.scss @@ -0,0 +1,3 @@ +.banner { + width: 100%; +} diff --git a/src/pages/longPicture/index.ts b/src/pages/longPicture/index.ts new file mode 100644 index 0000000..a086f18 --- /dev/null +++ b/src/pages/longPicture/index.ts @@ -0,0 +1,17 @@ +const _app = getApp(); + +Page({ + data: { + url: '', + }, + onLoad(options) { + const { url } = options; + if (url) { + this.setData({ + url: decodeURIComponent(url), + }); + } + }, +}); + +export {}; diff --git a/src/pages/longPicture/index.wxml b/src/pages/longPicture/index.wxml new file mode 100644 index 0000000..312598c --- /dev/null +++ b/src/pages/longPicture/index.wxml @@ -0,0 +1 @@ +