From 640c44b58b6d8db7437c4f58a2e5d7fd475d27c5 Mon Sep 17 00:00:00 2001 From: kola-web Date: Fri, 6 Dec 2024 18:37:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86bug=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.ts | 2 +- src/components/global-toast/index.scss | 39 ++++++++++++++++++++++ src/components/global-toast/index.ts | 3 ++ src/components/global-toast/index.wxml | 19 +++++++++-- src/pages/article/index.json | 3 +- src/pages/article/index.ts | 61 ++++++++++++++++++++++++---------- src/pages/article/index.wxml | 4 ++- src/pages/home/index.scss | 3 +- src/pages/home/index.ts | 2 +- src/pages/home/index.wxml | 2 +- 10 files changed, 112 insertions(+), 26 deletions(-) diff --git a/src/app.ts b/src/app.ts index 959c228..dc5dc27 100644 --- a/src/app.ts +++ b/src/app.ts @@ -74,7 +74,7 @@ App({ clearInterval(time); if (waitLoginState) { resolve(true); - } else if (isLogin === 0) { + } else if (isLogin === 0 || !isLogin) { wx.reLaunch({ url: '/pages/login/index' }); } else if (requireLogin && isLogin === 999) { wx.reLaunch({ url: '/pages/login/index' }); diff --git a/src/components/global-toast/index.scss b/src/components/global-toast/index.scss index af505a7..23e50e4 100644 --- a/src/components/global-toast/index.scss +++ b/src/components/global-toast/index.scss @@ -25,3 +25,42 @@ text-align: center; } } + +.popup3 { + padding: 136rpx 44rpx 0; + width: 622rpx; + height: 632rpx; + box-sizing: border-box; + background: linear-gradient(180deg, #e7f8ff 0%, #ffffff 100%); + border-radius: 36rpx 36rpx 36rpx 36rpx; + .title { + font-size: 48rpx; + color: #222222; + font-weight: bold; + text-align: center; + } + .tip { + margin-top: 24rpx; + font-size: 36rpx; + color: #65686c; + line-height: 56rpx; + } + .btn1 { + margin-top: 44rpx; + font-size: 36rpx; + color: #ffffff; + height: 88rpx; + display: flex; + align-items: center; + justify-content: center; + background: #3795f7; + border-radius: 96rpx 96rpx 96rpx 96rpx; + } + .btn2 { + margin-top: 16rpx; + padding: 16rpx 32rpx; + font-size: 32rpx; + color: #3795f7; + text-align: center; + } +} diff --git a/src/components/global-toast/index.ts b/src/components/global-toast/index.ts index ab42e7e..5be460c 100644 --- a/src/components/global-toast/index.ts +++ b/src/components/global-toast/index.ts @@ -29,6 +29,9 @@ Component({ * 组件的方法列表 */ methods: { + handleConform() { + this.triggerEvent('conform'); + }, handleClose() { this.triggerEvent('close'); }, diff --git a/src/components/global-toast/index.wxml b/src/components/global-toast/index.wxml index 9558c16..ca49198 100644 --- a/src/components/global-toast/index.wxml +++ b/src/components/global-toast/index.wxml @@ -4,7 +4,7 @@ custom-style="background: transparent;" bind:close="handleClose" > - + 关注适中健康微信公众号 - + 添加我的企业微信 长按识别二维码关注 + + + + + 该账号未开通阅读权益 + 此小程序暂时仅供经邀请的企业用户使用,请换个手机号登录以完成身份验证。 + 换个手机号登录 + 取消 + + diff --git a/src/pages/article/index.json b/src/pages/article/index.json index f28c64e..511f5e0 100644 --- a/src/pages/article/index.json +++ b/src/pages/article/index.json @@ -4,6 +4,7 @@ "usingComponents": { "van-slider": "@vant/weapp/slider/index", "van-popup": "@vant/weapp/popup/index", - "mp-html": "mp-html" + "mp-html": "mp-html", + "global-toast":"/components/global-toast/index" } } diff --git a/src/pages/article/index.ts b/src/pages/article/index.ts index df36d37..2059651 100644 --- a/src/pages/article/index.ts +++ b/src/pages/article/index.ts @@ -15,6 +15,9 @@ Page({ url: 'http://m10.music.126.net/20241126110303/3f2481d2d6d50acd2009359539eadda0/ymusic/5353/0f0f/0358/d99739615f8e5153d77042092f07fd77.mp3', play: false, time: '00:00/00:00', + + toastShow: false, + toastType: 3, }, innerAudioContext: null as WechatMiniprogram.InnerAudioContext | null, onLoad(options) { @@ -54,26 +57,34 @@ Page({ BookId: this.data.BookId, ChapterId: this.data.ChapterId, }, - }).then((res) => { - this.setData({ - book: { - ...res.book, - PublishDate: res.book.PublishTime.split(' ')[0], - }, - chapter: res.chapter, - prevAndNext: { - prev: Array.isArray(res.prevAndNext.prev) ? null : res.prevAndNext.prev, - next: Array.isArray(res.prevAndNext.next) ? null : res.prevAndNext.next, - }, - ChapterId: res.chapter.Id, - }); - if (res.chapter.AudioUrl?.url) { - const time = `00:00/${this.formatTime(res.chapter.AudioUrl.duration)}`; + showMsg: false, + }) + .then((res) => { this.setData({ - time, + book: { + ...res.book, + PublishDate: res.book.PublishTime.split(' ')[0], + }, + chapter: res.chapter, + prevAndNext: { + prev: Array.isArray(res.prevAndNext.prev) ? null : res.prevAndNext.prev, + next: Array.isArray(res.prevAndNext.next) ? null : res.prevAndNext.next, + }, + ChapterId: res.chapter.Id, }); - } - }); + if (res.chapter.AudioUrl?.url) { + const time = `00:00/${this.formatTime(res.chapter.AudioUrl.duration)}`; + this.setData({ + time, + }); + } + }) + .catch(() => { + this.setData({ + toastShow: true, + toastType: 3, + }); + }); }, handleDirectory() { this.setData({ @@ -178,6 +189,20 @@ Page({ const seconds = Math.floor(time % 60); return `${minutes < 10 ? `0${minutes}` : minutes}:${seconds < 10 ? `0${seconds}` : seconds}`; }, + handleAuthClose() { + this.setData({ + toastShow: false, + }); + wx.navigateBack(); + }, + handleAuthConform() { + this.setData({ + toastShow: false, + }); + wx.reLaunch({ + url: '/pages/login/index', + }); + }, }); export {}; diff --git a/src/pages/article/index.wxml b/src/pages/article/index.wxml index 2f8815f..8907e2f 100644 --- a/src/pages/article/index.wxml +++ b/src/pages/article/index.wxml @@ -58,7 +58,7 @@ 取消收藏 - + 收藏 @@ -90,3 +90,5 @@ + + diff --git a/src/pages/home/index.scss b/src/pages/home/index.scss index 1d7f26a..18caf08 100644 --- a/src/pages/home/index.scss +++ b/src/pages/home/index.scss @@ -51,7 +51,7 @@ page { display: flex; align-items: center; } - .wx-swiper-dot{ + .wx-swiper-dot { width: 8rpx; height: 8rpx; } @@ -104,6 +104,7 @@ page { font-size: 36rpx; color: #3795f7; line-height: 42rpx; + font-weight: bold; } .content { margin-top: 10rpx; diff --git a/src/pages/home/index.ts b/src/pages/home/index.ts index 03512a6..9ab9814 100644 --- a/src/pages/home/index.ts +++ b/src/pages/home/index.ts @@ -26,7 +26,7 @@ Page({ }); }); }, - handleTap(e) { + handleBanner(e) { const { index } = e.currentTarget.dataset; const bannerItem: any = this.data.bannerList[index]; if (bannerItem.configType === '1') { diff --git a/src/pages/home/index.wxml b/src/pages/home/index.wxml index 09678ce..6ae8a04 100644 --- a/src/pages/home/index.wxml +++ b/src/pages/home/index.wxml @@ -24,7 +24,7 @@ class="swiper-item" wx:for="{{bannerList}}" wx:key="configId" - bind:tap="handleTap" + bind:tap="handleBanner" data-index="{{index}}" >