Promotion.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { initEditor } from "@/modules/editor";
  2. import { isPc } from "@queenjs/utils";
  3. import { defineComponent } from "vue";
  4. export default defineComponent(() => {
  5. const editor = initEditor();
  6. const params = new URLSearchParams(location.href.split("?")[1]);
  7. const id = params.get("id");
  8. const isSys = params.get("isSys");
  9. editor.actions.switchMode("preview");
  10. if (id) {
  11. editor.actions.initDesign(id, isSys?.split("#")[0]);
  12. editor.controls.wxCtrl.setup(window.location.href);
  13. editor.actions.on("initDesign:success", () => {
  14. const data = editor.store.designData;
  15. document.title = data.title;
  16. const shareData = {
  17. title: data.title,
  18. link: location.href,
  19. imgUrl: data.thumbnail || "",
  20. desc: data.desc,
  21. };
  22. editor.controls.wxCtrl.setShareData(shareData);
  23. editor.controls.wxCtrl.setShare(shareData);
  24. });
  25. }
  26. // fetch("https://restapi.amap.com/v3/ip?key=6f53b2e09f72ad63423b2da6e08b25d7").then(response=>{
  27. // return response.json();
  28. // }).then(data=>{
  29. // console.log(data);
  30. // })
  31. return () => (
  32. <div class="flex items-center justify-center h-100vh bg-gray-100">
  33. <div class={isPc() ? `h-668px scrollbar` : `h-full`}>
  34. <editor.components.Preview />
  35. </div>
  36. </div>
  37. );
  38. });