tremble 3 gadi atpakaļ
vecāks
revīzija
ee3e81af34
2 mainītis faili ar 22 papildinājumiem un 2 dzēšanām
  1. 22 1
      src/components/RTC/PageRtcLive.vue
  2. 0 1
      src/views/viewimg.vue

+ 22 - 1
src/components/RTC/PageRtcLive.vue

@@ -305,7 +305,7 @@ const setUserJoin = async (res) => {
     name = "主持人";
     Dialog.toast({ content: `主持人進入房間` });
     socket.value.emit("action", { type: "user-init" });
-  }
+  } 
   let data = {
     role: res.user.Role,
     mode: mode.value,
@@ -506,6 +506,7 @@ const startFollow = (app) => {
 
     connectStatus.value = 1;
     if (role.value == "customer") {
+      socket.value.emit("action", { type: "ask-currentscene" });
       socket.value.emit("action", { type: "user-init" });
       if (data.user.IsMuted) {
         disableMic.value = true;
@@ -599,6 +600,7 @@ const startFollow = (app) => {
   });
 
   socket.value.on("action", (data) => {
+    console.log(data,'=============');
     if (data.type == "error") {
       Dialog.toast({ content: `房間未找到`, type: "error" });
       emit("closeSocket");
@@ -658,6 +660,25 @@ const startFollow = (app) => {
           data: {},
         });
       }
+    } else if (data.type == "ask-currentscene") {
+      console.log(111111111);
+      if (role.value == "leader") {
+        socket.value.emit("action", {
+          type: "answer-currentscene",
+          data: {
+            scene: browser.getURLParam("m"),
+            pose: browser.getURLParam("pose"),
+          },
+        });
+      }
+    } else if (data.type == "answer-currentscene") {
+      if (role.value == "customer") {
+        if (data.data.scene != browser.getURLParam("m")) {
+          let url1 = browser.replaceQueryString(window.location.href, "m", data.data.scene);
+          let url = browser.replaceQueryString(url1, "pose", data.data.pose);
+          location.replace(url)
+        }
+      }
     }
   });
 

+ 0 - 1
src/views/viewimg.vue

@@ -30,7 +30,6 @@ const initScroll = () => {
   nextTick(() => {
     let t = setTimeout(() => {
       clearTimeout(t);
-      console.log(props.keyid);
       new Swiper(`.${props.keyid}`, {
         on: {
           touchMove(swiper, e) {