榆山
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.
 
 

111 lines
2.6 KiB

var utils = require('../../utils/util');
const app = getApp()
Page({
data: {
index: 0,
indexPage: 1,
floorstatus: false,
childNav: [],//首页配置返回
tabs: [
{
key: 'tab1',
title: 'Tab 1',
},
{
key: 'tab2',
title: 'Tab 2',
},
{
key: 'tab3',
title: 'Tab 3',
},
{
key: 'tab4',
title: 'Tab 4',
},
],
isPartyFlag: 0
},
onLoad: function (options) {
const temp = Number(options.state) + 1
this.setData({
key: 'tab' + temp,
index: options.state,
childNav: JSON.parse(options.childNav),
isPartyFlag: options.isPartyFlag ? options.isPartyFlag : 0
})
},
onShow: function (options) {
this.setData({
indexPage:1
})
this.selectComponent("#state-" + this.data.index).getItemList(1, this.data.index, 0, this.data.isPartyFlag)
},
onReachBottom: function () {
this.setData({
indexPage: this.data.indexPage + 1
})
this.selectComponent("#state-" + this.data.index).getItemList(this.data.indexPage, this.data.index, 1, this.data.isPartyFlag)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function (options) {
this.selectComponent("#state-" + this.data.index).getItemList(1, this.data.index, 0, this.data.isPartyFlag)
wx.stopPullDownRefresh();
},
onChange(e) {
console.log('onChange', e)
this.setData({
current: e.detail.key,
})
},
onTabsChange(e) {
const {key} = e.detail
const index = this.data.tabs.map((n) => n.key).indexOf(key)
this.setData({
key,
index,
indexPage: 1
})
this.selectComponent("#state-" + this.data.index).getItemList(this.data.indexPage, this.data.index, 0, this.data.isPartyFlag)
},
onSwiperChange(e) {
console.log('onSwiperChange', e)
const {current: index, source} = e.detail
const {key} = this.data.tabs[index]
if (!!source) {
this.setData({
key,
index,
})
}
},
// 获取滚动条当前位置
onPageScroll: function (e) {
if (e.scrollTop > 100) {
this.setData({
floorstatus: true
});
} else {
this.setData({
floorstatus: false
});
}
},
//回到顶部
goTop: function (e) { // 一键回到顶部
if (wx.pageScrollTo) {
wx.pageScrollTo({
scrollTop: 0
})
} else {
wx.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
}
})