index.ts 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { Dict_Apis } from "@/dict";
  2. import { UploadController } from "@queenjs/controllers";
  3. import { ModuleRoot } from "queenjs";
  4. import components from "../components";
  5. import { CompUICtrl } from "../controllers/CompUICtrl";
  6. import { HistoryCtrl } from "../controllers/HistoryCtrl";
  7. import { ImagePickController } from "../controllers/ImagePickerController";
  8. import { TransferCtrl } from "../controllers/TransferCtrl";
  9. import { createProxy } from "../objects/ProxyStore/create";
  10. import { editActions } from "./actions/edit";
  11. import { ImgCompActions } from "./actions/image";
  12. import { initActions } from "./actions/init";
  13. import { helpers } from "./helpers";
  14. import { editHelpers } from "./helpers/edit";
  15. import { https } from "./https";
  16. import { store } from "./stores";
  17. import { DragAddCtrl } from "../controllers/DragAddCtrl";
  18. import { SelectCtrl } from "../controllers/SelectCtrl";
  19. import { CompObject } from "../controllers/SelectCtrl/compObj";
  20. import { manualActions } from "./actions/editWithManualHistory";
  21. import { wxController } from "@/controllers/wxController";
  22. import { ImageCropperCtrl } from "../controllers/CropperCtrl";
  23. import { MediaCtrl } from "../controllers/MediaCtrl/indext";
  24. import { AnimCtrl } from "../controllers/AnimCtrl";
  25. import { TextEditorCtrl } from "../controllers/TextEditorCtrl";
  26. export class EditorModule extends ModuleRoot {
  27. config = this.setConfig({
  28. httpConfig: {
  29. baseURL: Dict_Apis.promotion,
  30. },
  31. });
  32. components = this.useComponents(components);
  33. actions = this.createActions([
  34. initActions,
  35. editActions,
  36. ImgCompActions,
  37. manualActions,
  38. ]);
  39. https = this.createHttps(https);
  40. store = this.createStore(store, {
  41. transform: (state) => createProxy(state),
  42. });
  43. helper = this.createHelper([helpers, editHelpers]);
  44. controls = {
  45. uploader: new UploadController({
  46. httpConfig: {
  47. baseURL: Dict_Apis.queentree,
  48. },
  49. dir: "queenshow",
  50. }),
  51. wxCtrl: new wxController({
  52. url: `${Dict_Apis.promotion}/wechat/share?`,
  53. }),
  54. transferCtrl: new TransferCtrl(this),
  55. dragAddCtrl: new DragAddCtrl(this),
  56. streamCardTransferCtrl: new TransferCtrl(this),
  57. historyCtrl: new HistoryCtrl(this),
  58. pickCtrl: new ImagePickController(),
  59. compUICtrl: new CompUICtrl(this),
  60. selectCtrl: new SelectCtrl(this),
  61. cropCtrl: new ImageCropperCtrl(this),
  62. mediaCtrl: new MediaCtrl(this),
  63. textEditorCtrl: new TextEditorCtrl(this),
  64. animCtrl: new AnimCtrl(this)
  65. };
  66. compObjsMap = new Map<string, CompObject>();
  67. onReady() {
  68. this.actions.init();
  69. this.controls.animCtrl.initEvent();
  70. }
  71. jumpIndexHtml(route = "#/") {
  72. const _params = new URLSearchParams(decodeURIComponent(location.search));
  73. const host = _params.get("host");
  74. let link = `${location.origin}/index.html?host=${host}${route}`;
  75. // if (location.host == "www.infish.cn") {
  76. // link = `${location.origin}/projects/queenshowv1/index.html?host=${host}${route}`;
  77. // }
  78. location.href = link;
  79. }
  80. }