Toolbar.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { Button } from "ant-design-vue";
  2. import { defineComponent } from "vue";
  3. import { useResource } from "../..";
  4. import MaterialTemplateModal from "./MaterialTemplateModal";
  5. import { css, cx } from "@linaria/core";
  6. import { queenApi } from "queenjs";
  7. const materialType = [
  8. { name: "视频", key: "video" },
  9. { name: "图片", key: "image" },
  10. { name: "渲染任务", key: "task" },
  11. ];
  12. export default defineComponent({
  13. emits: ["change"],
  14. setup(props, { emit }) {
  15. const resource = useResource();
  16. const { store } = resource;
  17. const showModal = (type: string) => {
  18. // resource.showModal(<MaterialTemplateModal type={type} />, {
  19. // title: `${type === "image" ? "图片" : "视频"}模板中心`,
  20. // width: "1000px",
  21. // });
  22. queenApi.messageSuccess("努力开发中,尽请期待!")
  23. };
  24. return () => {
  25. return (
  26. <div
  27. class={cx(rootStyles, "flex items-center justify-between mt-20px")}
  28. >
  29. <div class="filter space-x-60px">
  30. {materialType.map((d) => (
  31. <span
  32. key={d.key}
  33. onClick={() => emit("change", d.key)}
  34. class={cx(
  35. store.type == d.key && "active",
  36. "cursor-pointer btn_tab"
  37. )}
  38. >
  39. {d.name}
  40. </span>
  41. ))}
  42. </div>
  43. <div>
  44. <Button
  45. ghost
  46. type="primary"
  47. onClick={resource.actions.createMaterial}
  48. >
  49. 上传素材
  50. </Button>
  51. <Button
  52. ghost
  53. type="primary"
  54. class="ml-25px"
  55. onClick={() => showModal("image")}
  56. >
  57. 生成图片
  58. </Button>
  59. <Button
  60. ghost
  61. type="primary"
  62. class="ml-15px"
  63. onClick={() => showModal("video")}
  64. >
  65. 生成视频
  66. </Button>
  67. </div>
  68. </div>
  69. );
  70. };
  71. },
  72. });
  73. const rootStyles = css`
  74. .btn_tab {
  75. padding: 3px 5px;
  76. &:hover,
  77. &.active {
  78. color: @inf-primary-color;
  79. }
  80. }
  81. `;