gemercheung il y a 2 ans
Parent
commit
2daeee2cf4

+ 95 - 21
src/App.vue

@@ -1,7 +1,8 @@
 <script setup lang="ts">
-  import { onMounted, ref, h, computed, unref, watchEffect } from 'vue';
+  import { onMounted, ref, computed, unref, watchEffect } from 'vue';
   import { createApp } from '/@/hooks/userApp';
-  import tagView from '/@/components/custom/tagView.vue';
+  // import tagView from '/@/components/custom/tagView.vue';
+  // import tag from '/@/components/custom/tag.vue';
   import LoadingLogo from '/@/components/basic/loading.vue';
   import MiniMap from '/@/components/basic/miniMap.vue';
   import FloorplanView from '/@/components/basic/floorplan.vue';
@@ -17,11 +18,13 @@
   // import { useRtcStore } from './store/modules/rtc';
   import { useTourPlayer } from './hooks/userTourPlayer';
   import { KankanMetaDataType } from '/#/sdk';
-  import Dialog from '/@/components/basic/dialog';
+  // import Dialog from '/@/components/basic/dialog';
+  import { useRtcStore } from './store/modules/rtc';
   const { createTourPlayer } = useTourPlayer();
 
   const sceneStore = useSceneStore();
   const appStore = useAppStore();
+  const rtcStore = useRtcStore();
   // const rtcStore = useRtcStore();
   const dataLoaded = ref(false);
   const scene$ = ref<Nullable<HTMLElement>>(null);
@@ -66,19 +69,54 @@
 
     createTourPlayer();
 
-    app.use('TagView', {
-      render(data) {
-        if (data.media['image'] && data.media['image'].length) {
-          return h(tagView, {
-            sid: data.sid,
-            url: app.resource.getUserResourceURL(data.media['image'][0].src),
-            content: data.content,
-            title: data.title,
-          });
-        }
-        return `<span class="tag-icon animate" style="display:none"></span>`;
-      },
-    });
+    app
+      .use('TagView', {
+        render(data) {
+          // console.log('tagView', data);
+          if (data.media['image'] && data.media['image'].length) {
+            // console.log('tagView-1', data);
+            // return h(tagView, {
+            //   sid: data.sid,
+            //   url: app.resource.getUserResourceURL(data.media['image'][0].src),
+            //   content: data.content,
+            //   title: data.title,
+            // });
+          }
+          // console.log('render', render);
+          // return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>`;
+          // return
+          return `<span class="tag-icon animate" style="display:none"></span>`;
+        },
+      })
+      .then(() => {
+        // const openTags = (tag) => {
+        // let item = tags.value.find((item) => item.sid == el.data.sid);
+        // guideclicktag(item);
+        // store.commit('tag/setTagClickType', {
+        //   type: 'goodlist',
+        //   data: item,
+        // });
+        // };
+        // view.on('rendered', (_) => {
+        //   view.on('click', async (e) => {
+        // var tag = e.data;
+        // 聚焦當前點擊的熱點
+        // debugger;
+        // await view.focus(tag.sid);
+        // });
+        // view.on('focus', (e) => {
+        //   if (!e.data.media['image'] || !e.data.media['image'].length) {
+        //     return;
+        //   }
+        //   document.querySelectorAll('[xui_tags_view] >div').forEach((el) => {
+        //     el.querySelector('.tag-body').classList.remove('show');
+        //     el.style.zIndex = 'auto';
+        //   });
+        //   e.target.style.zIndex = '999';
+        //   e.target.querySelector('.tag-body').classList.add('show');
+        // });
+        // }); //dom渲染完成
+      });
     app.render();
     // SDK初始化结束
     // 暂时isTours url frag 做为 1自由观看模式与带看模式0
@@ -136,18 +174,55 @@
       appStore.setFloorId(targetPano.id);
     });
     app.Scene.on('error', (data) => {
+      console.log('当前错误code', data.code);
       switch (data.code) {
         case 5033:
-          Dialog.alert('该场景正在计算中,请稍后再试');
+          // Dialog.alert('该场景正在计算中,请稍后再试');
+          rtcStore.showBaseDialog(
+            {
+              title: '温馨提示',
+              desc: '该场景正在计算中,请稍后再试',
+              okTxt: '确定',
+              closeTxt: '取消',
+            },
+            () => {},
+          );
           break;
         case 5034:
-          Dialog.alert('服务端开小差,请稍后再试');
+          // Dialog.alert('服务端开小差,请稍后再试');
+          rtcStore.showBaseDialog(
+            {
+              title: '温馨提示',
+              desc: '房间异常,请联系主持人',
+              okTxt: '确定',
+              closeTxt: '取消',
+            },
+            () => {},
+          );
           break;
         case 5009:
-          Dialog.alert('服务端开小差,请稍后再试');
+          // Dialog.alert('服务端开小差,请稍后再试');
+          rtcStore.showBaseDialog(
+            {
+              title: '温馨提示',
+              desc: '房间异常,请联系主持人',
+              okTxt: '确定',
+              closeTxt: '取消',
+            },
+            () => {},
+          );
           break;
         case 5005:
-          Dialog.alert('服务端开小差,请稍后再试');
+          // Dialog.alert('服务端开小差,请稍后再试');
+          rtcStore.showBaseDialog(
+            {
+              title: '温馨提示',
+              desc: '房间异常,请联系主持人',
+              okTxt: '确定',
+              closeTxt: '取消',
+            },
+            () => {},
+          );
           break;
       }
     });
@@ -174,7 +249,6 @@
     <div class="scene" ref="scene$"></div>
     <template v-if="dataLoaded">
       <!-- 小地图 start -->
