84 lines
2.3 KiB
JavaScript
84 lines
2.3 KiB
JavaScript
var t = require("../../lib/aes.js"), e = getApp();
|
|
|
|
Page({
|
|
data: {
|
|
textbookPoetryList: [],
|
|
id: void 0,
|
|
title: "",
|
|
currentPlayIndex: -1,
|
|
currentBook: {},
|
|
playing: !1,
|
|
type: "album",
|
|
page: 0
|
|
},
|
|
onLoad: function(t) {
|
|
var e = t.id, a = t.title, i = t.type;
|
|
this.setData({
|
|
id: e,
|
|
title: a
|
|
}), i && this.setData({
|
|
type: i
|
|
}), this.getAlbumPoetryList();
|
|
},
|
|
onUnload: function(t) {},
|
|
onShow: function() {},
|
|
getAlbumPoetryList: function(a) {
|
|
var i = this, o = e.globalData.API_URL + "/h5/api/textbook/poetry/album", r = {
|
|
albumId: i.data.id,
|
|
page: i.data.page
|
|
};
|
|
wx.request({
|
|
url: o,
|
|
data: r,
|
|
success: function(a) {
|
|
var o = t.decrypt(a.data, e.globalData.key), r = JSON.parse(o);
|
|
if (0 == r.length) ; else {
|
|
for (var n = i.data.textbookPoetryList, s = 0; s < r.length; s++) n.push(r[s]);
|
|
i.setData({
|
|
textbookPoetryList: n
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
gotoPoetry: function(t) {
|
|
this.setData({
|
|
playing: !1,
|
|
currentPlayIndex: -1
|
|
});
|
|
var e = t.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
url: "../poetry-item/poetry-item?type=" + this.data.type + "&id=" + e
|
|
});
|
|
},
|
|
gotoQuestion: function(t) {
|
|
this.setData({
|
|
playing: !1,
|
|
currentPlayIndex: -1
|
|
});
|
|
var e = t.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
url: "../kewen-exercise/kewen-exercise?id=" + e
|
|
});
|
|
},
|
|
toRecord: function(t) {
|
|
var e = t.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
url: "../record/record?id=" + e
|
|
});
|
|
},
|
|
onReachBottom: function() {
|
|
var t = this.data.page;
|
|
this.setData({
|
|
page: ++t
|
|
}), this.getAlbumPoetryList();
|
|
},
|
|
onShareAppMessage: function(t) {
|
|
return {
|
|
title: e.globalData.share_title,
|
|
path: "/pages/index/index",
|
|
success: function(t) {},
|
|
fail: function(t) {}
|
|
};
|
|
}
|
|
}); |