feat: 样式调整
This commit is contained in:
@@ -9,8 +9,10 @@ Component({
|
||||
activeContent: null,
|
||||
isPlaying: false,
|
||||
progressPercent: 0,
|
||||
currentTime: 0,
|
||||
duration: 0,
|
||||
show: false,
|
||||
channelIcon: '📻' // 直接存储 emoji 字符(来自频道 cover 字段)
|
||||
channelIcon: '📻'
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
@@ -31,8 +33,11 @@ Component({
|
||||
|
||||
// 监听时间更新
|
||||
this._onTimeUpdate = (data) => {
|
||||
if (this._isSeeking) return
|
||||
if (data.duration > 0) {
|
||||
this.setData({
|
||||
currentTime: Math.floor(data.currentTime),
|
||||
duration: Math.floor(data.duration),
|
||||
progressPercent: Math.min((data.currentTime / data.duration) * 100, 100)
|
||||
})
|
||||
}
|
||||
@@ -62,6 +67,8 @@ Component({
|
||||
activeContent: gd.activeContent,
|
||||
isPlaying: gd.isPlaying,
|
||||
show: !!gd.activeContent,
|
||||
currentTime: Math.floor(gd.currentTime || 0),
|
||||
duration: Math.floor(gd.duration || 0),
|
||||
progressPercent: gd.duration > 0
|
||||
? Math.min((gd.currentTime / gd.duration) * 100, 100)
|
||||
: 0
|
||||
@@ -91,8 +98,25 @@ Component({
|
||||
*/
|
||||
goToPlayer() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/player/index'
|
||||
url: '/pages/player/index',
|
||||
routeType: 'none'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 进度条拖动中
|
||||
*/
|
||||
onProgressChanging(e) {
|
||||
this._isSeeking = true
|
||||
this.setData({ currentTime: e.detail.value })
|
||||
},
|
||||
|
||||
/**
|
||||
* 进度条拖动结束
|
||||
*/
|
||||
onProgressChange(e) {
|
||||
this._isSeeking = false
|
||||
app.seekTo(e.detail.value)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user