index.ts 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. matImageListCtrl: new PageListController(this.config?.httpConfig),
  36. matVideoListCtrl: new PageListController(this.config?.httpConfig),
  37. };
  38. natsBus = new BusController();
  39. treeController = new TreeController(this.natsBus);
  40. onReady() {
  41. this.controls.promotionListCtrl.setCrudPrefix("/h5");
  42. this.controls.promotionListCtrl.state.size = 12;
  43. this.controls.materialListCtrl.setCrudPrefix("/source");
  44. this.controls.materialListCtrl.state.size = 24;
  45. this.controls.renderTaskListCtrl.setCrudPrefix("/sourceGen");
  46. this.controls.renderTaskListCtrl.state.size = 24;
  47. this.controls.matTempListCtrl.setCrudPrefix("/tpls");
  48. this.controls.matTempListCtrl.state.size = 20;
  49. this.controls.materialImageListCtrl.setCrudPrefix("/source");
  50. this.controls.materialImageListCtrl.state.size = 18;
  51. this.controls.materialImageListCtrl.state.query = { fileType: "image" };
  52. this.controls.materialVideoListCtrl.setCrudPrefix("/source");
  53. this.controls.materialVideoListCtrl.state.size = 18;
  54. this.controls.materialVideoListCtrl.state.query = { fileType: "video" };
  55. this.controls.matImageListCtrl.setCrudPrefix("/source");
  56. this.controls.matImageListCtrl.state.size = 20;
  57. this.controls.matImageListCtrl.state.query = { fileType: "image" };
  58. this.controls.matVideoListCtrl.setCrudPrefix("/source");
  59. this.controls.matVideoListCtrl.state.size = 20;
  60. this.controls.matVideoListCtrl.state.query = { fileType: "video" };
  61. this.natsBus.init();
  62. }
  63. }
  64. export const { useResource, initResource } = ResourceModule.hook("Resource");