You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
// pages/fenlei/fenlei.js
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
'book':[],
|
|
|
|
|
cateItems: [
|
|
|
|
|
{
|
|
|
|
|
cate_id: 1,
|
|
|
|
|
cate_name: "玄幻",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
// children:
|
|
|
|
|
// [
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 1,
|
|
|
|
|
// name: '福尔摩斯',
|
|
|
|
|
// image: "/pages/index/image/xs1.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 2,
|
|
|
|
|
// name: '莫泊桑',
|
|
|
|
|
// image: "/pages/index/image/xs2.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 3,
|
|
|
|
|
// name: '盗墓笔记',
|
|
|
|
|
// image: "/pages/index/image/xs3.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 4,
|
|
|
|
|
// name: '明朝那些事',
|
|
|
|
|
// image: "/pages/index/image/xs4.jpg"
|
|
|
|
|
// }
|
|
|
|
|
// ]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
cate_id: 2,
|
|
|
|
|
cate_name: "魔幻",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
// children:
|
|
|
|
|
// [
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 1,
|
|
|
|
|
// name: '世界百科',
|
|
|
|
|
// image: "/pages/index/image/kxqk1.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 2,
|
|
|
|
|
// name: '动物百科',
|
|
|
|
|
// image: "/pages/index/image/kxqk2.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 3,
|
|
|
|
|
// name: '趣味科学',
|
|
|
|
|
// image: "/pages/index/image/kxqk3.jpg"
|
|
|
|
|
// }
|
|
|
|
|
// ]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
cate_id: 3,
|
|
|
|
|
cate_name: "奇幻",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
// children:
|
|
|
|
|
// [
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 1,
|
|
|
|
|
// name: '父与子全集',
|
|
|
|
|
// image: "/pages/index/image/etsj1.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 2,
|
|
|
|
|
// name: '丁丁历险记',
|
|
|
|
|
// image: "/pages/index/image/etsj2.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 3,
|
|
|
|
|
// name: '美丽星空',
|
|
|
|
|
// image: "/pages/index/image/etsj3.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 4,
|
|
|
|
|
// name: '小虎神探队',
|
|
|
|
|
// image: "/pages/index/image/etsj4.jpg"
|
|
|
|
|
// }
|
|
|
|
|
// ]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
cate_id: 4,
|
|
|
|
|
cate_name: "都市",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
// children: [
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 1,
|
|
|
|
|
// name: 'Java Web',
|
|
|
|
|
// image: "/pages/index/image/java.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// child_id: 2,
|
|
|
|
|
// name: '计算机网络',
|
|
|
|
|
// image:"/pages/index/image/jsswl.jpg"
|
|
|
|
|
// },
|
|
|
|
|
// ]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
curNav: 1,
|
|
|
|
|
curIndex: 0
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onload:function(){
|
|
|
|
|
var thats = this
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/GetFrontInfo.do?type=" + 1,
|
|
|
|
|
header: {
|
|
|
|
|
"content-type": "json"
|
|
|
|
|
},
|
|
|
|
|
success: function (res) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
thats.setData({
|
|
|
|
|
book: res.data,
|
|
|
|
|
})
|
|
|
|
|
//wx.hideNavigationBarLoading()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//事件处理函数
|
|
|
|
|
switchRightTab: function (e) {
|
|
|
|
|
// 获取item项的id,和数组的下标值
|
|
|
|
|
let id = e.target.dataset.id,
|
|
|
|
|
index = parseInt(e.target.dataset.index);
|
|
|
|
|
console.log(id)
|
|
|
|
|
var thats = this
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/GetFrontInfo.do?type="+id,
|
|
|
|
|
header: {
|
|
|
|
|
"content-type": "json"
|
|
|
|
|
},
|
|
|
|
|
success: function (res) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
thats.setData({
|
|
|
|
|
book: res.data,
|
|
|
|
|
ppt: res.data
|
|
|
|
|
})
|
|
|
|
|
//wx.hideNavigationBarLoading()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 把点击到的某一项,设为当前index
|
|
|
|
|
this.setData({
|
|
|
|
|
curNav: id,
|
|
|
|
|
curIndex: index
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|