Parcourir la source

feat: 取消主持人摄像头及修复3d模型不能点击问题

rindy il y a 3 ans
Parent
commit
63a53b4c92

+ 2 - 2
public/index.html

@@ -26,8 +26,8 @@
         <script src="<%= BASE_URL %><%= VUE_APP_STATIC_DIR %>/static/lib/socket.io.min.js"></script>
         <script src="<%= BASE_URL %><%= VUE_APP_STATIC_DIR %>/static/lib/zmjm.min.js"></script>
         <script src="<%= VUE_APP_STATIC_DIR %>/static/lib/jweixin-1.6.0.js"></script>
-        <script src="<%= VUE_APP_SDK_DIR %>/kankan-sdk-deps.js?v=4.37.3-alpha.60"></script>
-        <script src="<%= VUE_APP_SDK_DIR %>/kankan-sdk.js?v=4.37.3-alpha.60"></script>
+        <script src="<%= VUE_APP_SDK_DIR %>/kankan-sdk-deps.js?v=4.37.3-alpha.71"></script>
+        <script src="<%= VUE_APP_SDK_DIR %>/kankan-sdk.js?v=4.37.3-alpha.71"></script>
         <script>
             if ((query = window.location.href.indexOf('vlog') != -1)) {
                 var vConsole = new window.VConsole()

+ 112 - 31
src/app.vue

@@ -19,10 +19,19 @@
         </p>
       </teleport> -->
       <teleport v-if="refMiniMap && player.showWidgets" :to="refMiniMap">
-        <span :class="{ gudieDisabled: isshoppingguide && role != 'leader' }" class="button-switch" @click.stop="toggleMap">
+        <span
+          :class="{ gudieDisabled: isshoppingguide && role != 'leader' }"
+          class="button-switch"
+          @click.stop="toggleMap"
+        >
           <ui-icon type="show_map_collect"></ui-icon>
         </span>
-        <div v-if="controls.showDollhouse" :class="{ gudieDisabled: isshoppingguide && role != 'leader' }" class="change" @click="changeMode('dollhouse')">
+        <div
+          v-if="controls.showDollhouse"
+          :class="{ gudieDisabled: isshoppingguide && role != 'leader' }"
+          class="change"
+          @click="changeMode('dollhouse')"
+        >
           <ui-icon type="show_3d_normal"></ui-icon>
           <span> 3D模型</span>
         </div>
@@ -51,18 +60,39 @@
 
       <template v-if="refMiniMap && player.showWidgets">
         <div
-          :class="{ disabled: flying, gudieDisabled: isshoppingguide && role != 'leader' }"
+          :class="{
+            disabled: flying,
+            gudieDisabled: isshoppingguide && role != 'leader',
+          }"
           v-show="mode != 'panorama'"
           v-if="controls.showFloorplan && controls.showDollhouse"
           class="tab-layer"
         >
           <div class="tabs" v-if="controls.showMap">
-            <span :class="{ active: mode === 'floorplan' }" ref="floorplan_ref" @click="changeMode('floorplan', $event)">
-              <ui-icon :type="mode == 'floorplan' ? 'show_plane_selected' : 'show_plane_normal'"></ui-icon>
+            <span
+              :class="{ active: mode === 'floorplan' }"
+              ref="floorplan_ref"
+              @click="changeMode('floorplan', $event)"
+            >
+              <ui-icon
+                :type="
+                  mode == 'floorplan'
+                    ? 'show_plane_selected'
+                    : 'show_plane_normal'
+                "
+              ></ui-icon>
               二維
             </span>
-            <span :class="{ active: mode === 'dollhouse' }" ref="dollhouse_ref" @click="changeMode('dollhouse', $event)">
-              <ui-icon :type="mode == 'dollhouse' ? 'show_3d_selected' : 'show_3d_normal'"></ui-icon>
+            <span
+              :class="{ active: mode === 'dollhouse' }"
+              ref="dollhouse_ref"
+              @click="changeMode('dollhouse', $event)"
+            >
+              <ui-icon
+                :type="
+                  mode == 'dollhouse' ? 'show_3d_selected' : 'show_3d_normal'
+                "
+              ></ui-icon>
 
               三維
             </span>