-      {{ !!unref(refMiniMap) && player.showWidgets }}
       <MiniMap
         :show="!!unref(refMiniMap) && player.showWidgets"
         :show-dollhouse="Boolean(controls.showDollhouse)"

+ 10 - 7
src/components/basic/miniMap.vue

@@ -14,7 +14,7 @@
   </teleport>
 </template>
 <script lang="ts">
-  import { defineComponent, onMounted, watchEffect, ref } from 'vue';
+  import { defineComponent, onMounted, ref, watch } from 'vue';
   import { propTypes } from '/@/utils/propTypes';
   const refMiniMap = ref<Nullable<string>>(null);
   const ifShow = ref(false);
@@ -33,12 +33,15 @@
     emits: ['changeMode', 'toggleMap'],
     setup(props, { emit }) {
       onMounted(() => {
-        watchEffect(() => {
-          if (props.to?.length) {
-            ifShow.value = true;
-            refMiniMap.value = props.to;
-          }
-        });
+        watch(
+          () => [props.show, props.to],
+          () => {
+            if (props.to?.length && props.show) {
+              ifShow.value = true;
+              refMiniMap.value = props.to;
+            }
+          },
+        );
       });
 
       const toggleMap = () => {

+ 20 - 1
src/components/chatRoom/controls/actions.ts

@@ -70,7 +70,8 @@ export function handleActions({
       handleAskCurrentscene(data);
       break;
     case 'error':
-      Dialog.toast({ content: `房间未找到`, type: 'error' });
+      // Dialog.toast({ content: `房间未找到`, type: 'error' });
+      handleError();
     default:
       break;
   }
@@ -241,3 +242,21 @@ const handleLeaderDismiss = () => {
   Dialog.toast({ content: `主持人已解散房间` });
   closeSocket();
 };
+
+//
+
+const handleError = () => {
+  const rtcStore = useRtcStore();
+  rtcStore.showBaseDialog(
+    {
+      title: '温馨提示',
+      desc: '带看已结束',
+      okTxt: '确定',
+      closeTxt: '取消',
+    },
+    () => {
+      const { closeSocket } = useSocket();
+      closeSocket();
+    },
+  );
+}

+ 8 - 2
src/components/chatRoom/dialog/base.vue

@@ -6,7 +6,7 @@
         <div class="dialog_title">{{ title }}</div>
         <p class="dialog_desc">{{ desc }}</p>
         <div class="created_btn">
-          <div class="end_cancel" @click="endLiveCancel">{{ closeTxt }}</div>
+          <div class="end_cancel" @click="endLiveCancel" v-if="isSingle">{{ closeTxt }}</div>
           <div class="end_confirm" @click="endLiveConfirm">{{ okTxt }}</div>
         </div>
       </div>
@@ -36,7 +36,7 @@
   const desc = ref('');
   const okTxt = ref('');
   const closeTxt = ref('');
-
+  const isSingle = ref(false);
   watch(
     () => [baseDialog, ifBaseDialog],
     (val) => {
@@ -45,6 +45,7 @@
       desc.value = unref(val[0]).desc;
       okTxt.value = unref(val[0]).okTxt;
       closeTxt.value = unref(val[0]).closeTxt;
+      isSingle.value = unref(val[0]).isSingle;
     },
     { deep: true },
   );
@@ -57,6 +58,7 @@
       desc.value = props.desc;
       okTxt.value = props.okTxt;
       closeTxt.value = props.closeTxt;
+      isSingle.value = props.isSingle;
     },
     { deep: true },
   );
@@ -78,6 +80,10 @@
       type: String,
       default: '取消',
     },
+    isSingle: {
+      type: Boolean,
+      default: false,
+    },
   });
 
   const endLiveCancel = () => {

+ 1 - 1
src/components/chatRoom/index.vue

@@ -108,7 +108,7 @@
     @confirm-dialog="handleCloseRoom"
   />
   <CreatedName :show="showCreateNameDialog" @confirm-dialog="handleNameConfirm" />
-  <BaseDialog @confirm-dialog="handleFullRoom" />
+  <BaseDialog />
 </template>
 
 <script lang="ts" setup>

+ 38 - 0
src/components/custom/tag.vue

@@ -0,0 +1,38 @@
+<script setup lang="ts">
+  // import { computed } from 'vue';
+
+  defineProps({
+    sid: { type: String },
+    url: { type: String },
+    title: { type: String, default: '' },
+    content: { type: String, default: '' },
+    icon: { type: String, default: '' },
+  });
+
+  // const backgroundURL = computed(
+  //   () => props.url && props.url + '&x-oss-process=image/resize,m_fill,w_80,h_80',
+  // );
+</script>
+
+<template>
+  <span
+    class="tag-icon animate"
+    :style="{
+      backgroundImage: `url(${icon})`,
+    }"
+  ></span>
+  <!-- <div class="tag-body">
+    <div :data-id="sid" class="tag-commodity">
+      <div
+        :style="{
+          backgroundImage: `url(${backgroundURL})`,
+        }"
+        class="tag-avatar"
+      ></div>
+      <p class="tag-title">{{ title }}</p>
+      <div class="tag-info">
+        <div>{{ content.substring(0, 30) }}</div>
+      </div>
+    </div>
+  </div> -->
+</template>

+ 1 - 0
src/store/modules/rtc.ts

@@ -80,6 +80,7 @@ interface BaseDialog {
   desc: string;
   okTxt: string;
   closeTxt: string;
+  isSingle?: boolean;
 }
 const defaultBaseDialog: BaseDialog = {
   title: '温馨提示',