index.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. // 平台资源
  39. sysImageListCtrl: new PageListController(this.config?.httpConfig),
  40. sysVideoListCtrl: new PageListController(this.config?.httpConfig),
  41. sysSvgListCtrl: new PageListController(this.config?.httpConfig),
  42. };
  43. natsBus = new BusController();
  44. treeController = new TreeController(this.natsBus);
  45. onReady() {
  46. this.controls.promotionListCtrl.setCrudPrefix("/h5");
  47. this.controls.promotionListCtrl.state.size = 12;
  48. this.controls.materialListCtrl.setCrudPrefix("/source");
  49. this.controls.materialListCtrl.state.size = 24;
  50. this.controls.renderTaskListCtrl.setCrudPrefix("/sourceGen");
  51. this.controls.renderTaskListCtrl.state.size = 24;
  52. this.controls.matTempListCtrl.setCrudPrefix("/tpls");
  53. this.controls.matTempListCtrl.state.size = 20;
  54. this.controls.materialImageListCtrl.setCrudPrefix("/source");
  55. this.controls.materialImageListCtrl.state.size = 18;
  56. this.controls.materialImageListCtrl.state.query = { fileType: "image" };
  57. this.controls.materialVideoListCtrl.setCrudPrefix("/source");
  58. this.controls.materialVideoListCtrl.state.size = 18;
  59. this.controls.materialVideoListCtrl.state.query = { fileType: "video" };
  60. this.controls.matImageListCtrl.setCrudPrefix("/source");
  61. this.controls.matImageListCtrl.state.size = 20;
  62. this.controls.matImageListCtrl.state.query = { fileType: "image" };
  63. this.controls.matVideoListCtrl.setCrudPrefix("/source");
  64. this.controls.matVideoListCtrl.state.size = 20;
  65. this.controls.matVideoListCtrl.state.query = { fileType: "video" };
  66. this.controls.sysImageListCtrl.setCrudPrefix("/sys/source");
  67. this.controls.sysImageListCtrl.state.size = 20;
  68. this.controls.sysImageListCtrl.state.query = { fileType: "image" };
  69. this.controls.sysVideoListCtrl.setCrudPrefix("/sys/source");
  70. this.controls.sysVideoListCtrl.state.size = 20;
  71. this.controls.sysVideoListCtrl.state.query = { fileType: "video" };
  72. this.controls.sysSvgListCtrl.setCrudPrefix("/sys/source");
  73. this.controls.sysSvgListCtrl.state.size = 20;
  74. this.controls.sysSvgListCtrl.state.query = { fileType: "image" , isSvg: true};
  75. this.natsBus.init();
  76. }
  77. }
  78. export const { useResource, initResource } = ResourceModule.hook("Resource");