榆山数据端小程序
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.
 
 

149 lines
3.3 KiB

// miniprogram/subpages/issue/pages/controlProject/controlProject.js
import {getPlatformList} from '../../../../api/issue'
Page({
data: {
isClick:'unsolved',//默认解决中
isShow:false,
preloadVisible:true,
loadVisible:false,
loadType:'more',
dataLength:0,
list:[],
deptId:'',//部门id
pageIndex:1,
pageSize:10,
stateType:"1"//状态类型:1.待解决,2已解决
},
onLoad: function (options) {
this.setData({
deptId:options.deptId
})
this.getPlatformList()
},
// 页面切换
triggle(e: AnyObject){
this.setData({
preloadVisible:true,
isShow:false,
loadVisible:false
})
let {currentTarget}=e
if(currentTarget.dataset.index=="已解决"){
this.setData({
isClick:'resolved',
stateType:'2',
})
this.getPlatformList()
}else if(currentTarget.dataset.index=="解决中"){
this.setData({
isClick:'unsolved',
stateType:'1',
})
this.getPlatformList()
}
},
getPlatformList(){
let obj = {
deptId:this.data.deptId,
pageIndex:this.data.pageIndex,
pageSize:this.data.pageSize,
stateType:this.data.stateType
}
getPlatformList(obj).then((res:any)=>{
this.setData({
list:res.data,
dataLength:res.data.length,
preloadVisible:false
})
if(res.data.length==0){
this.setData({
isShow:true,
loadVisible:false
})
}
if(this.data.dataLength !==this.data.pageSize){
// 说明没有更多数据了
this.setData({
loadVisible:true,
loadType:'none'
})
}
}).catch(()=>{
this.setData({
preloadVisible:false,
isShow:true,
loadVisible:false
})
})
},
getBottomList(){
if(this.data.dataLength !==this.data.pageSize){
// 说明没有更多数据了
this.setData({
loadType:'none'
})
return
}
this.setData({
pageIndex:++this.data.pageIndex,
isShow:false,
loadVisible:true,
})
let obj = {
deptId:this.data.deptId,
pageIndex:this.data.pageIndex,
pageSize:this.data.pageSize,
stateType:this.data.stateType
}
getPlatformList(obj).then((res:any)=>{
this.setData({
list:this.data.list.concat(res.data),
dataLength:res.data.length
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log('到底了')
this.getBottomList()
},
})