var t = require("../../lib/aes.js"), e = getApp(), a = wx.getBackgroundAudioManager(); wx.getFileSystemManager(); Page({ data: { poetryId: void 0, poetry: void 0, tempFilePath: void 0, pinyin: !0, book: {}, path: "", filePath: void 0, pageIndex: 0, pageUrl: "", playing: !1, voicePlaying: !1, autoPlay: !1, chinese: "", trans: !1, isIphone: !1, recording: !1, recordList: [], rate: 1, showVoice: !1, voiceUrl: "" }, onLoad: function(t) { this.handleAutoPlay(); var e = "https://baby-1251951688.file.myqcloud.com/user/poetry/" + t.openid + "/" + t.id + ".mp3?t=" + new Date().getTime(); this.setData({ openid: t.openid, title: t.title, poetryId: t.id, voiceUrl: e }), this.getPoetry(); }, onReady: function() {}, onShow: function() {}, onUnload: function() { a.stop(); }, handleAutoPlay: function() { var t = this; a.onEnded(function(e) { t.setData({ voicePlaying: !1 }); }), a.onPause(function(e) { t.setData({ voicePlaying: !1 }); }), a.onPlay(function(e) { t.setData({ voicePlaying: !0 }); }), a.onError(function(e) { t.setData({ voicePlaying: !1 }); }); }, getPoetry: function() { var a = this, i = a.data.poetryId, o = e.globalData.API_URL + "/h5/api/textbook/poetry/detail", n = { id: i, type: "album" }; wx.request({ url: o, data: n, success: function(i) { var o = t.decrypt(i.data, e.globalData.key), n = JSON.parse(o); a.setData({ poetry: n }); } }); }, help: function(t) { this.setData({ showVoice: !0 }); }, choosePinyin: function(t) { this.setData({ pinyin: !this.data.pinyin }); }, gotoPoetry: function(t) { this.setData({ voicePlaying: !1 }), a.stop(), wx.navigateTo({ url: "../poetry-item/poetry-item?type=textbook&id=" + this.data.poetryId }); }, playRecord: function(t) { console.log(this.data.voicePlaying), console.log(this.data.voiceUrl), this.data.voicePlaying ? (this.setData({ voicePlaying: !1 }), a.pause()) : (this.setData({ voicePlaying: !0 }), a.src === this.data.voiceUrl || (a.src = this.data.voiceUrl, a.title = this.data.title), a.play()); }, getDateStr: function() { var t = new Date(), e = t.getFullYear(), a = t.getMonth() + 1, i = t.getDate(); a < 10 && (a = "0" + a), i < 10 && (i = "0" + i); var o = t.getHours(), n = t.getMinutes(), s = t.getSeconds(), r = t.getMilliseconds(); return o < 10 && (o = "0" + o), n < 10 && (n = "0" + n), s < 10 && (s = "0" + s), r < 10 && (s = "0" + r), e + "-" + a + "-" + i + " " + o + ":" + n + ":" + s; }, onShareAppMessage: function(t) { return { title: this.data.title, success: function(t) {}, fail: function(t) {} }; } });