|
@@ -1,9 +1,10 @@
|
|
|
import { useEditor } from "@/modules/editor";
|
|
|
-import { initResource, useResource } from "@/modules/resource";
|
|
|
+import { useResource } from "@/modules/resource";
|
|
|
import { css } from "@linaria/core";
|
|
|
-import { Image, List, Loadmore } from "@queenjs/ui";
|
|
|
+import { Image, Loadmore } from "@queenjs/ui";
|
|
|
import { Radio } from "ant-design-vue";
|
|
|
import { defineComponent, reactive } from "vue";
|
|
|
+import { Container, Draggable } from "vue-dndrop";
|
|
|
|
|
|
export const MySources = defineComponent({
|
|
|
setup() {
|
|
@@ -15,9 +16,7 @@ export const MySources = defineComponent({
|
|
|
|
|
|
function getCurrCtrl() {
|
|
|
return resource.controls[
|
|
|
- state.sourceType === "Image"
|
|
|
- ? "materialImageListCtrl"
|
|
|
- : "materialVideoListCtrl"
|
|
|
+ state.sourceType === "Image" ? "matImageListCtrl" : "matVideoListCtrl"
|
|
|
];
|
|
|
}
|
|
|
|
|
@@ -37,12 +36,7 @@ export const MySources = defineComponent({
|
|
|
switchSource("Image");
|
|
|
|
|
|
return () => {
|
|
|
- const control =
|
|
|
- resource.controls[
|
|
|
- state.sourceType === "Image"
|
|
|
- ? "materialImageListCtrl"
|
|
|
- : "materialVideoListCtrl"
|
|
|
- ];
|
|
|
+ const control = getCurrCtrl();
|
|
|
return (
|
|
|
<div class="space-y-20px -mt-10px flex flex-col overflow-hidden">
|
|
|
<Radio.Group
|
|
@@ -54,35 +48,45 @@ export const MySources = defineComponent({
|
|
|
<Radio.Button value="Image">图片</Radio.Button>
|
|
|
<Radio.Button value="Video">视频</Radio.Button>
|
|
|
</Radio.Group>
|
|
|
- <div class="scrollbar flex-1 -mr-15px pr-15px">
|
|
|
- <List data={control.state.list} columns={2} gap="20px">
|
|
|
- {{
|
|
|
- item(item: any) {
|
|
|
- return (
|
|
|
- <div
|
|
|
- style={{ aspectRatio: 1 }}
|
|
|
- onClick={() => clickToDesign(item.file.url)}
|
|
|
- >
|
|
|
+ <div class="flex-1 -mr-15px pr-15px overflow-x-hidden overflow-y-auto scrollbar">
|
|
|
+ <Container
|
|
|
+ class="grid grid-cols-2 gap-15px"
|
|
|
+ behaviour="copy"
|
|
|
+ group-name="canvas"
|
|
|
+ animation-duration={0}
|
|
|
+ get-child-payload={(index: number) => {
|
|
|
+ return {
|
|
|
+ type: state.sourceType,
|
|
|
+ data: control.state.list[index],
|
|
|
+ };
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {control.state.list.map((item: any) => (
|
|
|
+ <Draggable class="">
|
|
|
+ <div
|
|
|
+ class="draggable-item"
|
|
|
+ style={{ aspectRatio: 1 }}
|
|
|
+ onClick={() => clickToDesign(item.file.url)}
|
|
|
+ >
|
|
|
+ {item.fileType == "video" ? (
|
|
|
+ <video src={item.file.url} class="w-full h-full object-cover" />
|
|
|
+ ) : (
|
|
|
<Image
|
|
|
class="w-full h-full"
|
|
|
src={item.file.url}
|
|
|
size={240}
|
|
|
/>
|
|
|
- </div>
|
|
|
- );
|
|
|
- },
|
|
|
- loadmore() {
|
|
|
- return (
|
|
|
- <Loadmore
|
|
|
- class="mt-20px"
|
|
|
- loading={control.state.loading}
|
|
|
- canLoad={control.state.canLoadNext}
|
|
|
- onChange={control.loadNextPage}
|
|
|
- />
|
|
|
- );
|
|
|
- },
|
|
|
- }}
|
|
|
- </List>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ </Draggable>
|
|
|
+ ))}
|
|
|
+ </Container>
|
|
|
+ <Loadmore
|
|
|
+ class="mt-20px"
|
|
|
+ loading={control.state.loading}
|
|
|
+ canLoad={control.state.canLoadNext}
|
|
|
+ onChange={control.loadNextPage}
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|