|
@@ -1,17 +1,20 @@
|
|
|
|
+import { IconWechat } from "@/assets/icons";
|
|
|
|
+import { PromotionController } from "@/modules/resource/controllers/PromotionController";
|
|
import { clipboard } from "@/utils";
|
|
import { clipboard } from "@/utils";
|
|
import { Image } from "@queenjs/ui";
|
|
import { Image } from "@queenjs/ui";
|
|
import { useQRCode } from "@vueuse/integrations/useQRCode";
|
|
import { useQRCode } from "@vueuse/integrations/useQRCode";
|
|
-import { Button, Input } from "ant-design-vue";
|
|
|
|
-import { defineComponent } from "vue";
|
|
|
|
|
|
+import { Button, Divider, Input } from "ant-design-vue";
|
|
|
|
+import { defineComponent, reactive } from "vue";
|
|
import { any } from "vue-types";
|
|
import { any } from "vue-types";
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
props: {
|
|
props: {
|
|
record: any().isRequired,
|
|
record: any().isRequired,
|
|
|
|
+ controller: any<PromotionController>().isRequired,
|
|
},
|
|
},
|
|
- emits: ["edit", "update", "changeThumnb"],
|
|
|
|
- setup(props, { slots, emit }) {
|
|
|
|
|
|
+ setup(props, { slots }) {
|
|
let shareLink = location.origin + "/share.html?id=" + props.record._id;
|
|
let shareLink = location.origin + "/share.html?id=" + props.record._id;
|
|
|
|
+
|
|
if (location.host == "www.infish.cn") {
|
|
if (location.host == "www.infish.cn") {
|
|
shareLink =
|
|
shareLink =
|
|
location.origin +
|
|
location.origin +
|
|
@@ -21,33 +24,44 @@ export default defineComponent({
|
|
|
|
|
|
const qrUrl = useQRCode(shareLink, { margin: 2 });
|
|
const qrUrl = useQRCode(shareLink, { margin: 2 });
|
|
|
|
|
|
|
|
+ const state = reactive({
|
|
|
|
+ ...props.record,
|
|
|
|
+ });
|
|
|
|
+
|
|
return () => {
|
|
return () => {
|
|
- const { record } = props;
|
|
|
|
|
|
+ const { controller, record } = props;
|
|
|
|
+ const { desc, thumbnail, title } = state;
|
|
|
|
|
|
return (
|
|
return (
|
|
<div class="flex items-start">
|
|
<div class="flex items-start">
|
|
<div>
|
|
<div>
|
|
- <div class="scrollbar w-375px h-600px pr-10px overflow-y-auto ">
|
|
|
|
|
|
+ <div class="scrollbar w-375px h-600px pr-10px overflow-y-auto">
|
|
{slots.preview?.()}
|
|
{slots.preview?.()}
|
|
</div>
|
|
</div>
|
|
<div class="mt-20px text-center">
|
|
<div class="mt-20px text-center">
|
|
- <Button type="primary" ghost onClick={() => emit("edit")}>
|
|
|
|
|
|
+ <Button
|
|
|
|
+ ghost
|
|
|
|
+ type="primary"
|
|
|
|
+ onClick={() => controller.onEdit(record)}
|
|
|
|
+ >
|
|
编辑作品
|
|
编辑作品
|
|
</Button>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex-1 ml-40px">
|
|
<div class="flex-1 ml-40px">
|
|
<h3 class="mb-20px text-16px">分享设置</h3>
|
|
<h3 class="mb-20px text-16px">分享设置</h3>
|
|
-
|
|
|
|
- <div class="flex">
|
|
|
|
|
|
+ <div class="flex items-start">
|
|
<div class="relative">
|
|
<div class="relative">
|
|
<Image
|
|
<Image
|
|
class="w-80px h-80px object-contain rounded-4px border-1px border-solid border-[#434343]"
|
|
class="w-80px h-80px object-contain rounded-4px border-1px border-solid border-[#434343]"
|
|
- src={record.thumbnail}
|
|
|
|
|
|
+ src={thumbnail}
|
|
/>
|
|
/>
|
|
<div
|
|
<div
|
|
class="absolute left-0 bottom-0 w-1/1 text-center py-5px text-14px bg-dark-200 bg-opacity-80 cursor-pointer"
|
|
class="absolute left-0 bottom-0 w-1/1 text-center py-5px text-14px bg-dark-200 bg-opacity-80 cursor-pointer"
|
|
- onClick={() => emit("changeThumnb")}
|
|
|
|
|
|
+ onClick={async () => {
|
|
|
|
+ const res: any = await controller.changeThumbnail();
|
|
|
|
+ state.thumbnail = res?.file?.url;
|
|
|
|
+ }}
|
|
>
|
|
>
|
|
更换封面
|
|
更换封面
|
|
</div>
|
|
</div>
|
|
@@ -56,39 +70,50 @@ export default defineComponent({
|
|
<Input
|
|
<Input
|
|
class="w-1/1"
|
|
class="w-1/1"
|
|
placeholder="请输入标题"
|
|
placeholder="请输入标题"
|
|
- defaultValue={record.title}
|
|
|
|
- onBlur={(e: any) => {
|
|
|
|
|
|
+ defaultValue={title}
|
|
|
|
+ onChange={(e: any) => {
|
|
const title = e.target.value;
|
|
const title = e.target.value;
|
|
- if (!title) return;
|
|
|
|
- emit("update", { title });
|
|
|
|
|
|
+ // if (!title) return;
|
|
|
|
+ state.title = title;
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
<Input
|
|
<Input
|
|
class="mt-10px w-1/1"
|
|
class="mt-10px w-1/1"
|
|
placeholder="请输入描述"
|
|
placeholder="请输入描述"
|
|
- defaultValue={record.desc}
|
|
|
|
- onBlur={(e: any) => {
|
|
|
|
|
|
+ defaultValue={desc}
|
|
|
|
+ onChange={(e: any) => {
|
|
const desc = e.target.value;
|
|
const desc = e.target.value;
|
|
- if (!desc) return;
|
|
|
|
- emit("update", { desc });
|
|
|
|
|
|
+ // if (!desc) return;
|
|
|
|
+ state.desc = desc;
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="mt-30px text-center">
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ class="w-150px"
|
|
|
|
+ onClick={() => controller.updateDesign(record, state)}
|
|
|
|
+ >
|
|
|
|
+ 保存
|
|
|
|
+ </Button>
|
|
|
|
+ </div>
|
|
|
|
+ <Divider />
|
|
<div class="mt-40px flex">
|
|
<div class="mt-40px flex">
|
|
<div>
|
|
<div>
|
|
- <h3 class=" text-16px">二维码</h3>
|
|
|
|
- <img class="mt-20px w-120px" src={qrUrl.value} />
|
|
|
|
- <div class="mt-10px text-center">
|
|
|
|
- <span class="ml-5px text-12px opacity-80">
|
|
|
|
- 微信扫一扫分享
|
|
|
|
- </span>
|
|
|
|
|
|
+ <h3 class="text-16px">二维码</h3>
|
|
|
|
+ <div class="mt-20px">
|
|
|
|
+ <img class="w-120px" src={qrUrl.value} />
|
|
|
|
+ </div>
|
|
|
|
+ <div class="flex items-center justify-center mt-6px">
|
|
|
|
+ <IconWechat class="mr-5px text-20px !text-[#69bb64] leading-0" />
|
|
|
|
+ <span class="opacity-80 text-12px">微信扫一扫分享</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="flex-1 w-0 ml-60px">
|
|
|
|
|
|
+ <div class="flex-1 w-0 ml-50px">
|
|
<h3 class=" text-16px">链接分享</h3>
|
|
<h3 class=" text-16px">链接分享</h3>
|
|
<div class="mt-20px">
|
|
<div class="mt-20px">
|
|
- <div class="w-1/1 py-4px px-10px border-solid border-1px border-[#434343] rounded-2px truncate opacity-80">
|
|
|
|
|
|
+ <div class="w-1/1 py-4px px-10px rounded-2px truncate opacity-80 bg-light-50 bg-opacity-8">
|
|
{shareLink}
|
|
{shareLink}
|
|
</div>
|
|
</div>
|
|
<Button
|
|
<Button
|