teacherFile.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // component/teacher/teacherFile/teacherFile.ts
  2. import { httpUtil } from '../../../utils/restful'
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. },
  9. /**
  10. * 组件的初始数据
  11. */
  12. data: {
  13. fileList: [],
  14. hiddenInput: false,
  15. inputText: ''
  16. },
  17. lifetimes: {
  18. attached: function () {
  19. // 在组件实例被从页面节点树添加时执行
  20. this.getLessAll()
  21. },
  22. detached: function () {
  23. // 在组件实例被从页面节点树移除时执行
  24. },
  25. },
  26. /**
  27. * 组件的方法列表
  28. */
  29. methods: {
  30. getLessAll: function () {
  31. let params = {
  32. pageNo: 1,
  33. pageSize: 10000,
  34. title: this.data.inputText
  35. }
  36. httpUtil.wxGet(httpUtil.interfaces.createLess, params).then((res: any) => {
  37. console.log("获取所有文件库成功", res)
  38. this.setData({
  39. fileList: res.data.data.list
  40. })
  41. }).catch((res) => {
  42. console.log("获取所有文件库失败:", res)
  43. })
  44. },
  45. inputSearch: function (e) {
  46. let content = e.detail.value['search - input'] ? e.detail.value['search - input'] : e.detail.value
  47. this.setData({
  48. inputText: content
  49. })
  50. console.log(" this.data.inputText:", this.data.inputText)
  51. this.getLessAll()
  52. },
  53. showWindow: function (event: any) {
  54. // console.log("点击了更多的按钮:", event)
  55. this.triggerEvent("showWindow", { item: event.detail.item })
  56. this.setData({
  57. hiddenInput: true
  58. })
  59. },
  60. hideWindow: function () {
  61. console.log("hideWindow-- -- -- --")
  62. this.setData({
  63. hiddenInput: false
  64. })
  65. },
  66. realod: function () {
  67. this.getLessAll()
  68. }
  69. }
  70. })