Browse Source

部分bug处理

master
kola-web 3 months ago
parent
commit
640c44b58b
  1. 2
      src/app.ts
  2. 39
      src/components/global-toast/index.scss
  3. 3
      src/components/global-toast/index.ts
  4. 19
      src/components/global-toast/index.wxml
  5. 3
      src/pages/article/index.json
  6. 61
      src/pages/article/index.ts
  7. 4
      src/pages/article/index.wxml
  8. 3
      src/pages/home/index.scss
  9. 2
      src/pages/home/index.ts
  10. 2
      src/pages/home/index.wxml

2
src/app.ts

@ -74,7 +74,7 @@ App<IAppOption>({ @@ -74,7 +74,7 @@ App<IAppOption>({
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' });

39
src/components/global-toast/index.scss

@ -25,3 +25,42 @@ @@ -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;
}
}

3
src/components/global-toast/index.ts

@ -29,6 +29,9 @@ Component({ @@ -29,6 +29,9 @@ Component({
*
*/
methods: {
handleConform() {
this.triggerEvent('conform');
},
handleClose() {
this.triggerEvent('close');
},

19
src/components/global-toast/index.wxml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
custom-style="background: transparent;"
bind:close="handleClose"
>
<view class="popup1" style="background: url('/images/popup1-bg.png') no-repeat top center/100%">
<view class="popup1" style="background: url('{{imageUrl}}popup1-bg.png?t={{Timestamp}}') no-repeat top center/100%">
<view class="title">关注适中健康微信公众号</view>
<image
class="code"
@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
custom-style="background: transparent;"
bind:close="handleClose"
>
<view class="popup1" style="background: url('/images/popup1-bg.png') no-repeat top center/100%">
<view class="popup1" style="background: url('{{imageUrl}}popup1-bg.png?t={{Timestamp}}') no-repeat top center/100%">
<view class="title">添加我的企业微信</view>
<image
class="code"
@ -31,3 +31,18 @@ @@ -31,3 +31,18 @@
<view class="tip">长按识别二维码关注</view>
</view>
</van-popup>
<van-popup
show="{{ show }}"
wx:if="{{type===3}}"
custom-style="background: transparent;"
bind:close="handleClose"
>
<view class="popup3">
<view class="title">该账号未开通阅读权益</view>
<view class="tip">此小程序暂时仅供经邀请的企业用户使用,请换个手机号登录以完成身份验证。</view>
<view class="btn1" bind:tap="handleConform">换个手机号登录</view>
<view class="btn2" bind:close="handleClose">取消</view>
</view>
</van-popup>

3
src/pages/article/index.json

@ -4,6 +4,7 @@ @@ -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"
}
}

61
src/pages/article/index.ts

@ -15,6 +15,9 @@ Page({ @@ -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({ @@ -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({ @@ -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 {};

4
src/pages/article/index.wxml

@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
取消收藏
</view>
<view class="item" wx:else bind:tap="handleCollect">
<image class="icon" src="{{imageUrl}}icon-collection.png?t={{Timestamp}}"></image>
<image class="icon" src="{{imageUrl}}icon-collection1.png?t={{Timestamp}}"></image>
收藏
</view>
</view>
@ -90,3 +90,5 @@ @@ -90,3 +90,5 @@
</view>
</view>
</van-popup>
<global-toast show="{{toastShow}}" type="{{toastType}}" bind:close="handleAuthClose" bind:conform="handleAuthConform"></global-toast>

3
src/pages/home/index.scss

@ -51,7 +51,7 @@ page { @@ -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 { @@ -104,6 +104,7 @@ page {
font-size: 36rpx;
color: #3795f7;
line-height: 42rpx;
font-weight: bold;
}
.content {
margin-top: 10rpx;

2
src/pages/home/index.ts

@ -26,7 +26,7 @@ Page({ @@ -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') {

2
src/pages/home/index.wxml

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
class="swiper-item"
wx:for="{{bannerList}}"
wx:key="configId"
bind:tap="handleTap"
bind:tap="handleBanner"
data-index="{{index}}"
>
<image

Loading…
Cancel
Save