index.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Dict_Apis } from "@/dict";
  2. import { PageListController, UploadController } from "@queenjs/controllers";
  3. import { ModuleRoot } from "queenjs";
  4. import { actions } from "./actions";
  5. import { compoents } from "./components";
  6. import { helper } from "./helper";
  7. import { http } from "./http";
  8. import { store } from "./store";
  9. export class ResourceModule extends ModuleRoot {
  10. config = this.setConfig({
  11. httpConfig: {
  12. baseURL: Dict_Apis.promotion,
  13. },
  14. });
  15. actions = this.createActions(actions);
  16. components = this.useComponents(compoents);
  17. store = this.createStore([store]);
  18. https = this.createHttps(http);
  19. helpers = this.createHelper(helper);
  20. controls = {
  21. uploader: new UploadController({
  22. httpConfig: {
  23. baseURL: Dict_Apis.queentree,
  24. },
  25. dir: "queenshow",
  26. }),
  27. promotionListCtrl: new PageListController(this.config?.httpConfig),
  28. materialListCtrl: new PageListController(this.config?.httpConfig),
  29. matTempListCtrl: new PageListController(this.config?.httpConfig),
  30. renderTaskListCtrl: new PageListController(this.config?.httpConfig),
  31. };
  32. onReady() {
  33. this.controls.promotionListCtrl.setCrudPrefix("/h5");
  34. this.controls.promotionListCtrl.state.size = 12;
  35. this.controls.materialListCtrl.setCrudPrefix("/source");
  36. this.controls.materialListCtrl.state.size = 24;
  37. this.controls.renderTaskListCtrl.setCrudPrefix("/tpls");
  38. this.controls.renderTaskListCtrl.state.size = 24;
  39. this.controls.matTempListCtrl.setCrudPrefix("/tpls");
  40. this.controls.matTempListCtrl.state.size = 20;
  41. }
  42. }
  43. export const { useResource, initResource } = ResourceModule.hook("Resource");