|
@@ -1,119 +1,17 @@
|
|
|
import { useResource } from "@/modules/resource";
|
|
|
-import { css, cx } from "@linaria/core";
|
|
|
-import { Button } from "ant-design-vue";
|
|
|
-import { defineComponent, onMounted } from "vue";
|
|
|
-import AssetsList from "../components/AssetsList";
|
|
|
-import MaterialTemplateModal from "./components/MaterialTemplateModal";
|
|
|
-
|
|
|
-const materialType = [
|
|
|
- { name: "视频", key: "video" },
|
|
|
- { name: "图片", key: "image" },
|
|
|
- { name: "渲染任务", key: "task" },
|
|
|
-];
|
|
|
+import { defineComponent } from "vue";
|
|
|
|
|
|
export default defineComponent({
|
|
|
setup() {
|
|
|
const resource = useResource();
|
|
|
- const { store, controls, actions } = resource;
|
|
|
-
|
|
|
- const showModal = (type: string) => {
|
|
|
- resource.showModal(<MaterialTemplateModal type={type} />, {
|
|
|
- title: `${type === "image" ? "图片" : "视频"}模板中心`,
|
|
|
- width: "1000px",
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
- const changeType = (v: string) => {
|
|
|
- resource.store.setSourceType(v);
|
|
|
- if (v == "task") {
|
|
|
- controls.renderTaskListCtrl.loadPage(1);
|
|
|
- return;
|
|
|
- }
|
|
|
- loadPage();
|
|
|
- };
|
|
|
-
|
|
|
- const loadPage = () => {
|
|
|
- controls.materialListCtrl.state.query = { fileType: store.type };
|
|
|
- controls.materialListCtrl.loadPage(1);
|
|
|
- };
|
|
|
-
|
|
|
- onMounted(() => loadPage());
|
|
|
|
|
|
return () => {
|
|
|
- const control =
|
|
|
- store.type == "task"
|
|
|
- ? controls.renderTaskListCtrl
|
|
|
- : controls.materialListCtrl;
|
|
|
-
|
|
|
return (
|
|
|
- <div class={rootStyles}>
|
|
|
+ <div>
|
|
|
<h3 class="text-22px">我的素材</h3>
|
|
|
- <div class="flex items-center justify-between mt-20px">
|
|
|
- <div class="filter space-x-60px">
|
|
|
- {materialType.map((d) => (
|
|
|
- <span
|
|
|
- key={d.key}
|
|
|
- onClick={() => changeType(d.key)}
|
|
|
- class={cx(
|
|
|
- store.type == d.key && "active",
|
|
|
- "cursor-pointer btn_tab"
|
|
|
- )}
|
|
|
- >
|
|
|
- {d.name}
|
|
|
- </span>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <Button
|
|
|
- ghost
|
|
|
- type="primary"
|
|
|
- onClick={resource.actions.uploadMaterial}
|
|
|
- >
|
|
|
- 上传素材
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- ghost
|
|
|
- type="primary"
|
|
|
- class="ml-25px"
|
|
|
- onClick={() => showModal("image")}
|
|
|
- >
|
|
|
- 生成图片
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- ghost
|
|
|
- type="primary"
|
|
|
- class="ml-15px"
|
|
|
- onClick={() => showModal("video")}
|
|
|
- >
|
|
|
- 生成视频
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <AssetsList
|
|
|
- columns={6}
|
|
|
- class="mt-30px"
|
|
|
- control={control}
|
|
|
- item={(record: any) => (
|
|
|
- <resource.components.MaterialItem
|
|
|
- record={record}
|
|
|
- use={store.type == "task" ? "task" : "show"}
|
|
|
- onDelete={() => actions.deleteMaterial(record)}
|
|
|
- onDownload={() => actions.downloadMaterial(record)}
|
|
|
- />
|
|
|
- )}
|
|
|
- />
|
|
|
+ <resource.components.ResourceManager />
|
|
|
</div>
|
|
|
);
|
|
|
};
|
|
|
},
|
|
|
});
|
|
|
-
|
|
|
-const rootStyles = css`
|
|
|
- .btn_tab {
|
|
|
- padding: 3px 5px;
|
|
|
- &:hover,
|
|
|
- &.active {
|
|
|
- color: @inf-primary-color;
|
|
|
- }
|
|
|
- }
|
|
|
-`;
|