index.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import { BusController } from "@/controllers/natsController";
  2. import { TreeController } from "@/controllers/queentreeController";
  3. import { Dict_Apis } from "@/dict";
  4. import { PageListController, UploadController } from "@queenjs/controllers";
  5. import { ModuleRoot } from "queenjs";
  6. import { actions } from "./actions";
  7. import { compoents } from "./components";
  8. import { helper } from "./helper";
  9. import { http } from "./http";
  10. import { store } from "./store";
  11. export class ResourceModule extends ModuleRoot {
  12. config = this.setConfig({
  13. httpConfig: {
  14. baseURL: Dict_Apis.promotion,
  15. },
  16. });
  17. actions = this.createActions(actions);
  18. components = this.useComponents(compoents);
  19. store = this.createStore([store]);
  20. https = this.createHttps(http);
  21. helper = this.createHelper(helper);
  22. controls = {
  23. uploader: new UploadController({
  24. httpConfig: {
  25. baseURL: Dict_Apis.queentree,
  26. },
  27. dir: "queenshow",
  28. }),
  29. promotionListCtrl: new PageListController(this.config?.httpConfig),
  30. materialListCtrl: new PageListController(this.config?.httpConfig),
  31. matTempListCtrl: new PageListController(this.config?.httpConfig),
  32. renderTaskListCtrl: new PageListController(this.config?.httpConfig),
  33. materialImageListCtrl: new PageListController(this.config?.httpConfig),
  34. materialVideoListCtrl: new PageListController(this.config?.httpConfig),
  35. // 用户资源
  36. matImageListCtrl: new PageListController(this.config?.httpConfig),
  37. matVideoListCtrl: new PageListController(this.config?.httpConfig),
  38. CustCompListCtrl: new PageListController(this.config?.httpConfig),
  39. // 平台资源
  40. sysImageListCtrl: new PageListController(this.config?.httpConfig),
  41. sysVideoListCtrl: new PageListController(this.config?.httpConfig),
  42. sysSvgListCtrl: new PageListController(this.config?.httpConfig),
  43. sysCompListCtrl: new PageListController(this.config?.httpConfig),
  44. };
  45. natsBus = new BusController();
  46. treeController = new TreeController(this.natsBus);
  47. onReady() {
  48. this.controls.promotionListCtrl.setCrudPrefix("/h5");
  49. this.controls.promotionListCtrl.state.size = 12;
  50. this.controls.materialListCtrl.setCrudPrefix("/source");
  51. this.controls.materialListCtrl.state.size = 24;
  52. this.controls.renderTaskListCtrl.setCrudPrefix("/sourceGen");
  53. this.controls.renderTaskListCtrl.state.size = 24;
  54. this.controls.matTempListCtrl.setCrudPrefix("/tpls");
  55. this.controls.matTempListCtrl.state.size = 20;
  56. this.controls.materialImageListCtrl.setCrudPrefix("/source");
  57. this.controls.materialImageListCtrl.state.size = 18;
  58. this.controls.materialImageListCtrl.state.query = { fileType: "image" };
  59. this.controls.materialVideoListCtrl.setCrudPrefix("/source");
  60. this.controls.materialVideoListCtrl.state.size = 18;
  61. this.controls.materialVideoListCtrl.state.query = { fileType: "video" };
  62. this.controls.matImageListCtrl.setCrudPrefix("/source");
  63. this.controls.matImageListCtrl.state.size = 20;
  64. this.controls.matImageListCtrl.state.query = { fileType: "image" };
  65. this.controls.matVideoListCtrl.setCrudPrefix("/source");
  66. this.controls.matVideoListCtrl.state.size = 20;
  67. this.controls.matVideoListCtrl.state.query = { fileType: "video" };
  68. this.controls.sysImageListCtrl.setCrudPrefix("/sys/source");
  69. this.controls.sysImageListCtrl.state.size = 20;
  70. this.controls.sysImageListCtrl.state.query = { fileType: "image" , isSvg: {$ne: true}, published: true};
  71. this.controls.sysVideoListCtrl.setCrudPrefix("/sys/source");
  72. this.controls.sysVideoListCtrl.state.size = 20;
  73. this.controls.sysVideoListCtrl.state.query = { fileType: "video" , published: true};
  74. this.controls.sysSvgListCtrl.setCrudPrefix("/sys/source");
  75. this.controls.sysSvgListCtrl.state.size = 20;
  76. this.controls.sysSvgListCtrl.state.query = { fileType: "image" , isSvg: true};
  77. this.controls.sysSvgListCtrl.state.query = { published: true};
  78. this.controls.CustCompListCtrl.setCrudPrefix("/frame");
  79. this.controls.CustCompListCtrl.state.size = 20;
  80. // this.controls.CustCompListCtrl.state.query = { type: "comp"};
  81. this.controls.sysCompListCtrl.setCrudPrefix("sys/frame");
  82. this.controls.sysCompListCtrl.state.size = 20;
  83. this.natsBus.init();
  84. }
  85. }
  86. export const { useResource, initResource } = ResourceModule.hook("Resource");