// pages/businessSchedule/businessSchedule.js
|
const app = getApp()
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
loading: app.globalData.imgUrl +'/image/loading.svg',
|
navbar: ['全部', '未回复', '已回复'],
|
currentTab: 0,
|
size: 10,
|
size1: 10,
|
size2: 10,
|
content: '------加载中------',
|
hasMoreData: true,
|
createTime: '',
|
dataSet: []
|
},
|
|
navbarTap: function(e) {
|
this.setData({
|
currentTab: e.currentTarget.dataset.idx
|
})
|
this.showList(this.data.currentTab)
|
|
},
|
|
showList: function(tab) {
|
var userinfo = wx.getStorageSync("user");
|
var that = this;
|
var id = userinfo.id
|
var str;
|
var sizeQty;
|
switch (tab) {
|
case 0:
|
str = "&status=";
|
sizeQty = 'size';
|
break;
|
case 1:
|
str = "&status=1";
|
sizeQty = 'size1';
|
break;
|
case 2:
|
str = "&status=2";
|
sizeQty = 'size2';
|
break;
|
}
|
wx.request({
|
url: app.globalData.url + '/api/businessAggr/draftQuery?page=1&size=' + that.data[sizeQty] + '&userId=' + id + '&flag=message' + str,
|
success: function(res) {
|
if (res.data.code == 0) {
|
(res.data.data.content).forEach(e => {
|
(e.createTime) = app.formatDate(e.createTime)
|
switch (e.businessType) {
|
case '扫黑除恶':
|
e.iconSrc = app.globalData.imgUrl +'/image/businessManage/saoheichue_b.png';
|
break;
|
case '公益随手拍':
|
e.iconSrc = app.globalData.imgUrl +'/image/businessManage/suishoupai_b.png';
|
break;
|
case '联络站':
|
if (e.stationType == 4) {
|
e.businessType = "人大代表联络站";
|
e.flag = 'renda';
|
}
|
if (e.stationType == 3) {
|
e.businessType = "特约检察员监督员联络站";
|
e.flag = 'teyue';
|
}
|
if (e.stationType == 2) {
|
e.businessType = "政协委员联络员联络站";
|
e.flag = 'zhengxie';
|
}
|
if (e.stationType == 1) {
|
e.businessType = "人民监督员联络站";
|
e.flag = 'renmin';
|
}
|
e.businessType1 = "联络站";
|
e.iconSrc = app.globalData.imgUrl + '/image/icon_lianluo.svg';
|
break;
|
case '投诉建议':
|
e.iconSrc = app.globalData.imgUrl +'/image/businessManage/icon_tousujianyi@2x.png'
|
}
|
|
|
});
|
if (res.data.data.totalElements < that.data[sizeQty]) {
|
that.setData({
|
dataSet: res.data.data.content,
|
hasMoreData: false,
|
content: '------我是有底线的------'
|
})
|
} else {
|
that.setData({
|
dataSet: res.data.data.content,
|
hasMoreData: true,
|
content: '------加载更多------',
|
[sizeQty]: that.data[sizeQty] + 10
|
})
|
}
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "请求失败!"
|
})
|
}
|
}
|
})
|
},
|
|
businessSchedule: function(event) {
|
var id = event.currentTarget.id;
|
var businessType = this.data.dataSet[id].businessType;
|
var businessId = this.data.dataSet[id].businessId;
|
var businessType1 = this.data.dataSet[id].businessType1 || '';
|
var flag = this.data.dataSet[id].flag || '';
|
var picType = this.data.dataSet[id].picType || '';
|
if (businessType == "公益随手拍") {
|
wx.navigateTo({
|
url: '../publicSnapshot/publicSnapshot?id=' + businessId + '&type=' + picType,
|
})
|
} else if (businessType == "扫黑除恶") {
|
wx.navigateTo({
|
url: '../scanEvildoing/scanEvildoing?id=' + businessId,
|
})
|
} else if (businessType == "投诉建议") {
|
wx.navigateTo({
|
url: '../complaintAdvice/complaintAdvice?id=' + businessId,
|
})
|
} else if (businessType1 == "联络站") {
|
wx.navigateTo({
|
url: '../junctionStation/junctionStation?id=' + businessId + '&flag=' + flag,
|
})
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "文件错误!"
|
})
|
}
|
},
|
|
onLoad: function() {
|
this.showList(0)
|
},
|
|
/**
|
* 页面上拉触底事件的处理函数
|
*/
|
onReachBottom: function() {
|
if (this.data.hasMoreData) {
|
this.showList(this.data.currentTab)
|
this.setData({
|
content: '------加载更多------'
|
})
|
} else {
|
this.setData({
|
content: '------我是有底线的------'
|
})
|
}
|
},
|
|
})
|