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.
84 lines
1.9 KiB
84 lines
1.9 KiB
5 years ago
|
// subpages/understandJs/pages/archives/archives.js
|
||
|
const api = require('../../../../utils/understandJs')
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
pageIndex: 1,
|
||
|
pageSize: 10,
|
||
|
deptList: [],
|
||
|
nodata: false,
|
||
|
loadMoreType: 'none',
|
||
|
loadMoreVisible: false
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
this.getFullDictInfo()
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
this.setData({
|
||
|
searchContent: ''
|
||
|
})
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
this.setData({
|
||
|
loadMoreVisible: true
|
||
|
})
|
||
|
if (this.data.loadMoreType === 'loading') {
|
||
|
this.setData({
|
||
|
pageIndex: this.data.pageIndex + 1,
|
||
|
pageSize: this.data.pageSize,
|
||
|
})
|
||
|
this.getFullDictInfo()
|
||
|
}
|
||
|
},
|
||
|
|
||
|
getFullDictInfo () {
|
||
|
const dictType = 'notice_yjfu_lbzx'
|
||
|
api.getFullDictInfo(dictType).then(res => {
|
||
|
console.log(res)
|
||
|
this.setData({
|
||
|
deptList: [...this.data.deptList,...res.data],
|
||
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
|
||
|
loadMoreVisible: res.data.length === this.data.pageSize ? false : true
|
||
|
})
|
||
|
if (this.data.deptList.length == 0) {
|
||
|
this.setData({
|
||
|
nodata: true,
|
||
|
loadMoreType: 'none',
|
||
|
loadMoreVisible: false,
|
||
|
})
|
||
|
}
|
||
|
}).catch(err => {
|
||
|
this.setData({
|
||
|
deptList: [],
|
||
|
nodata: true,
|
||
|
loadMoreType: 'none',
|
||
|
loadMoreVisible: false,
|
||
|
})
|
||
|
console.log(err)
|
||
|
})
|
||
|
},
|
||
|
/**
|
||
|
* 跳转页面
|
||
|
*/
|
||
|
navigateToDict (e) {
|
||
|
console.log(e.currentTarget.dataset.dict)
|
||
|
wx.navigateTo({
|
||
|
url: `../laobingzaixianDict/laobingzaixianDict?dictName=${e.currentTarget.dataset.dict.dictName}&dictType=${e.currentTarget.dataset.dict.dictType}&dictValue=${e.currentTarget.dataset.dict.dictValue}`
|
||
|
})
|
||
|
}
|
||
|
})
|