index.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. export class EditorModule extends ModuleRoot {
  17. config = this.setConfig({
  18. httpConfig: {
  19. baseURL: Dict_Apis.promotion,
  20. },
  21. });
  22. components = this.useComponents(components);
  23. actions = this.createActions([initActions, editActions, ImgCompActions]);
  24. https = this.createHttps(https);
  25. store = this.createStore(store, {
  26. transform: (state) => createProxy(state),
  27. });
  28. helper = this.createHelper(helpers);
  29. controls = {
  30. uploader: new UploadController({
  31. httpConfig: {
  32. baseURL: Dict_Apis.queentree,
  33. },
  34. dir: "queenshow",
  35. }),
  36. transferCtrl: new TransferCtrl(this),
  37. historyCtrl: new HistoryCtrl(this),
  38. pickCtrl: new ImagePickController(),
  39. compUICtrl: new CompUICtrl(this),
  40. };
  41. onReady() {
  42. this.actions.init();
  43. }
  44. jumpIndexHtml(route = "#/") {
  45. const _params = new URLSearchParams(decodeURIComponent(location.search));
  46. const host = _params.get("host");
  47. let link = `${location.origin}/index.html?host=${host}${route}`;
  48. if (location.host == "www.infish.cn") {
  49. link = `${location.origin}/projects/queenshow/index.html?host=${host}${route}`;
  50. }
  51. location.href = link;
  52. }
  53. }