myFile.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. var _currentPag = this.data.currentPage + 1
  38. this.setData({
  39. currentPage: _currentPag
  40. })
  41. this.getDocumentList()
  42. },
  43. /**
  44. * 生命周期函数--监听页面隐藏
  45. */
  46. handleConfirm() {
  47. this.setData({ vanoverlayshow: false })
  48. },
  49. /**
  50. * 新建档案
  51. */
  52. handleAddFile() {
  53. this.setData({ vanoverlayshow: true })
  54. },
  55. /**
  56. * 管理档案
  57. */
  58. handleFile() {
  59. wx.navigateTo({
  60. url: '/pages/handleFile/handleFile',
  61. })
  62. },
  63. handleShowQRCode () {
  64. this.setData({
  65. qrcodeDialog: true
  66. })
  67. }
  68. })