共章
var params = (function() {
var url = location.href;
var q = {};
var _index = url.indexOf('?');
if (_index != -1) {
url = url.substr(_index + 1)
}
var _params = url.replace(/#.*/g, '').split('&');
for (var i = 0; i < _params.length; i++) {
var pair = _params[i].split('=');
if (pair[0] == '' || pair[1] == undefined) {
continue;
}
q[pair[0]] = pair[1]
}
return q
})();
MIP.setData({
bookId: params.bid,
pageNum: parseInt(params.page),
listApi: '/api/book/getChapterList?bid='+ params.bid + '&page=' + params.page
});
setTimeout(function() {
MIP.setData({
bookId: params.bid,
pageNum: parseInt(params.page),
listApi: '/api/book/getChapterList?bid='+ params.bid + '&page=' + params.page
})
}, 500)
var apis = {
HOST: 'https://prepare-m.zhangyue.com',
getChapter: function() {
fetch(this.HOST + MIP.getData('listApi'), {
method: 'POST'
}).then(function(data) {
return data.json()
}).then(function(res) {
if (res.code === 0) {
MIP.setData({
totalChapter: res.body.chapterList.page.totalRecord,
chapterList: res.body.chapterList.data
});
setTimeout(function() {
MIP.setData({
totalChapter: res.body.chapterList.page.totalRecord,
chapterList: res.body.chapterList.data
});
}, 500)
}
})
}
}
apis.getChapter();