document.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // pages/document/document.ts
  2. import { httpUtil } from "../../utils/restful"
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. lessId: '',
  9. itemList: null
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad(options) {
  15. this.setData({
  16. lessId: options.lessId
  17. })
  18. this.getDocumentAll();
  19. console.log("this.data.itemList:", this.data.itemList)
  20. },
  21. showActionWindow: function (evnet: any) {
  22. console.log("event:", evnet.detail.item)
  23. this.selectComponent("#popupwindow").showModal(evnet.detail.item, 1)
  24. },
  25. fileDel: function () {
  26. //文件删除了就重新请求刷新一下
  27. this.getDocumentAll();
  28. },
  29. getDocumentAll() {
  30. //根据ID查询文件库下所有文件
  31. let params = {
  32. lessId: this.data.lessId,
  33. userId: httpUtil.httpData.userId,
  34. pageNo: 1,
  35. pageSize: 100000,
  36. }
  37. httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => {
  38. console.log("获取所有文件成功:", res)
  39. this.setData({
  40. itemList: res.data.data.list
  41. })
  42. }).catch((res) => {
  43. console.log("获取所有文件失败:", res)
  44. })
  45. }
  46. })