myFile.js 1.3 KB

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