Promotion.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. const isWk = params.get("isWk");
  10. editor.actions.switchMode("preview");
  11. if (id) {
  12. if (isWk) {
  13. editor.actions.initWkDesign(id);
  14. } else {
  15. editor.actions.initDesign(id, isSys?.split("#")[0]);
  16. }
  17. editor.controls.wxCtrl.setup(window.location.href);
  18. editor.actions.on("initDesign:success", () => {
  19. const data = editor.store.designData;
  20. document.title = data.title;
  21. const shareData = {
  22. title: data.title,
  23. link: location.href,
  24. imgUrl: data.thumbnail || "",
  25. desc: data.desc,
  26. };
  27. editor.controls.wxCtrl.setShareData(shareData);
  28. editor.controls.wxCtrl.setShare(shareData);
  29. });
  30. }
  31. // fetch("https://restapi.amap.com/v3/ip?key=6f53b2e09f72ad63423b2da6e08b25d7").then(response=>{
  32. // return response.json();
  33. // }).then(data=>{
  34. // console.log(data);
  35. // })
  36. return () => (
  37. <div class="flex items-center justify-center h-100vh bg-gray-100">
  38. <div class={isPc() ? `h-668px scrollbar` : `h-full`}>
  39. <editor.components.Preview />
  40. </div>
  41. </div>
  42. );
  43. });