@@ -111,7 +141,11 @@ let jumpNewScene = (sceneFirstView) => {
   if (!browser.hasURLParam("pose")) {
     url += `&${sceneFirstView.sceneview}`;
   } else {
-    url = browser.replaceQueryString(url, "pose", sceneFirstView.sceneview.replace("pose=", ""));
+    url = browser.replaceQueryString(
+      url,
+      "pose",
+      sceneFirstView.sceneview.replace("pose=", "")
+    );
   }
 
   url = browser.replaceQueryString(url, "m", sceneFirstView.num);
@@ -173,7 +207,10 @@ const scene$ = ref(null);
 const hadVideo = ref(true);
 
 if (!Cache.get("HIDENVIDEOEXPIRES")) {
-  if (browser.getURLParam("m") == "eur-KJ-z5ZEV22AeU" && browser.getURLParam("pose") == "pano:408,qua:-0.006,0.6299,0.0049,0.7766") {
+  if (
+    browser.getURLParam("m") == "eur-KJ-z5ZEV22AeU" &&
+    browser.getURLParam("pose") == "pano:408,qua:-0.006,0.6299,0.0049,0.7766"
+  ) {
     Cache.set("HIDENVIDEOEXPIRES", "yes", 60 * 8 * 60);
     hadVideo.value = false;
   } else {
@@ -191,10 +228,14 @@ const refMiniMap = ref(null);
 const isCollapse = ref(false);
 const background = ref(null);
 const resize = () => {
-  if (this.$refs.background && (this.mode == "floorplan" || this.mode == "dollhouse")) {
+  if (
+    this.$refs.background &&
+    (this.mode == "floorplan" || this.mode == "dollhouse")
+  ) {
     this.$nextTick(() => {
       let $active = $(this.$el).find(".tabs .active");
-      background.value.style.width = $active[0].getBoundingClientRect().width + "px";
+      background.value.style.width =
+        $active[0].getBoundingClientRect().width + "px";
       background.value.style.left = $active.position().left + "px";
     });
   }
@@ -203,12 +244,13 @@ const resize = () => {
 watch(
   () => isshoppingguide.value,
   (val, old) => {
+    
     let $minmap = document.querySelector("[xui_min_map]");
 
     if ($minmap) {
       setTimeout(async () => {
-        if (browser.getURLParam("role") == "customer") {
           await nextTick();
+        if (browser.getURLParam("role") == "customer") {
           if (isshoppingguide.value) {
             $minmap.classList.add("gudieDisabled");
           } else {
@@ -220,6 +262,8 @@ watch(
             //   imgUrl: "https://glp-vr.cdfmembers.com/cdf/file/91dd5305525f463286f03a31abd1c154.jpg",
             // });
           }
+        } else {
+          $minmap.classList.remove("gudieDisabled");
         }
       });
     }
@@ -272,12 +316,14 @@ watch(
       clearTimeout(timer);
       if (val == "floorplan") {
         if (floorplan_ref.value && floorplan_ref.value) {
-          background.value.style.width = floorplan_ref.value.getBoundingClientRect().width + "px";
+          background.value.style.width =
+            floorplan_ref.value.getBoundingClientRect().width + "px";
           background.value.style.left = floorplan_ref.value.offsetLeft + "px";
         }
       } else if (val == "dollhouse") {
         if (dollhouse_ref.value && dollhouse_ref.value) {
-          background.value.style.width = dollhouse_ref.value.getBoundingClientRect().width + "px";
+          background.value.style.width =
+            dollhouse_ref.value.getBoundingClientRect().width + "px";
           background.value.style.left = dollhouse_ref.value.offsetLeft + "px";
         }
       }
@@ -363,7 +409,9 @@ onMounted(async () => {
             data.hotContent = JSON.parse(data.hotContent);
           } catch (error) {}
           return `<span class="tag-icon applet_link animate" style="background-image:url(${
-            data.hotContent.liveIcon.src ? common.changeUrl(data.hotContent.liveIcon.src) : "{{icon}}"
+            data.hotContent.liveIcon.src
+              ? common.changeUrl(data.hotContent.liveIcon.src)
+              : "{{icon}}"
           })"></span>`;
         } else if (data.type == "link_scene") {
           return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
@@ -375,14 +423,23 @@ onMounted(async () => {
                   `;
         } else if (data.type == "commodity") {
           let arr = data.products.map((item) => item.price);
-          let priceMin = isFinite(Math.min.apply(null, arr)) ? Math.min.apply(null, arr) : 0;
-          let priceMax = isFinite(Math.max.apply(null, arr)) ? Math.max.apply(null, arr) : 0;
-          let price = priceMin == priceMax ? priceMax : `${priceMin}-${priceMax}`;
-          let range = `${data.products[0] ? data.products[0].symbol : "MOP$"} ${price}`;
+          let priceMin = isFinite(Math.min.apply(null, arr))
+            ? Math.min.apply(null, arr)
+            : 0;
+          let priceMax = isFinite(Math.max.apply(null, arr))
+            ? Math.max.apply(null, arr)
+            : 0;
+          let price =
+            priceMin == priceMax ? priceMax : `${priceMin}-${priceMax}`;
+          let range = `${
+            data.products[0] ? data.products[0].symbol : "MOP$"
+          } ${price}`;
           return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
                       <div class="tag-body">
                         <div data-id="${data.sid}" class="tag-commodity">
-                          <div  style="background-image:url(${data.products[0] ? data.products[0].pic : ""})" class='tag-avatar'>
+                          <div  style="background-image:url(${
+                            data.products[0] ? data.products[0].pic : ""
+                          })" class='tag-avatar'>
                           </div>
                           <p class="tag-title">${data.title}</p>
                           <p class="tag-info">${range} | 查看 ></p>
@@ -404,10 +461,16 @@ onMounted(async () => {
               if (isshoppingguide.value) {
                 return;
               }
-              document.querySelector(`[data-tag-id="${tag.sid}"] .tag-icon`).style.display = "none";
-              let hotcontent = typeof tag.hotContent == "string" ? JSON.parse(tag.hotContent) : tag.hotContent;
+              document.querySelector(
+                `[data-tag-id="${tag.sid}"] .tag-icon`
+              ).style.display = "none";
+              let hotcontent =
+                typeof tag.hotContent == "string"
+                  ? JSON.parse(tag.hotContent)
+                  : tag.hotContent;
               browser.openLink(
-                "/subPackage/pages/activity/activity?pageId=" + hotcontent.couponLink,
+                "/subPackage/pages/activity/activity?pageId=" +
+                  hotcontent.couponLink,
                 `https://m.cdfmembers.com/shop/600667208/showactivity?pageId=${hotcontent.couponLink}`,
                 `/pages/showactivity/showactivity?pageId=${hotcontent.couponLink}`
               );
@@ -424,9 +487,13 @@ onMounted(async () => {
               if (isshoppingguide.value) {
                 return;
               }
-              let hotcontent = typeof tag.hotContent == "string" ? JSON.parse(tag.hotContent) : tag.hotContent;
+              let hotcontent =
+                typeof tag.hotContent == "string"
+                  ? JSON.parse(tag.hotContent)
+                  : tag.hotContent;
               browser.openLink(
-                "/subPackage/pages/home/home?pageType=2&pageId=" + hotcontent.liveLink,
+                "/subPackage/pages/home/home?pageType=2&pageId=" +
+                  hotcontent.liveLink,
                 `https://m.cdfmembers.com/shop/600667208/showactivity?pageId=${hotcontent.liveLink}`,
                 `/pages/showactivity/showactivity?pageId=${hotcontent.liveLink}`
               );
@@ -441,7 +508,10 @@ onMounted(async () => {
 
       view.on("focus", (e) => {
         document.querySelectorAll("[xui_tags_view] >div").forEach((el) => {
-          if (el.getAttribute("data-tag-type") == "link_scene" || el.getAttribute("data-tag-type") == "commodity") {
+          if (
+            el.getAttribute("data-tag-type") == "link_scene" ||
+            el.getAttribute("data-tag-type") == "commodity"
+          ) {
             el.querySelector(".tag-body").classList.remove("show");
             el.style.zIndex = "auto";
           }
@@ -449,11 +519,16 @@ onMounted(async () => {
         if (e.data.type == "commodity" || e.data.type == "link_scene") {
           e.target.style.zIndex = "999";
           e.target.querySelector(".tag-body").classList.add("show");
-          e.target.querySelector(".tag-commodity").removeEventListener("click", onClickTagInfo);
-          e.target.querySelector(".tag-commodity").addEventListener("click", onClickTagInfo);
+          e.target
+            .querySelector(".tag-commodity")
+            .removeEventListener("click", onClickTagInfo);
+          e.target
+            .querySelector(".tag-commodity")
+            .addEventListener("click", onClickTagInfo);
 
           if (tagid) {
-            document.querySelector(`[data-id="${tagid}"]`) && document.querySelector(`[data-id="${tagid}"]`).click();
+            document.querySelector(`[data-id="${tagid}"]`) &&
+              document.querySelector(`[data-id="${tagid}"]`).click();
             tagid = null;
           }
         }
@@ -564,7 +639,9 @@ onMounted(async () => {
       ),
     });
   });
-  app.store.on("floorcad", (floor) => store.commit("scene/loadFloorData", floor));
+  app.store.on("floorcad", (floor) =>
+    store.commit("scene/loadFloorData", floor)
+  );
 
   app.render();
   document.removeEventListener("visibilitychange", visibilitychangeFn);
@@ -672,7 +749,11 @@ onMounted(async () => {
         width: 2px;
         height: 28px;
         bottom: -30px;
-        background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
+        background: linear-gradient(
+          145deg,
+          rgba(255, 255, 255, 0.8),
+          rgba(255, 255, 255, 0)
+        );
         position: absolute;
       }
       .tag-avatar {

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

@@ -119,24 +119,15 @@ TRTC.checkSystemRequirements().then((checkResult) => {
 });
 
 async function createLocalStream() {
-  let isLeader = role.value == "leader";
   try {
     localStream = TRTC.createStream({
       userId: store.getters["rtc/userId"],
       audio: true,
-      video: isLeader,
-      cameraId: isLeader ? store.getters["rtc/videoDeviceId"] : "",
+      video: false,
       microphoneId: store.getters["rtc/audioDeviceId"],
     });
-    isLeader && localStream.setVideoProfile("480p");
 
     await localStream.initialize();
-    if (props.audioMuted) {
-      localStream.muteAudio();
-      if (role.value == "leader") {
-        muteAudioLeader.value = props.audioMuted;
-      }
-    }
   } catch (error) {
     console.log(error, "createStream");
   }

+ 1 - 1
src/components/RTC/dialog/createdRoom.vue

@@ -79,7 +79,7 @@ export default {
     },
     createdConfirm() {
       if (this.userName == "") {
-        Dialog.toast({ content: "請輸入您的昵稱", type: "error" });
+        Dialog.toast({ content: "请输入入您的昵称", type: "error" });
         return;
       }
       let name = encodeURIComponent(this.userName);

+ 15 - 15
src/components/RTC/trtc/Device.vue

@@ -19,27 +19,27 @@ const emit = defineEmits(["switchDevice", "canUseDevice"]);
 
 const updateDevice = async () => {
   console.log("updateDevice");
-  const cameraItems = await TRTC.getCameras();
-  cameraItems.forEach((item) => {
-    item.value = item.deviceId;
-  });
+  // const cameraItems = await TRTC.getCameras();
+  // cameraItems.forEach((item) => {
+  //   item.value = item.deviceId;
+  // });
   const microphoneItems = await TRTC.getMicrophones();
   microphoneItems.forEach((item) => {
     item.value = item.deviceId;
   });
 
   store.commit("rtc/setDeviceList", {
-    cameraList: cameraItems,
+    cameraList: [],
     microphoneList: microphoneItems,
   });
 
-  if (!videoDeviceId.value) {
-    if (cameraItems[0]) {
-      store.commit("rtc/setVideoDeviceId", cameraItems[0].deviceId);
-    } else {
-      Dialog.toast({ content: `无法获取您的摄像头权限`, type: "error" });
-    }
-  }
+  // if (!videoDeviceId.value) {
+  //   if (cameraItems[0]) {
+  //     store.commit("rtc/setVideoDeviceId", cameraItems[0].deviceId);
+  //   } else {
+  //     Dialog.toast({ content: `无法获取您的摄像头权限`, type: "error" });
+  //   }
+  // }
 
   if (!audioDeviceId.value) {
     if (microphoneItems[0]) {
@@ -50,7 +50,7 @@ const updateDevice = async () => {
   }
 };
 
-let quxian = role.value == "leader" ?{ audio: true,video:true }: { audio: true };
+let quxian = { audio: true };
 
 console.log(quxian, '--------quxian-------');
 
@@ -65,14 +65,14 @@ navigator.mediaDevices
   })
   .catch((error) => {
     console.log(error, "error");
-    Dialog.toast({ content: `请授权您的麦克风${role.value == "leader" ? "和摄像头" : ""}权限`, type: "error" });
+    Dialog.toast({ content: `请授权您的麦克风权限`, type: "error" });
   });
 
 navigator.mediaDevices.ondevicechange = updateDevice;
 
 const handleDeviceChange = () => {
   emit("switchDevice", {
-    videoId: store.videoDeviceId,
+    videoId: '',
     audioId: store.audioDeviceId,
   });
 };