51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
/*
|
|
* 手太欠
|
|
* 愿这世界都如故事里一样 美好而动人~
|
|
*/
|
|
|
|
Page({
|
|
data: {
|
|
helpsArr: [], //帮助列表
|
|
},
|
|
|
|
onLoad(options) {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
// 获取帮助分类
|
|
this.helpsNavInfo();
|
|
},
|
|
|
|
/**
|
|
* 帮助分类
|
|
*/
|
|
helpsNavInfo() {
|
|
wx.$api.user.helpsNav().then(res => {
|
|
let listArr = this.data.helpsArr,
|
|
newData = []
|
|
for(let i of res.data){
|
|
for(let j of i.children){
|
|
j.isMore = false
|
|
}
|
|
}
|
|
newData = listArr.concat(res.data)
|
|
this.setData({
|
|
helpsArr: newData
|
|
})
|
|
}).catch(err => {})
|
|
},
|
|
|
|
/**
|
|
* 文字展开
|
|
*/
|
|
textMore(e){
|
|
let childIndex = e.currentTarget.dataset.index,
|
|
parentIndex = e.currentTarget.dataset.parent
|
|
this.setData({
|
|
[`helpsArr[${parentIndex}].children[${childIndex}].isMore`]: !this.data.helpsArr[parentIndex].children[childIndex].isMore
|
|
});
|
|
}
|
|
})
|
|
|