<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 { getPictureData } from '@/views/book/courseware/data/picture';
import ModuleMixin from '../../common/ModuleMixin';
import UploadFile from '../common/UploadFile.vue';

export default {
  name: 'PicturePage',
  components: { UploadFile },
  mixins: [ModuleMixin],
  data() {
    return {
      data: getPictureData(),
      labelText: '图片',
      acceptFileType: '.jpg,.png,.jpeg',
      uploadTip: '支持上传jpg、png、jpeg，等格式图片文件，单个文件最大1MB，总文件体积不超100MB。',
      iconClass: 'picture',
    };
  },
  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>
