// pages/readstart/readstart.js
Page({
data: {
isShow:false,
footerShow:false,
source:[], // 书源列表
sourceIndex:0, // 当前选中的书源
sourceText: [], // 书源的文字(因为showActionSheet需要一个类似这样(['A', 'B', 'C'])的数组,而source的每一项是对象 )
chapter:0, //当前章节
chapters:[], // 所有章节
chapterContent:{},
scrollTop:0
},
childShow(){
this.setData({
isShow: !this.data.isShow,
})
},
onLoad(options){
this.getSource(options) // 请求所有的书源 返回值是书源的列表,第一项是正版源。
},
showAll(){
this.setData({
footerShow: !this.data.footerShow,
isShow:false,
})
},
changeSource(){
var _this = this;
wx.showActionSheet({
itemList: this.data.sourceText,
success(res) {
_this.setData({
sourceIndex:res.tapIndex
})
}
})
},
getSource(options){
var _this = this;
wx.request({
url: "https://api.zhuishushenqi.com/atoc?view=summary&book=" + options.id,
success(res) {
var arr = [];
for (let i = 0; i < res.data.length; i++) {
arr[i] = res.data[i].name
}
_this.setData({
source: res.data,
sourceText: arr
}, _this.getChapters)
}
})
},
getChapters(){
var _this = this;
var sourceId = this.data.source[this.data.sourceIndex]._id; // 书源id
wx.request({
url: `https://api.zhuishushenqi.com/btoc/${sourceId}?view=chapters`,
success(res){
_this.setData({
chapters: res.data.chapters
}, _this.getNowChapter)
}
})
},
getNowChapter(){
var _this = this;
var link = this.data.chapters[this.data.chapter].link;
wx.request({
url: 'https://chapterup02.zhuishushenqi.com/chapter/'+link,
success(res){
_this.setData({
chapterContent:res.data,
scrollTop:0
});
wx.setNavigationBarTitle({
title: res.data.chapter.title
});
}
})
},
preChapter(){
if(this.data.chapter==0){
wx.showToast({
title: '已经是第一章了',
icon: 'none',
duration: 2000
})
}else{
this.setData({
chapter:this.data.chapter-1
},this.getNowChapter)
}
},
nextChapter() {
if (this.data.chapter == this.data.chapters.length-1) {
wx.showToast({
title: '已经是最后一章了',
icon: 'none',
duration: 2000
})
} else {
this.setData({
chapter: this.data.chapter + 1
}, this.getNowChapter)
}
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序综合小说库demo源码下载,前端
共44个文件
png:11个
json:9个
js:9个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 149 浏览量
2022-02-19
11:15:47
上传
评论
收藏 82KB ZIP 举报
温馨提示
微信小程序综合小说库demo源码下载,前端
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序综合小说库demo源码下载.zip (44个子文件)
微信小程序综合小说库demo源码下载
novel-master
asset
img
content-active.png 3KB
num.png 6KB
moon.png 10KB
book.png 6KB
moon-active.png 11KB
rank.png 3KB
rank-selected.png 3KB
content.png 3KB
num-active.png 7KB
home-selected.png 5KB
book-selected.png 6KB
app.json 1KB
pages
classifyInfo
classifyInfo.json 6B
classifyInfo.wxml 2KB
classifyInfo.wxss 1KB
classifyInfo.js 2KB
index
index.js 749B
index.json 6B
index.wxss 673B
index.wxml 1KB
book
book.json 2B
book.wxml 2KB
book.wxss 1KB
book.js 2KB
bookList
bookList.json 27B
bookList.js 812B
bookList.wxml 2KB
bookList.wxss 2KB
rank
rank.json 6B
rank.js 1KB
rank.wxml 2KB
rank.wxss 2KB
readstart
readstart.js 3KB
readstart.wxss 3KB
readstart.json 27B
readstart.wxml 2KB
itemDetailInfo
itemDetailInfo.wxml 2KB
itemDetailInfo.js 604B
itemDetailInfo.json 2B
itemDetailInfo.wxss 2KB
app.wxss 229B
app.js 131B
project.config.json 643B
utils
util.js 472B
共 44 条
- 1
资源评论
智慧浩海
- 粉丝: 1w+
- 资源: 5154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功