Newer
Older
securityFront / src / views / video / monitor.vue
wangxitong on 20 Feb 2021 2 KB bug修改
<template>
  <div>
    <el-row>
      <el-col :span="6">
        <video-tree @click="handleCameraClicked"/>
      </el-col>
      <el-col :span="18">
        <div id="tabDiv">
          <!--<el-tabs v-model="activeName" type="border-card" @tab-click.once ="handleClick">-->
            <!--<el-tab-pane label="海康" name="hk">-->
              <!--<iframe v-if="activeName === 'hk'" name="playHK" class="iframe-body" src="/static/webCtrl/hk/demo_embedded_for_iframe.html"/>-->

              <iframe name="playHK" class="iframe-body" src="/static/webCtrl/hk/demo_embedded_for_iframe.html"/>

            <!--</el-tab-pane>-->
            <!--<el-tab-pane label="NVR" name="nvr">-->
              <!--<iframe v-if="activeName==='nvr'" name="playNVR" class="iframe-body" src="/static/webCtrl/nvr/demo-easy.html"/>-->
            <!--</el-tab-pane>-->
          <!--</el-tabs>-->
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import VideoTree from './videoTree'

export default {
  name: 'VideoMonitor',
  components: { VideoTree },
  data() {
    return {
      activeName: 'hk',
      tabHeight: '',
      tabWidth: ''
    }
  },
  mounted() {
    // console.log(document.getElementById("tabDiv").getBoundingClientRect().left)
    setTimeout(() => {
      window.frames['playHK'].initPlugin('real',document.getElementById("tabDiv").getBoundingClientRect().left)
    }, 1000)
  },
  methods: {
    handleClick(tab, event) {
      if (tab.name === 'hk') {
        this.activeName = 'hk'
        window.frames['playHK'].initPlugin('real',document.getElementById("tabDiv").getBoundingClientRect().left)
      } else if (tab.name === 'nvr') {
        this.activeName = 'nvr'
        window.frames['playNVR'].stopPlayReal(null)
      }
    },
    handleCameraClicked(camera) {
      console.log(camera)
      if (typeof camera.monitorPoint === 'undefined' || camera.monitorPoint === '') {
        console.log('monitorPoint is null')
        return false
      } else {
        if (this.activeName === 'hk') {
          window.frames['playHK'].play(camera.monitorPoint)
        } else if (this.activeName === 'nvr') {
          window.frames['playNVR'].startPlayReal()
        }
      }
    }
  }
}
</script>

<style scoped>
  .iframe-body{
    height: calc(100vh - 250px);
    width: 100%;
    /*frameBorder: 0;*/
    scrolling: no;
    border: 1px;
    vspale: 0;
  }
</style>