|
@@ -9,6 +9,7 @@ import { useResource } from "@/modules/resource";
|
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
import { queenApi, useModal } from "queenjs";
|
|
|
+import { useEditor } from "@/modules/editor";
|
|
|
export default defineComponent({
|
|
|
props: {
|
|
|
record: any().isRequired,
|
|
@@ -19,6 +20,7 @@ export default defineComponent({
|
|
|
currCollection: {} as any,
|
|
|
searchVal: "",
|
|
|
});
|
|
|
+ const editor = useEditor();
|
|
|
const modal = useModal();
|
|
|
const EmptyHistory = () => {
|
|
|
return (
|
|
@@ -61,13 +63,95 @@ export default defineComponent({
|
|
|
</div>
|
|
|
);
|
|
|
};
|
|
|
+ const workPreview = async (currId: string) => {
|
|
|
+ await editor.actions.initDesign(currId, false);
|
|
|
+ previewInModal("当前提交");
|
|
|
+ };
|
|
|
+ const historyPreview = async (hisId: string) => {
|
|
|
+ const ret = await resource.actions.getCommitHistoryDetail(hisId);
|
|
|
+ if (!ret) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ editor.store.setDesignData(ret);
|
|
|
+ previewInModal("历史提交");
|
|
|
+ };
|
|
|
+ const collectionPreview = async (collection: any) => {
|
|
|
+ if (collection.introLink) {
|
|
|
+ window.open(collection.introLink);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (collection.introH5Id) {
|
|
|
+ await editor.actions.initDesign(collection.introH5Id, false);
|
|
|
+ previewInModal("详情介绍");
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const previewInModal = (title: string) => {
|
|
|
+ editor.actions.switchMode("preview");
|
|
|
+ resource.showModal(
|
|
|
+ <div class={"!p-0"}>
|
|
|
+ <div class={"h-600px scrollbar"}>
|
|
|
+ <editor.components.Preview class="pointer-events-none" />
|
|
|
+ </div>
|
|
|
+ </div>,
|
|
|
+ {
|
|
|
+ title: title,
|
|
|
+ destroyOnClose: true,
|
|
|
+ }
|
|
|
+ );
|
|
|
+ };
|
|
|
const itemRender = (data: any) => {
|
|
|
return (
|
|
|
- <div class={"flex"}>
|
|
|
- <Image class="w-160px h-160px rounded-6px" src={data?.thumbnail} />
|
|
|
- <div class={"flex-1 pl-20px"}>
|
|
|
+ <div class={"flex h-full overflow-hidden"}>
|
|
|
+ <div class={[itemPreview, "relative"]}>
|
|
|
+ <Image class="w-160px h-160px rounded-6px" src={data?.thumbnail} />
|
|
|
+ <div
|
|
|
+ class={"icon_preview absolute top-8px right-8px"}
|
|
|
+ onClick={() => workPreview(data._id)}
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ class={"w-20px h-20px"}
|
|
|
+ src={require("@/assets/imgs/icon_preview.png")}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class={"flex-1 pl-20px flex flex-col"}>
|
|
|
<div class={"text-18px"}>{data.title}</div>
|
|
|
- <div class={"mt-14px text-gray"}>{data.desc}</div>
|
|
|
+ <div class={"my-12px text-gray break-all flex-1 overflow-hidden"}>
|
|
|
+ {data.desc}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ };
|
|
|
+ const itemHistory = () => {
|
|
|
+ if (!state.currCollection.h5) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ const h5 = state.currCollection.h5[0];
|
|
|
+ const wks = state.currCollection.wks;
|
|
|
+ return (
|
|
|
+ <div class={"flex h-full overflow-hidden"}>
|
|
|
+ <div class={[itemPreview, "relative"]}>
|
|
|
+ <Image class="w-160px h-160px rounded-6px" src={h5.thumbnail} />
|
|
|
+ <div
|
|
|
+ class={"icon_preview absolute top-8px right-8px"}
|
|
|
+ onClick={() => historyPreview(wks.id)}
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ class={"w-20px h-20px"}
|
|
|
+ src={require("@/assets/imgs/icon_preview.png")}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class={"flex-1 pl-20px flex flex-col"}>
|
|
|
+ <div class={"text-18px"}>{h5.title}</div>
|
|
|
+ <div class={"my-12px text-gray break-all flex-1 overflow-hidden"}>
|
|
|
+ {h5.desc}
|
|
|
+ </div>
|
|
|
+ <div class={"text-12px text-gray"}>
|
|
|
+ 提交日期:{dayjs(wks.endTime).format("YYYY-MM-DD")}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
@@ -76,8 +160,22 @@ export default defineComponent({
|
|
|
const data = state.currCollection;
|
|
|
return (
|
|
|
<div>
|
|
|
- <div class={"w-full h-290px rounded-6px"}>
|
|
|
+ <div class={"text-18px mb-20px"}>{data.title}</div>
|
|
|
+ <div class={[itemPreview, "w-full h-290px rounded-6px relative"]}>
|
|
|
<Image class={"w-full h-full rounded-6px"} src={data.cover} />
|
|
|
+ {(data.introLink || data.introH5Id) && (
|
|
|
+ <div
|
|
|
+ class={"icon_preview absolute top-10px right-10px"}
|
|
|
+ onClick={() => {
|
|
|
+ collectionPreview(data);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ class={"w-30px h-30px"}
|
|
|
+ src={require("@/assets/imgs/icon_preview.png")}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
<div class={"flex justify-between items-center mt-15px"}>
|
|
|
<div>
|
|
@@ -107,16 +205,26 @@ export default defineComponent({
|
|
|
);
|
|
|
};
|
|
|
const search = async () => {
|
|
|
+ if (!state.searchVal) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
const collection = await resource.actions.searchCollection(
|
|
|
- state.searchVal
|
|
|
+ state.searchVal,
|
|
|
+ props.record._id
|
|
|
);
|
|
|
+ if (!collection) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
state.currCollection = collection[0];
|
|
|
};
|
|
|
const commit = async () => {
|
|
|
const res = await resource.actions.commitCollection({
|
|
|
id: state.currCollection._id,
|
|
|
- ...props.record,
|
|
|
+ h5Id: props.record._id,
|
|
|
});
|
|
|
+ if (!res) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
modal.submit();
|
|
|
queenApi.messageSuccess("发送成功");
|
|
|
};
|
|
@@ -161,7 +269,9 @@ export default defineComponent({
|
|
|
</div>
|
|
|
<div class={"flex-1 bg-white px-30px py-18px rounded-6px"}>
|
|
|
<div class={"text-16px"}>历史发送</div>
|
|
|
- <div class={"mt-20px h-160px"}>{EmptyHistory()}</div>
|
|
|
+ <div class={"mt-20px h-160px"}>
|
|
|
+ {state.currCollection.h5 ? itemHistory() : EmptyHistory()}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -182,6 +292,17 @@ export default defineComponent({
|
|
|
};
|
|
|
},
|
|
|
});
|
|
|
+const itemPreview = css`
|
|
|
+ &:hover {
|
|
|
+ .icon_preview {
|
|
|
+ opacity: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .icon_preview {
|
|
|
+ opacity: 0;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+`;
|
|
|
const ModalStyle = css`
|
|
|
color: #111;
|
|
|
.ant-input {
|