<template>
  <ModuleBase :type="data.type">
    <template #content>
      <UploadFile
        :courseware-id="courseware_id"
        :component-id="id"
        :type="data.type"
        :single-size="data.single_size"
        :total-size="data.total_size"
        :file-list="data.file_list"
        :file-id-list="data.file_id_list"
        :file-info-list="data.file_info_list"
        :label-text="labelText"
        :accept-file-type="acceptFileType"
        :upload-tip="uploadTip"
        :icon-class="iconClass"
        @updateFileList="updateFileList"
      />
    </template>
  </ModuleBase>
</template>

<script>
import { getVideoData } from '@/views/book/courseware/data/video';
import ModuleMixin from '../../common/ModuleMixin';
import UploadFile from '../common/UploadFile.vue';

export default {
  name: 'VideoPage',
  components: { UploadFile },
  mixins: [ModuleMixin],
  data() {
    return {
      data: getVideoData(),
      labelText: '视频',
      acceptFileType: '.mp4',
      uploadTip: '支持上传mp4格式视频文件，单个视频文件最大2GB，总文件体积不超10GB。',
      iconClass: 'video',
    };
  },
  methods: {
    updateFileList({ file_list, file_id_list, file_info_list }) {
      this.data.file_list = file_list;
      this.data.file_id_list = file_id_list;
      this.data.file_info_list = file_info_list;
    },
  },
};
</script>

<style lang="scss" scoped></style>
