timer = setInterval(function () {
nowTime -=1
if (nowTime == -1) {
that.setData({
awaitShow: false,
playTime: 0,
playIndex: parseInt(that.data.playIndex) + 1,
scrollIndex: that.data.playIndex+1
})
clearInterval(timer)
timer = null
if (that.data.systemMes == 'i') {
that.musicNow.pause()
} else {
that.awaitMusic.pause()
that.awaitMusic.destroy()
}
that.playTimeNow()
} else {
that.setData({
playTime: all - nowTime,
nowTime: (parseInt(nowTime / 60) >= 10 ? parseInt(nowTime / 60) : ("0" + parseInt(nowTime / 60))) + ":" + (parseInt(nowTime % 60) < 10 ? ("0" + parseInt(nowTime % 60)) : parseInt(nowTime % 60))
})
if (that.data.nowTime == "00:03") {
that.resetMusic.play()
if (that.data.systemMes == 'i') {
that.musicNow.pause()
} else {
that.awaitMusic.pause()
that.awaitMusic.destroy()
}
}
}
}, 1000)
有时侯会出现卡顿,卡顿之后会跳过某一段时间
两眼一抹黑,你在打什么
一屏幕代码,猜都猜不来
---
就是定时器在调的时候,我会输出nowTime,有时nowTime会从00:30隔几秒钟之后直接到00:24,这间隔的时间之内没有输出