index.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. streamCardTransferCtrl: new TransferCtrl(this),
  38. historyCtrl: new HistoryCtrl(this),
  39. pickCtrl: new ImagePickController(),
  40. compUICtrl: new CompUICtrl(this),
  41. };
  42. onReady() {
  43. this.actions.init();
  44. }
  45. jumpIndexHtml(route = "#/") {
  46. const _params = new URLSearchParams(decodeURIComponent(location.search));
  47. const host = _params.get("host");
  48. let link = `${location.origin}/index.html?host=${host}${route}`;
  49. if (location.host == "www.infish.cn") {
  50. link = `${location.origin}/projects/queenshow/index.html?host=${host}${route}`;
  51. }
  52. location.href = link;
  53. }
  54. }