index.ts 2.7 KB

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