|
@@ -1,39 +1,110 @@
|
|
|
+import { Image } from "@queenjs/ui";
|
|
|
+import { useClipboard } from "@vueuse/core";
|
|
|
+import { useQRCode } from "@vueuse/integrations/useQRCode";
|
|
|
import { Button, Input } from "ant-design-vue";
|
|
|
import { defineComponent } from "vue";
|
|
|
import { any } from "vue-types";
|
|
|
-import { Image } from "@queenjs/ui";
|
|
|
|
|
|
export default defineComponent({
|
|
|
props: {
|
|
|
record: any().isRequired,
|
|
|
},
|
|
|
- setup(props, { slots }) {
|
|
|
+ emits: ["edit", "update"],
|
|
|
+ setup(props, { slots, emit }) {
|
|
|
+ let shareLink = location.origin + "/share.html?id=" + props.record._id;
|
|
|
+ if (location.host == "www.infish.cn") {
|
|
|
+ shareLink =
|
|
|
+ location.origin +
|
|
|
+ "/projects/queenshow/share.html?id=" +
|
|
|
+ props.record._id;
|
|
|
+ }
|
|
|
+
|
|
|
+ const { copy } = useClipboard();
|
|
|
+
|
|
|
+ const qrUrl = useQRCode(shareLink, { margin: 2 });
|
|
|
+
|
|
|
+ const savaData = (key: string, value: string) => {
|
|
|
+ emit("update", {
|
|
|
+ _id: props.record._id,
|
|
|
+ [key]: value,
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const changeThumbnail = () => {
|
|
|
+ savaData(
|
|
|
+ "thumbnail",
|
|
|
+ "https://infishwaibao.oss-cn-chengdu.aliyuncs.com/queenshow/img/Logo.8478c1b4.png"
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
return () => {
|
|
|
const { record } = props;
|
|
|
+
|
|
|
+ console.log("qrUrl: ", qrUrl);
|
|
|
+
|
|
|
return (
|
|
|
<div class="flex items-start">
|
|
|
<div>
|
|
|
- <div class="scroll w-375px max-h-600px overflow-y-auto bg-light-50">
|
|
|
+ <div class="scroll w-375px h-600px overflow-y-auto bg-light-50">
|
|
|
{slots.preview?.()}
|
|
|
</div>
|
|
|
- <div class="mt-20px">
|
|
|
- <Button type="primary" ghost>
|
|
|
+ <div class="mt-20px text-center">
|
|
|
+ <Button type="primary" ghost onClick={() => emit("edit")}>
|
|
|
编辑作品
|
|
|
</Button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flex-1 ml-40px">
|
|
|
- <h3>设置</h3>
|
|
|
+ <h3 class="mb-20px text-16px">设置</h3>
|
|
|
+
|
|
|
<div class="flex">
|
|
|
- <div>
|
|
|
+ <div class="relative">
|
|
|
<Image
|
|
|
- class="w-80px h-80px object-contain rounded-4px border-1px border-solid border-light-50"
|
|
|
+ class="w-80px h-80px object-contain rounded-4px border-1px border-solid border-[#434343]"
|
|
|
src={record.thumbnail}
|
|
|
/>
|
|
|
+ <div
|
|
|
+ class="absolute left-0 bottom-0 w-1/1 text-center py-5px text-14px bg-dark-200 bg-opacity-80 cursor-pointer"
|
|
|
+ onClick={changeThumbnail}
|
|
|
+ >
|
|
|
+ 更换封面
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="flex-1 ml-20px">
|
|
|
- <Input placeholder="请输入分享标题" class="w-1/1" />
|
|
|
- <Input placeholder="请输入分享标题" class="mt-10px w-1/1" />
|
|
|
+ <Input
|
|
|
+ class="w-1/1"
|
|
|
+ defaultValue={record.title}
|
|
|
+ placeholder="请输入标题"
|
|
|
+ onBlur={(e: any) => savaData("title", e.target.value)}
|
|
|
+ />
|
|
|
+ <Input placeholder="请输入描述" class="mt-10px w-1/1" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="mt-40px flex">
|
|
|
+ <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>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="flex-1 w-0 ml-60px">
|
|
|
+ <h3 class=" text-16px">链接分享</h3>
|
|
|
+ <div class="mt-20px">
|
|
|
+ <div class="w-1/1 py-4px px-10px border-solid border-1px border-[#434343] rounded-2px truncate opacity-80">
|
|
|
+ {shareLink}
|
|
|
+ </div>
|
|
|
+ <Button
|
|
|
+ class="mt-10px"
|
|
|
+ type="primary"
|
|
|
+ ghost
|
|
|
+ onClick={() => copy(shareLink)}
|
|
|
+ >
|
|
|
+ 复制链接
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|