|
|
|
@ -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 {}; |
|
|
|
|