fileItem.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // component/fileItem/fileItem.ts
  2. import { TimeUtil } from '../../utils/TimeUtil'
  3. import { httpUtil } from "../../utils/restful";
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. itemData: null
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. fileUploadTime: ''
  16. },
  17. lifetimes: {
  18. attached: function () {
  19. // 在组件实例被从页面节点树添加时执行
  20. console.log("fileItem:", this.properties.itemData.uploadTime)
  21. this.setData({
  22. fileUploadTime: TimeUtil.dateFormat(parseInt(this.properties.itemData.uploadTime), "yyyy-MM-dd HH:mm"),
  23. })
  24. },
  25. detached: function () {
  26. // 在组件实例被从页面节点树移除时执行
  27. },
  28. },
  29. /**
  30. * 组件的方法列表
  31. */
  32. methods: {
  33. clickFileItem: function (event: any) {
  34. console.log("event.currentTarget.id:", event.currentTarget.id)
  35. //根据ID查询文件库下所有文件
  36. let params = {
  37. lessId: event.currentTarget.id,
  38. userId: httpUtil.httpData.userId,
  39. pageNo: 1,
  40. pageSize: 100000,
  41. }
  42. httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => {
  43. console.log("获取所有文件成功:", res)
  44. }).catch((res) => {
  45. console.log("获取所有文件失败:", res)
  46. })
  47. },
  48. clickMore: function (event: any) {
  49. console.log("event.currentTarget.id:more----------", event.currentTarget.id)
  50. }
  51. }
  52. })