<template>
  <div>
    <iframe id="template-iframe" ref="iframe" style="width: 100%;height: 600px;" :src="'../../../static/Video/index.html'" />
    <button class="btn btn-success" type="button" style="width:100%" @click="imageUpload">
      {{ $t('lang.webRtcImage.uploadImage') }}
    </button>
  </div>
</template>

<script>

import Common from '../common/Common.js';

import ImageService from '../resource/file/ImageService.js';
import FileService from '../resource/file/FileService.js';
import { Notify, Uuid } from 'pc-component-v3';


export default {

  components: {
  },

  
  props: {
    /**
		 * 可以抓拍多张图片
		 */
    multiple: {
      type: Boolean,
      default: null,
    },
  },

  data: function () {
    return {
      imgBase64:[],
    };
  },
  computed: {
    src () {
      return 'https://alert.ainnovation.com/alerts_confirm';
    },
  },
  mounted: function () {
  },
  methods: {
    /**
		 * 上传图片
		 */
    imageUpload: function () {
      var _self = this;
      const iframe = document.getElementById('template-iframe');
      var imageSrcs = iframe.contentWindow.getImageList();
      console.log('图片：' + imageSrcs);
      if (imageSrcs && imageSrcs.length == 0) {
        Notify.error('提示', '没有图片',false);
        return;
      }

      if(_self.multiple == true){
        _self.$emit('uploadImage', imageSrcs);
      }else{
        var imageSrc = imageSrcs[0];
        _self.$emit('uploadImage', imageSrc);
      }
    },
  },
};

</script>

<style scoped>

</style>