You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
159 lines
3.7 KiB
JavaScript
159 lines
3.7 KiB
JavaScript
// pages/extend/index.js
|
|
const app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
currIndex: '1',
|
|
searchForm: {
|
|
pageNum: 1,
|
|
pageSize: 25,
|
|
event: '',
|
|
},
|
|
loading: false,
|
|
hasMoreData: true, //下拉是否还有更多数据
|
|
recordList: [],
|
|
},
|
|
changeMenu(e) {
|
|
var that = this;
|
|
that.data.searchForm.pageNum = 1;
|
|
if(e.currentTarget.dataset.id - 1 == 0) {
|
|
that.data.searchForm.event = '';
|
|
} else {
|
|
that.data.searchForm.event = e.currentTarget.dataset.id;
|
|
}
|
|
this.setData({
|
|
currIndex: e.currentTarget.dataset.id,
|
|
searchForm: that.data.searchForm,
|
|
recordList: [],
|
|
})
|
|
this.getList();
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getList();
|
|
},
|
|
|
|
getList() {
|
|
var that = this;
|
|
|
|
wx.request({
|
|
url: app.globalData.ip + "/agency/promition/list",
|
|
method: "POST",
|
|
header: app.globalData.headers,
|
|
data: that.data.searchForm,
|
|
success: function(res) {
|
|
console.log(res);
|
|
|
|
that.setData({
|
|
loading: true
|
|
});
|
|
|
|
if (app.isEmptyCheck(res.data.data)) {
|
|
that.setData({
|
|
hasMoreData: false
|
|
});
|
|
} else if (
|
|
res.data.data.list == null ||
|
|
res.data.data.list.length == 0 ||
|
|
res.data.data.list.length < 25
|
|
) {
|
|
res.data.data.list.forEach(item => {
|
|
var str = '';
|
|
if (app.isNotEmptyCheck(item.userName)) {
|
|
str = item.userName;
|
|
} else if (app.isNotEmptyCheck(item.nickName)) {
|
|
str = item.nickName;
|
|
} else if (app.isNotEmptyCheck(item.tel)) {
|
|
str = '*' + item.tel.substring(item.tel.length - 4);
|
|
}
|
|
item.userName = str;
|
|
});
|
|
that.data.recordList = that.data.recordList.concat(res.data.data.list);
|
|
|
|
that.setData({
|
|
hasMoreData: false
|
|
});
|
|
|
|
that.setData({
|
|
recordList: that.data.recordList,
|
|
});
|
|
} else {
|
|
res.data.data.list.forEach(item => {
|
|
var str = '';
|
|
if (app.isNotEmptyCheck(item.userName)) {
|
|
str = item.userName;
|
|
} else if (app.isNotEmptyCheck(item.nickName)) {
|
|
str = item.nickName;
|
|
} else if (app.isNotEmptyCheck(item.tel)) {
|
|
str = '*' + item.tel.substring(item.tel.length - 4);
|
|
}
|
|
item.userName = str;
|
|
});
|
|
that.data.recordList = that.data.recordList.concat(res.data.data.list);
|
|
|
|
that.setData({
|
|
recordList: that.data.recordList,
|
|
});
|
|
}
|
|
that.setData({
|
|
loading: false,
|
|
});
|
|
}
|
|
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
// onShareAppMessage: function () {
|
|
|
|
// }
|
|
}) |