|
@@ -1,9 +1,9 @@
|
|
import { css, cx } from "@linaria/core";
|
|
import { css, cx } from "@linaria/core";
|
|
import { Image, View } from "@queenjs/ui";
|
|
import { Image, View } from "@queenjs/ui";
|
|
-import { Checkbox, Radio, RadioChangeEvent } from "ant-design-vue";
|
|
|
|
|
|
+import { Checkbox, Radio, RadioChangeEvent, Tag } from "ant-design-vue";
|
|
import { defineUI, queenApi } from "queenjs";
|
|
import { defineUI, queenApi } from "queenjs";
|
|
import { reactive } from "vue";
|
|
import { reactive } from "vue";
|
|
-import { any, bool } from "vue-types";
|
|
|
|
|
|
+import { any, bool, string } from "vue-types";
|
|
import PreviewModal from "../../components/PreviewModal";
|
|
import PreviewModal from "../../components/PreviewModal";
|
|
|
|
|
|
const options = [
|
|
const options = [
|
|
@@ -13,6 +13,7 @@ const options = [
|
|
|
|
|
|
export default defineUI({
|
|
export default defineUI({
|
|
props: {
|
|
props: {
|
|
|
|
+ type: string<"image" | "video">().def("image"),
|
|
active: bool(),
|
|
active: bool(),
|
|
record: any(),
|
|
record: any(),
|
|
},
|
|
},
|
|
@@ -28,9 +29,15 @@ export default defineUI({
|
|
};
|
|
};
|
|
|
|
|
|
const showModal = () => {
|
|
const showModal = () => {
|
|
|
|
+ const { record, type } = props;
|
|
|
|
+ const isVideo = type == "video";
|
|
|
|
+
|
|
queenApi.dialog(
|
|
queenApi.dialog(
|
|
<PreviewModal
|
|
<PreviewModal
|
|
- data={{ url: props.record?.thumbnailUrl, fileType: "image" }}
|
|
|
|
|
|
+ data={{
|
|
|
|
+ url: isVideo ? record.videoUrl : record?.thumbnailUrl,
|
|
|
|
+ fileType: type,
|
|
|
|
+ }}
|
|
/>,
|
|
/>,
|
|
{
|
|
{
|
|
title: "预览渲染模板",
|
|
title: "预览渲染模板",
|
|
@@ -40,7 +47,8 @@ export default defineUI({
|
|
};
|
|
};
|
|
|
|
|
|
return () => {
|
|
return () => {
|
|
- const { active, record } = props;
|
|
|
|
|
|
+ const { active, record, type } = props;
|
|
|
|
+ const isVideo = type == "video";
|
|
|
|
|
|
return (
|
|
return (
|
|
<div class="cursor-pointer">
|
|
<div class="cursor-pointer">
|
|
@@ -53,10 +61,19 @@ export default defineUI({
|
|
active && "active"
|
|
active && "active"
|
|
)}
|
|
)}
|
|
>
|
|
>
|
|
|
|
+ {isVideo && (
|
|
|
|
+ <Tag color="#E88B00" class="absolute right-0 top-0 z-9 !mr-0">
|
|
|
|
+ 视频
|
|
|
|
+ </Tag>
|
|
|
|
+ )}
|
|
{active && (
|
|
{active && (
|
|
<Checkbox checked class="!-mt-0.2em absolute top-0 left-0 z-3" />
|
|
<Checkbox checked class="!-mt-0.2em absolute top-0 left-0 z-3" />
|
|
)}
|
|
)}
|
|
- <Image class="h-1/1 w-1/1" src={record?.thumbnailUrl} />
|
|
|
|
|
|
+ {!isVideo ? (
|
|
|
|
+ <Image class="h-1/1 w-1/1" src={record?.thumbnailUrl} />
|
|
|
|
+ ) : (
|
|
|
|
+ <video src={record.videoUrl} class="h-1/1 w-1/1 object-cover" />
|
|
|
|
+ )}
|
|
<span
|
|
<span
|
|
class="absolute left-1/2 top-1/2 z-3 transform -translate-x-1/2 -translate-y-1/2 rounded-1/2 w-56px leading-56px text-center bg-primary transition-all opacity-0 group-hover:opacity-100 hover:(bg-opacity-50)"
|
|
class="absolute left-1/2 top-1/2 z-3 transform -translate-x-1/2 -translate-y-1/2 rounded-1/2 w-56px leading-56px text-center bg-primary transition-all opacity-0 group-hover:opacity-100 hover:(bg-opacity-50)"
|
|
onClick={(e) => {
|
|
onClick={(e) => {
|