From de24de6d5864d4352c10c076417caf5f7e2b70d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sat, 29 Dec 2018 20:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=B0=E5=BF=86=E6=92=AD?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/app.js | 15 ++++++++++++--- js/modules/local.js | 8 -------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/js/app.js b/js/app.js index 9131885..29b3302 100644 --- a/js/app.js +++ b/js/app.js @@ -348,10 +348,19 @@ Anot({ this.isPlaying = true } else { if (SONIST.stat === 'ready') { - if (this.isPlaying) { - SONIST.pause() + if (this.curr.id) { + if (this.isPlaying) { + SONIST.pause() + } else { + SONIST.play() + } } else { - SONIST.play() + let lastPlay = Anot.ls('last-play') || 0 + SONIST.play(lastPlay).then(it => { + it.time = 0 + this.updateCurr(it) + this.draw() + }) } this.isPlaying = !this.isPlaying } diff --git a/js/modules/local.js b/js/modules/local.js index 3802e84..75715c3 100644 --- a/js/modules/local.js +++ b/js/modules/local.js @@ -44,17 +44,9 @@ export default Anot({ dbCache = null this.__APP__ = Anot.vmodels.app this.list = LS.getAll() - let lastPlay = Anot.ls('last-play') || 0 SONIST.clear() SONIST.push(LS.getAll()) - - // if (appInit.autoPlay) { - // SONIST.play(lastPlay).then(it => { - // this.__APP__.play(it) - // this.curr = it.id - // }) - // } }, watch: { 'props.curr'(v) {