Sfoglia il codice sorgente

修改带看传值

tangning 3 anni fa
parent
commit
733085167a
3 ha cambiato i file con 31 aggiunte e 15 eliminazioni
  1. 1 1
      .env
  2. 17 9
      src/view/scene/Initiator.vue
  3. 13 5
      src/view/scene/visitor.vue

+ 1 - 1
.env

@@ -1,3 +1,3 @@
 VUE_APP_PREFIX=
-VUE_APP_DOMAIN=https://www.4dkankan.com
+VUE_APP_DOMAIN=https://test.4dkankan.com
 

+ 17 - 9
src/view/scene/Initiator.vue

@@ -1,6 +1,7 @@
 <template>
-  <div class="scene-layer">
-    <iframe ref="lookLive" allow="geolocation; microphone; camera; midi; encrypted-media;" :src="url" ></iframe>
+  <div class="scene-layer" id="iframediv">
+    <!-- getUrlname() -->
+    <!-- <iframe ref="lookLive" allow="geolocation; microphone; camera; midi; encrypted-media;" :src="url" ></iframe> -->
   </div>
 
   <com-dialog title="访问密码" enterText="确 定" v-model:show="confirm.show" @submit="loadData()" width="480" :showClose="false">
@@ -48,13 +49,10 @@ export default {
         return process.env.VUE_APP_DOMAIN + '/fire-rtc-live.html' + ssurl.substr(ssurl.indexOf('?') || 0)
       }
       if (sceneNum && id) {
-        // return process.env.VUE_APP_DOMAIN + '/fire-rtc-live.html?m=' + m +'&p_id='+p_id
         return process.env.VUE_APP_DOMAIN + '/fire-rtc-live.html?m=' + sceneNum +'&app=fire-control&p_id='+id+'&vlog#/'
-        // return 'https://test.4dkankan.com/fire-rtc-live.html?m=t-3fp7zQl&p_id=PROJECT01456470052986503168#/?mode=2&name=test&role=leader&roomId=9c4Q2rbL9ZP0Pxf1ReXLekBN&userId=9RYJ5jgQYvnP'
       } else {
           console.log('url获取=>',this.$route)
         return 'javascript:void(0)'
-        // return process.env.VUE_APP_DOMAIN + '/spc.html?m=' + this.detail.sceneNum
       }
     },
     tableData() {
@@ -76,6 +74,9 @@ export default {
     },
   },
   methods: {
+    getUrlname(){
+      return window.location.origin + window.location.pathname
+    },
     async loadData() {
       // if (!this.confirm.psw || this.confirm.psw.length === 0) return this.$message.error('请输入访问密码', '提示')
       let {data: detail} = await axios.get(fireDetailByPsw, {params: {projectId: this.$route.params.projectId, randCode: this.confirm.psw,type:1}})
@@ -107,12 +108,19 @@ export default {
     }
   },
   mounted() {
-    // this.loadData()
     window.addEventListener('message',this.handleMessage)
-    let iframdata = this.$refs.lookLive
-    if(iframdata){
-        iframdata.allow = 'geolocation; microphone; camera; midi; encrypted-media;'
+    var iframe = document.createElement('iframe'); 
+    iframe.src=this.url;  
+    iframe.width='100%';  
+    iframe.height='100%';  
+    iframe.name = this.getUrlname()
+    if(iframe){
+        iframe.allow = 'geolocation; microphone; camera; midi; encrypted-media;'
     }
+    document.getElementById('iframediv').appendChild(iframe);
+  },
+  created(){
+
   },
   beforeDestroyed(){
     window.removeEventListener("message", this.handleMessage);

+ 13 - 5
src/view/scene/visitor.vue

@@ -1,6 +1,6 @@
 <template>
-  <div class="scene-layer">
-    <iframe ref="lookLive" allow="geolocation; microphone; camera; midi; encrypted-media;" :src="url" ></iframe>
+  <div class="scene-layer" id="iframediv">
+    <!-- <iframe ref="lookLive" :name="getUrlname()" allow="geolocation; microphone; camera; midi; encrypted-media;" :src="url" ></iframe> -->
   </div>
 
   <com-dialog title="访问密码" enterText="确 定" v-model:show="confirm.show" @submit="loadData()" width="480" :showClose="false">
@@ -77,6 +77,9 @@ export default {
     },
   },
   methods: {
+    getUrlname(){
+      return window.location.origin + window.location.pathname
+    },
     async loadData() {
       // if (!this.confirm.psw || this.confirm.psw.length === 0) return this.$message.error('请输入访问密码', '提示')
     //   let {data: detail} = await axios.get(fireDetailByPsw, {params: {projectId: this.$route.params.projectId, randCode: this.confirm.psw,type:1}})
@@ -124,10 +127,15 @@ export default {
   mounted() {
     this.loadData()
     window.addEventListener('message',this.handleMessage)    
-    let iframdata = this.$refs.lookLive
-    if(iframdata){
-        iframdata.allow = 'geolocation; microphone; camera; midi; encrypted-media;'
+    var iframe = document.createElement('iframe'); 
+    iframe.src=this.url;  
+    iframe.width='100%';  
+    iframe.height='100%';  
+    iframe.name = this.getUrlname()
+    if(iframe){
+        iframe.allow = 'geolocation; microphone; camera; midi; encrypted-media;'
     }
+    document.getElementById('iframediv').appendChild(iframe);
   },
   beforeDestroyed(){
     window.removeEventListener("message", this.handleMessage);