|
@@ -1,9 +1,13 @@
|
|
|
import Empty from "@/components/Empty";
|
|
|
import { useEditor } from "@/modules/editor";
|
|
|
import { useResource } from "@/modules/resource";
|
|
|
+import { IconEyeOn } from "@queenjs/icons";
|
|
|
import { Image, Loadmore } from "@queenjs/ui";
|
|
|
-import { defineUI } from "queenjs";
|
|
|
+import { defineUI, queenApi } from "queenjs";
|
|
|
+import Modal from "queenjs/adapter/vue/components/modal";
|
|
|
import { Container, Draggable } from "vue-dndrop";
|
|
|
+import PreviewTplModal from "./PreviewTplModal";
|
|
|
+import { IconPreview } from "@/assets/icons";
|
|
|
|
|
|
export default defineUI({
|
|
|
setup() {
|
|
@@ -12,6 +16,23 @@ export default defineUI({
|
|
|
const ctrl = source.controls.sysTplListCtrl;
|
|
|
ctrl.loadPage(1);
|
|
|
|
|
|
+ const preview = (record: any) => {
|
|
|
+ queenApi.dialog(
|
|
|
+ <PreviewTplModal
|
|
|
+ data={record}
|
|
|
+ onClick={async () => {
|
|
|
+ await editor.actions.clickTplToDesign(record);
|
|
|
+ Modal.clear();
|
|
|
+ }}
|
|
|
+ ></PreviewTplModal>,
|
|
|
+ {
|
|
|
+ width: "1000px",
|
|
|
+ title: "模板预览",
|
|
|
+ destroyOnClose: true,
|
|
|
+ }
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
return () => {
|
|
|
const dataSource = ctrl.state.list;
|
|
|
|
|
@@ -33,7 +54,7 @@ export default defineUI({
|
|
|
return (
|
|
|
<Draggable key={item._id}>
|
|
|
<div
|
|
|
- class="text-center leading-50px bg-dark-50 rounded draggable-item"
|
|
|
+ class="draggable-item relative"
|
|
|
key={item._id}
|
|
|
title={item.title}
|
|
|
style={{ aspectRatio: 1 }}
|
|
@@ -44,6 +65,15 @@ export default defineUI({
|
|
|
src={item.thumbnail}
|
|
|
size={240}
|
|
|
/>
|
|
|
+ <div class="absolute w-1/1 h-1/1 top-0 left-0 bg-dark-500 bg-opacity-20 transition opacity-0 hover:(opacity-100) text-dark-500">
|
|
|
+ <IconPreview
|
|
|
+ class="absolute right-6px top-6px text-22px bg-light-50 rounded-2px cursor-pointer hover:opacity-80 text-dark-500 transition"
|
|
|
+ onClick={(e: any) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ preview(item);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</Draggable>
|
|
|
);
|