ShareBox.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { useEditor } from "@/modules/editor";
  2. import { clipboard } from "@/utils";
  3. import { useAuth } from "@queenjs-modules/auth";
  4. import { useQRCode } from "@vueuse/integrations/useQRCode";
  5. import { Button } from "ant-design-vue";
  6. import { defineComponent } from "vue";
  7. export const ShareBox = defineComponent({
  8. setup() {
  9. const { store } = useEditor();
  10. const auth = useAuth();
  11. const userInfo: any = auth.store.userInfo;
  12. const isSys = userInfo.roles?.includes("system") ? true : false;
  13. let shareLink =
  14. location.origin +
  15. "/share.html?id=" +
  16. store.designData._id +
  17. "&isSys=" +
  18. isSys;
  19. // if (location.host == "www.infish.cn") {
  20. // shareLink =
  21. // location.origin +
  22. // "/projects/queenshowv1/share.html?id=" +
  23. // store.designData._id;
  24. // }
  25. const qrUrl = useQRCode(shareLink);
  26. return () => (
  27. <div class="p-20px bg-dark-500 text-center">
  28. <img src={qrUrl.value} />
  29. <div class="mb-20px"></div>
  30. <Button onClick={() => clipboard.copy(shareLink)}>复制链接</Button>
  31. </div>
  32. );
  33. },
  34. });