Toolbar.tsx 2.1 KB

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