62448482 by zhen

update:更新iframe配置

1 parent da102b08
......@@ -19,14 +19,14 @@
<el-button type="primary" @click="open">呼叫</el-button>
<el-button type="primary" @click="cancelCall">取消呼叫</el-button>
</p>
<iframe
<!-- <iframe
v-if="isStart"
ref="srtcIframe"
title="srtcIframe"
:src="target"
frameborder="2"
allow="microphone;camera;midi;encrypted-media;fullscreen;"
></iframe>
></iframe> -->
</div>
</template>
......@@ -34,17 +34,18 @@
export default {
data() {
return {
baseUrl: 'https://pre-web-chery.situdata.com',
// baseUrl: 'https://pre-web-chery.situdata.com',
baseUrl: 'https://localhost:8081',
isStart: false,
target: '',
strWindowFeatures: `
left=2400,
top=200
left=2800,
top=200,
height=500,
width=700,
menubar=1,
toolbar=1,
fullscreen=1
status=1
`,
orderInfo: {
appUserName: '刘臻',
......@@ -61,15 +62,15 @@ export default {
open() {
this.isStart = true
this.target = `${this.baseUrl}/#/srtc-iframe?path="https://localhost:8080"`
this.$nextTick().then(() => {
this.$refs.srtcIframe.onload = () => {
this.sendMessage()
}
})
this.srtcIframe = window.open(this.target, 'srtc', this.strWindowFeatures)
this.srtcIframe.focus()
setTimeout(() => {
this.sendMessage()
}, 2000)
},
sendMessage() {
const { appUserName, appUserPhone, orderId, webUserName } = this.orderInfo
this.$refs.srtcIframe.contentWindow.postMessage(
this.srtcIframe.postMessage(
{
type: 'startCall',
data: {
......@@ -83,12 +84,13 @@ export default {
)
},
cancelCall() {
this.$refs.srtcIframe.contentWindow.postMessage(
this.srtcIframe.postMessage(
{
type: 'cancelCall'
},
this.baseUrl
)
this.srtcIframe.close()
},
receiveMessage(e) {
if (e.origin !== this.baseUrl) {
......@@ -100,11 +102,14 @@ export default {
switch (type) {
case 'appHangUp':
this.isStart = false
this.srtcIframe.close()
break
case 'cancelCallCB':
this.srtcIframe.close()
this.isStart = false
break
case 'webHangUp':
this.srtcIframe.close()
this.isStart = false
break
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!