Newer
Older
HuangJiPC / src / pages / views / operationMonitor / videoMonitor.vue
@zhangdeliang zhangdeliang on 21 Jun 1 KB update
<template>
  <div class="videoMonitor">
    <n-button type="primary" class="downloadHK" @click="downloadHK">海康视频插件下载</n-button>

    <n-tabs default-value="real" size="large">
      <n-tab-pane name="real" tab="实时监控">
        <VideoNow />
      </n-tab-pane>
      <n-tab-pane name="history" tab="历史监控">
        <VideoHistory />
      </n-tab-pane>
      <n-tab-pane name="snap" tab="抓拍图片">
        <VideoSnap />
      </n-tab-pane>
    </n-tabs>
  </div>
</template>

<script>
import VideoNow from './components/VideoNow2.vue';
import VideoHistory from './components/VideoHistory.vue';
import VideoSnap from './components/VideoSnap.vue';
import { ref, nextTick, reactive, toRefs, onMounted } from 'vue';
import { downloadBlob } from '@/utils/util';

import axios from 'axios';

export default {
  name: 'videoMonitor',
  components: {
    VideoNow,
    VideoHistory,
    VideoSnap,
  },
  setup() {
    const allData = reactive({
      videoURL: '',
    });
    // 获取视频插件下载地址
    function downloadHK() {
      const token = localStorage.getItem('tokenXF');
      $loadingBar.start();
      axios
        .get('/api/hkview/download', {
          headers: {
            token: token,
          },
          responseType: 'blob',
          params: {},
        })
        .then(function (res) {
          downloadBlob(res.data, decodeURIComponent(res.headers['content-disposition'].split('filename=')[1]));
        });
      $loadingBar.finish();
    }
    onMounted(() => {});
    return {
      ...toRefs(allData),
      downloadHK,
    };
  },
};
</script>

<style lang="less" scoped>
.videoMonitor {
  height: 100%;
  margin: 15px;
  overflow: hidden;
  position: relative;
  .downloadHK {
    position: absolute;
    right: 30px;
    top: 10px;
    color: #fff;
    z-index: 99;
  }
}
</style>