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.
105 lines
2.6 KiB
105 lines
2.6 KiB
var utils = require('../../../utils/util');
|
|
const app = getApp()
|
|
Page({
|
|
data: {
|
|
index: 0,
|
|
indexPage: 1,
|
|
date: utils.formatTimestamp(new Date()),
|
|
state:0,
|
|
childNav: [],//首页配置返回
|
|
tabs: [
|
|
{
|
|
key: 'tab1',
|
|
title: 'Tab 1',
|
|
},
|
|
{
|
|
key: 'tab2',
|
|
title: 'Tab 2',
|
|
},
|
|
{
|
|
key: 'tab3',
|
|
title: 'Tab 3',
|
|
},
|
|
{
|
|
key: 'tab4',
|
|
title: 'Tab 4',
|
|
},
|
|
],
|
|
},
|
|
onLoad: function (options) {
|
|
this.state = options.state;
|
|
this.setData({
|
|
childNav: JSON.parse(options.childNav)
|
|
})
|
|
// const key = this.data.tabs[options.state].key;
|
|
// this.setData({
|
|
// current: this.data.tabs[options.state].key,
|
|
// clear:0,
|
|
// index: options.state,
|
|
// date: utils.formatTimestamp(new Date()),
|
|
// key
|
|
// })
|
|
// this.selectComponent("#state-" + this.data.index).getUserManagelist(this.data)
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function (options) {
|
|
const key = this.data.tabs[this.state].key
|
|
this.setData({
|
|
current: this.data.tabs[this.state].key,
|
|
clear: 1,
|
|
indexPage: 1,
|
|
index: this.state,
|
|
date: utils.formatTimestamp(new Date()),
|
|
key
|
|
})
|
|
this.selectComponent("#state-" + this.data.index).getUserManagelist(this.data)
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function (options) {
|
|
const key = this.data.tabs[this.state].key
|
|
this.setData({
|
|
current: this.data.tabs[this.state].key,
|
|
clear: 1,
|
|
indexPage: 1,
|
|
index: this.state,
|
|
date: utils.formatTimestamp(new Date()),
|
|
key
|
|
})
|
|
wx.stopPullDownRefresh();
|
|
this.selectComponent("#state-" + this.data.index).getUserManagelist(this.data)
|
|
},
|
|
|
|
onReachBottom: function () {
|
|
this.setData({
|
|
clear: 0,
|
|
indexPage: this.data.indexPage + 1
|
|
})
|
|
this.selectComponent("#state-" + this.data.index).getUserManagelist(this.data)
|
|
},
|
|
onTabsChange(e) {
|
|
if (e.detail.key == 'tab1'){
|
|
this.state = 0;
|
|
} else if (e.detail.key == 'tab2'){
|
|
this.state = 1;
|
|
} else if (e.detail.key == 'tab3') {
|
|
this.state = 2;
|
|
} else if (e.detail.key == 'tab4') {
|
|
this.state = 3;
|
|
}
|
|
const { key } = e.detail
|
|
const index = this.data.tabs.map((n) => n.key).indexOf(key)
|
|
this.setData({
|
|
key,
|
|
index,
|
|
indexPage: 1,
|
|
clear: 1,
|
|
date: utils.formatTimestamp(new Date())
|
|
})
|
|
this.selectComponent("#state-" + this.data.index).getUserManagelist(this.data)
|
|
}
|
|
})
|
|
|