|
@@ -1,34 +1,52 @@
|
|
-import { css } from "@linaria/core";
|
|
|
|
|
|
+import { css, cx } from "@linaria/core";
|
|
import { IconDelete } from "@queenjs/icons";
|
|
import { IconDelete } from "@queenjs/icons";
|
|
import { Image, View } from "@queenjs/ui";
|
|
import { Image, View } from "@queenjs/ui";
|
|
import { defineComponent } from "vue";
|
|
import { defineComponent } from "vue";
|
|
-import { any } from "vue-types";
|
|
|
|
|
|
+import { any, string } from "vue-types";
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
props: {
|
|
props: {
|
|
record: any(),
|
|
record: any(),
|
|
|
|
+ use: string<"show" | "select">().def("show"),
|
|
},
|
|
},
|
|
emits: ["delete", "select", "download"],
|
|
emits: ["delete", "select", "download"],
|
|
setup(props, { emit }) {
|
|
setup(props, { emit }) {
|
|
return () => {
|
|
return () => {
|
|
- const { record } = props;
|
|
|
|
|
|
+ const { record, use } = props;
|
|
// console.log("record: ", record);
|
|
// console.log("record: ", record);
|
|
|
|
+
|
|
return (
|
|
return (
|
|
- <div class={itemStyles}>
|
|
|
|
- <div class="waiting flex items-center justify-center text-white">
|
|
|
|
- 生成中…
|
|
|
|
- </div>
|
|
|
|
- <IconDelete class="icon_del" onClick={() => emit("delete")} />
|
|
|
|
- <div class="item_actions flex">
|
|
|
|
- <div class="btn_circle" onClick={() => emit("download")}>
|
|
|
|
- 下载
|
|
|
|
- </div>
|
|
|
|
- <div class="btn_circle" onClick={() => emit("select")}>
|
|
|
|
- 使用
|
|
|
|
|
|
+ <div class={cx(itemStyles, "relative")}>
|
|
|
|
+ {use == "show" && (
|
|
|
|
+ <div class="waiting absolute inset-0 z-2 flex items-center justify-center text-white hidden">
|
|
|
|
+ 生成中…
|
|
</div>
|
|
</div>
|
|
|
|
+ )}
|
|
|
|
+ <div class="absolute inset-0 flex items-center justify-center z-2 opacity-0 hover:opacity-100 transition-all text-white">
|
|
|
|
+ {use == "show" && (
|
|
|
|
+ <IconDelete
|
|
|
|
+ class="icon_del absolute right-5px top-5px p-3px rounded-2px text-14px cursor-pointer"
|
|
|
|
+ onClick={() => emit("delete")}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ {use == "show" ? (
|
|
|
|
+ <div
|
|
|
|
+ class="btn_circle rounded-1/2 text-center w-56px leading-56px cursor-pointer"
|
|
|
|
+ onClick={() => emit("download")}
|
|
|
|
+ >
|
|
|
|
+ 下载
|
|
|
|
+ </div>
|
|
|
|
+ ) : (
|
|
|
|
+ <div
|
|
|
|
+ class="btn_circle rounded-1/2 text-center w-56px leading-56px cursor-pointer"
|
|
|
|
+ onClick={() => emit("select")}
|
|
|
|
+ >
|
|
|
|
+ 使用
|
|
|
|
+ </div>
|
|
|
|
+ )}
|
|
</div>
|
|
</div>
|
|
<View ratio={1.4} class="overflow-hidden">
|
|
<View ratio={1.4} class="overflow-hidden">
|
|
- <Image class="h-1/1 w-1/1" src="" />
|
|
|
|
|
|
+ <Image class="h-1/1 w-1/1" src={record?.thumbnail?.url} />
|
|
</View>
|
|
</View>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
@@ -37,38 +55,7 @@ export default defineComponent({
|
|
});
|
|
});
|
|
|
|
|
|
const itemStyles = css`
|
|
const itemStyles = css`
|
|
- position: relative;
|
|
|
|
- z-index: 1;
|
|
|
|
- &:hover {
|
|
|
|
- .icon_del,
|
|
|
|
- .btn_circle {
|
|
|
|
- opacity: 1;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- .icon_del,
|
|
|
|
- .btn_circle {
|
|
|
|
- opacity: 0;
|
|
|
|
- transition: all 0.2s ease;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .item_actions,
|
|
|
|
- .icon_del,
|
|
|
|
- .waiting {
|
|
|
|
- position: absolute;
|
|
|
|
- z-index: 2;
|
|
|
|
- color: #fff;
|
|
|
|
- }
|
|
|
|
- .item_actions {
|
|
|
|
- left: 50%;
|
|
|
|
- top: 50%;
|
|
|
|
- transform: translate(-50%, -50%);
|
|
|
|
- }
|
|
|
|
.btn_circle {
|
|
.btn_circle {
|
|
- border-radius: 50%;
|
|
|
|
- line-height: 56px;
|
|
|
|
- width: 56px;
|
|
|
|
- text-align: center;
|
|
|
|
- cursor: pointer;
|
|
|
|
background-color: rgba(0, 0, 0, 0.7);
|
|
background-color: rgba(0, 0, 0, 0.7);
|
|
&:hover {
|
|
&:hover {
|
|
background-color: rgba(0, 0, 0, 0.8);
|
|
background-color: rgba(0, 0, 0, 0.8);
|
|
@@ -78,23 +65,12 @@ const itemStyles = css`
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.icon_del {
|
|
.icon_del {
|
|
- right: 5px;
|
|
|
|
- top: 5px;
|
|
|
|
- border-radius: 2px;
|
|
|
|
- padding: 3px;
|
|
|
|
- font-size: 14px;
|
|
|
|
- cursor: pointer;
|
|
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
&:hover {
|
|
&:hover {
|
|
background-color: rgba(0, 0, 0, 0.6);
|
|
background-color: rgba(0, 0, 0, 0.6);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.waiting {
|
|
.waiting {
|
|
- display: none;
|
|
|
|
- top: 0;
|
|
|
|
- bottom: 0;
|
|
|
|
- left: 0;
|
|
|
|
- right: 0;
|
|
|
|
background-color: rgba(0, 0, 0, 0.2);
|
|
background-color: rgba(0, 0, 0, 0.2);
|
|
}
|
|
}
|
|
`;
|
|
`;
|