tremble před 3 roky
rodič
revize
3962e56187

+ 3 - 1
src/app.vue

@@ -204,9 +204,11 @@ watch(
   () => isshoppingguide.value,
   (val, old) => {
     let $minmap = document.querySelector("[xui_min_map]");
+    console.log( $minmap,'isshoppingguide.valueisshoppingguide.valueisshoppingguide.value');
+
     if ($minmap) {
       setTimeout(async () => {
-        if (role.value == "customer") {
+        if (browser.getURLParam("role") == "customer") {
           await nextTick();
           if (isshoppingguide.value) {
             $minmap.classList.add("gudieDisabled");

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

@@ -146,7 +146,7 @@ let getUrl = (href, queryArr) => {
     if (!browser.hasURLParam(item.key)) {
       let ttt = href.split("index.html?");
       href = `${ttt[0]}index.html?${item.key}=${item.val}&${ttt[1]}`;
-      console.log(href);
+      console.log(href,'------index.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.html----------');
     } else {
       href = browser.replaceQueryString(href, item.key, item.val);
     }

+ 6 - 1
src/components/RTC/Trtccom.vue

@@ -37,7 +37,7 @@
 <script setup>
 import TRTC, { Client, LocalStream } from "trtc-js-sdk";
 import { Dialog } from "@/global_components/";
-import { ref, computed, watch, defineEmits, defineProps, nextTick } from "vue";
+import { ref, computed, watch, defineEmits, defineProps, nextTick, onUnmounted } from "vue";
 import Device from "./trtc/Device";
 import { useStore } from "vuex";
 import browser from "@/utils/browser";
@@ -250,6 +250,7 @@ async function handleLeave() {
     store.commit("rtc/setAudioDeviceId", "");
 
     if (localStream) {
+      console.log('有执行到这里-------------');
       localStream.stop();
       localStream.close();
       localStream = null;
@@ -423,6 +424,10 @@ let switchDevice = async ({ videoId, audioId }) => {
   }
 };
 
+onUnmounted(()=>{
+  handleLeave()
+})
+
 let canUseDevice = () => {
   console.log("可用");
   handleJoin();

+ 4 - 0
src/components/RTC/index.vue

@@ -57,10 +57,14 @@ const confirmDialog = async () => {
 
   store.commit("rtc/setIsJoined", false);
 
+  store.commit("rtc/setVideoDeviceId", "");
+  store.commit("rtc/setAudioDeviceId", "");
+
   let tempUrl = window.location.href;
   ["mode", "name", "role", "roomId", "vruserId"].forEach((item) => {
     tempUrl = browser.replaceQueryString(tempUrl, item, "");
   });
+
   history.replaceState(null, null, tempUrl);
   store.commit("rtc/setRole", "");
 

+ 2 - 2
src/utils/browser.js

@@ -357,9 +357,9 @@ var browser = {
     let re = new RegExp(name + "=[^&]*", "gi");
     if (!value) {
       let ttt = url.replace(new RegExp('&' + name + "=[^&]*", "gi"), '')
-      return ttt.replace(re, '');
+      return (ttt.replace(re, '')).replace("?&",'?');
     }
-    return url.replace(re, name + "=" + value);
+    return (url.replace(re, name + "=" + value)).replace("?&",'?');
   },
   openLink(mglink, h5link, appLink) {
     if (this.getURLParam("isBuyerApp") === "1") {