<template>
  <div>
  <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="资源上传" name="videoDialog">
        <video-dialog ref="videoDialog"></video-dialog>
      </el-tab-pane>

      <el-tab-pane label="资源库" name="videoResources">
        <video-resources ref="videoResources" :resource-picker-props="resourcePickerProps"></video-resources>
      </el-tab-pane>

    </el-tabs>
  </div>
</template>

<script>
import VideoDialog from './videoDialog.vue'
import VideoResources from './videoResources.vue'

export default {
  components: {
    'video-dialog': VideoDialog,
    'video-resources': VideoResources
  },
  data() {
    return {
      activeName: 'specialResource',
      resourcePickerProps: {
        resourceType: 'video',
        dataType: 'SpecialVideo',
        selectorURL: 'videoResources',
        inputType: 'Radio',
        catalogID: this.$route.params.catalogID,
        specialID: this.$route.params.specialID
      }
    }
  },
  mounted () {
    window.forDialogOnOk = this.$refs['videoDialog'].forDialogOnOk
  },
  methods: {
    handleClick(tab, evt) {
      window.forDialogOnOk = this.$refs[tab.name].forDialogOnOk
    }
  }
}
</script>
