import { documentList } from "../../api/document"; Page({ /** * 页面的初始数据 */ data: { qrcodeDialog: false, currentPage: 1, hasNext: false, fileList: [] }, /** * 生命周期函数--监听页面显示 */ onShow() { this.getDocumentList() }, // 获取档案列表 getDocumentList () { var data = { currentPage: this.data.currentPage } wx.showLoading({ title: '加载中...', mask: true }) documentList(data).then(res => { wx.hideLoading() var response = res.data.vos response.map(item => { item.birthDay = item.birthday.split(' ')[0] }) this.setData({ hasNext: res.data.hasNext, fileList: response }) }).catch(e => { wx.hideLoading() wx.showModal({ content: e, confirmColor: '#333', showCancel: false }) }) }, onReachBottom () { if (this.data.hasNext) { var _currentPag = this.data.currentPage + 1 this.setData({ currentPage: _currentPag }) this.getDocumentList() } }, /** * 新建档案 */ handleAddFile() { wx.showModal({ content: '建档人数已达上限', confirmColor: '#333', showCancel: false }) }, /** * 管理档案 */ handleFile() { wx.navigateTo({ url: '/pages/handleFile/handleFile', }) }, handleShowQRCode () { this.setData({ qrcodeDialog: true }) } })