<template>
  <ModuleBase :type="data.type">
    <template #content>
      <UploadFile
        :courseware-id="courseware_id"
        :component-id="id"
        :module-data="data"
        :label-text="labelText"
        :accept-file-type="acceptFileType"
        :upload-tip="uploadTip"
        :icon-class="iconClass"
        @saveDate="saveDate"
      />
    </template>
  </ModuleBase>
</template>

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

export default {
  name: 'AudioPage',
  components: { UploadFile },
  mixins: [ModuleMixin],
  data() {
    return {
      data: getAudioData(),
      labelText: '音频',
      acceptFileType: '.mp3,.acc,.wma',
      uploadTip: '支持上传mp3、acc、wma，等格式音频文件，单个文件最大100MB，总文件体积不超1G。',
      iconClass: 'note',
    };
  },
  methods: {
    saveDate(file) {
      this.data.id = this.id;
      this.data.file_list.push(file);
      this.data.file_id_list.push(file.file_id);
    },
  },
};
</script>

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