myFile.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { documentList } from "../../api/document";
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. qrcodeDialog: false,
  8. currentPage: 1,
  9. hasNext: false,
  10. fileList: []
  11. },
  12. /**
  13. * 生命周期函数--监听页面显示
  14. */
  15. onShow() {
  16. this.getDocumentList()
  17. },
  18. // 获取档案列表
  19. getDocumentList () {
  20. var data = {
  21. currentPage: this.data.currentPage
  22. }
  23. wx.showLoading({
  24. title: '加载中...',
  25. mask: true
  26. })
  27. documentList(data).then(res => {
  28. wx.hideLoading()
  29. var response = res.data.vos
  30. response.map(item => {
  31. item.birthDay = item.birthday.split(' ')[0]
  32. })
  33. this.setData({
  34. hasNext: res.data.hasNext,
  35. fileList: response
  36. })
  37. }).catch(e => {
  38. wx.hideLoading()
  39. wx.showModal({
  40. content: e,
  41. confirmColor: '#333',
  42. showCancel: false
  43. })
  44. })
  45. },
  46. onReachBottom () {
  47. if (this.data.hasNext) {
  48. var _currentPag = this.data.currentPage + 1
  49. this.setData({
  50. currentPage: _currentPag
  51. })
  52. this.getDocumentList()
  53. }
  54. },
  55. /**
  56. * 新建档案
  57. */
  58. handleAddFile() {
  59. wx.showModal({
  60. content: '建档人数已达上限',
  61. confirmColor: '#333',
  62. showCancel: false
  63. })
  64. },
  65. /**
  66. * 管理档案
  67. */
  68. handleFile() {
  69. wx.navigateTo({
  70. url: '/pages/handleFile/handleFile',
  71. })
  72. },
  73. handleShowQRCode () {
  74. this.setData({
  75. qrcodeDialog: true
  76. })
  77. }
  78. })