index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <transition mode="out-in">
  3. <div>
  4. <dialogIndex @closeDialog="closeDialog" @confirmDialog="confirmDialog" v-if="dialog == 'dialogIndex'"></dialogIndex>
  5. <dialogShare :shareLink="shareLink" @closeDialog="closeDialog" v-if="dialog == 'dialogShare'"></dialogShare>
  6. <createdRoom v-if="showCreated" @closeCreated="closeCreated" @createdConfirm="createdConfirm()"></createdRoom>
  7. <PageRtcLive @closeSocket="confirmDialog" @openDialog="openDialog" v-if="show"></PageRtcLive>
  8. </div>
  9. </transition>
  10. </template>
  11. <script setup>
  12. import PageRtcLive from "./PageRtcLive";
  13. // import Draw from "./paint/Draw";
  14. import createdRoom from "./dialog/createdRoom";
  15. import dialogIndex from "./dialog/index.vue";
  16. import dialogShare from "./dialog/share.vue";
  17. import browser from "@/utils/browser";
  18. import { onMounted, watch, computed, ref, nextTick } from "vue";
  19. import { useStore } from "vuex";
  20. import { useApp, getApp } from "@/app";
  21. const store = useStore();
  22. const shareLink = ref("");
  23. const dialog = ref("");
  24. const show = ref(false);
  25. const showPaint = ref(true);
  26. const showCreated = ref(false);
  27. const roomId = ref(browser.getURLParam("roomId"));
  28. const role = ref(browser.getURLParam("role"));
  29. const userName = ref(browser.getURLParam("name"));
  30. const openDialog = (str, link) => {
  31. shareLink.value = link;
  32. dialog.value = str;
  33. };
  34. const closeDialog = (str, link) => {
  35. dialog.value = "";
  36. dialog.value = str;
  37. };
  38. const confirmDialog = async () => {
  39. await getApp().Connect.follow.exit();
  40. store.commit("showShoppingguide", false);
  41. let tempUrl = window.location.href;
  42. ["mode", "name", "role", "roomId","userId"].forEach((item) => {
  43. tempUrl = browser.replaceQueryString(tempUrl, item, "");
  44. });
  45. history.replaceState(null, null, tempUrl);
  46. store.commit("showShoppingguide", false);
  47. dialog.value = "";
  48. };
  49. const closeCreated = (str, link) => {
  50. store.commit("showShoppingguide", false);
  51. showCreated.value = false;
  52. };
  53. const createdConfirm = (str, link) => {
  54. showCreated.value = false;
  55. show.value = true;
  56. };
  57. onMounted(() => {
  58. useApp().then(async (sdk) => {
  59. await nextTick()
  60. if (userName.value) {
  61. createdConfirm()
  62. }else{
  63. showCreated.value = true;
  64. }
  65. });
  66. // showCreated.value = true;
  67. });
  68. </script>
  69. <style lang="scss" scoped></style>