SaveOrShare.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { useEditor } from "@/modules/editor";
  2. import { Button } from "ant-design-vue";
  3. import { defineUI, queenApi } from "queenjs";
  4. import { TipIcons } from "../../TipIcons";
  5. import PreviewDesignModal from "./PreviewDesignModal";
  6. import PublishDesignModal from "./PublishDesignModal";
  7. export default defineUI({
  8. setup() {
  9. const editor = useEditor();
  10. const { store, actions, controls } = editor;
  11. function showPreviewModal() {
  12. controls.screenCtrl.saveScreenPage();
  13. const rootPage = controls.pageCtrl.rootPage;
  14. rootPage.value.pageMode = controls.screenCtrl.state.screen.pageMode;
  15. rootPage.value.pageSizeType =
  16. controls.screenCtrl.state.screen.pageSizeType;
  17. queenApi.dialog(
  18. <PreviewDesignModal data={controls.pageCtrl.designData} />,
  19. {
  20. fullscreen: true,
  21. closable: false,
  22. }
  23. );
  24. }
  25. function showPublishModal() {
  26. controls.screenCtrl.saveScreenPage();
  27. const rootPage = controls.pageCtrl.rootPage;
  28. rootPage.value.pageMode = controls.screenCtrl.state.screen.pageMode;
  29. rootPage.value.pageSizeType =
  30. controls.screenCtrl.state.screen.pageSizeType;
  31. queenApi.dialog(
  32. <PublishDesignModal data={controls.pageCtrl.designData} />,
  33. {
  34. fullscreen: true,
  35. title: "作品信息",
  36. }
  37. );
  38. }
  39. return () => (
  40. <aside class="space-x-16px flex items-center">
  41. <TipIcons.Preview
  42. class="text-20px text-light-50 bg-dark-50 p-6px transform rotate-90 rounded cursor-pointer transition hover:(!bg-dark-100)"
  43. onClick={showPreviewModal}
  44. />
  45. {/* {store.isEditPage && (
  46. <Dropdown
  47. overlay={<ShareBox />}
  48. trigger="click"
  49. placement="bottomRight"
  50. >
  51. <Button
  52. type="default"
  53. class="text-12px bg-dark-50 hover:(bg-dark-100 border-transparent text-light-50)"
  54. >
  55. 分享
  56. </Button>
  57. </Dropdown>
  58. )} */}
  59. <Button
  60. class="text-12px text-dark-500 hover:text-dark-500"
  61. type="primary"
  62. onClick={() => actions.saveDesign()}
  63. >
  64. 保存
  65. </Button>
  66. <Button
  67. type="text"
  68. class="text-12px bg-dark-50 hover:(bg-dark-100 text-light-50) focus:(bg-dark-100)"
  69. onClick={() => showPublishModal()}
  70. >
  71. 发布
  72. </Button>
  73. </aside>
  74. );
  75. },
  76. });