Audio.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <ModuleBase :type="data.type">
  3. <template #content>
  4. <UploadFile
  5. :id="id"
  6. ref="audioUploadFile"
  7. :module-data="data"
  8. :label-text="labelText"
  9. :accept-file-type="acceptFileType"
  10. :upload-tip="uploadTip"
  11. :icon-class="iconClass"
  12. @saveDate="saveDate"
  13. />
  14. <!-- <ul>
  15. <li v-for="(file, i) in file_list" :key="i">
  16. <audio
  17. :id="file.file_id"
  18. :src="file.file_url"
  19. controls
  20. @error=""
  21. @play=""
  22. @pause=""
  23. @timeupdate=""
  24. @ended=""
  25. ></audio>
  26. </li>
  27. </ul> -->
  28. </template>
  29. </ModuleBase>
  30. </template>
  31. <script>
  32. import { getAudioData } from '@/views/book/courseware/data/audio';
  33. import { GetCoursewareComponentContent_View } from '@/api/book';
  34. import ModuleMixin from '../../common/ModuleMixin';
  35. import UploadFile from '../common/UploadFile.vue';
  36. export default {
  37. name: 'AudioPage',
  38. components: { UploadFile },
  39. mixins: [ModuleMixin],
  40. data() {
  41. return {
  42. data: getAudioData(),
  43. componentId: this.id,
  44. coursewareId: this.courseware_id,
  45. file_list: [
  46. {
  47. file_id: '1',
  48. file_url:
  49. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  50. },
  51. {
  52. file_id: '2',
  53. file_url:
  54. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  55. },
  56. {
  57. file_id: '3',
  58. file_url:
  59. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  60. },
  61. {
  62. file_id: '4',
  63. file_url:
  64. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  65. },
  66. {
  67. file_id: '5',
  68. file_url:
  69. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  70. },
  71. {
  72. file_id: '6',
  73. file_url:
  74. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  75. },
  76. {
  77. file_id: '7',
  78. file_url:
  79. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  80. },
  81. {
  82. file_id: '8',
  83. file_url:
  84. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  85. },
  86. {
  87. file_id: '9',
  88. file_url:
  89. 'https://file-kf.helxsoft.cn/CSFileServer/URL/002/69F3878866F2A1B7DF04C4EFE9ACD04120240402145413PKA8LLFPXRT1BKURSBNIFXGK8EV5VCBIVL9WGCFB_00201-20240402-14-UAG696HY.mp3',
  90. },
  91. ],
  92. labelText: '音频',
  93. acceptFileType: '.mp3,.acc,.wma',
  94. uploadTip: '支持上传mp3、acc、wma,等格式音频文件,单个文件最大100MB,总文件体积不超1G。',
  95. iconClass: 'note',
  96. };
  97. },
  98. created() {
  99. this.getCoursewareComponentContent_View();
  100. },
  101. methods: {
  102. saveDate(file) {
  103. this.data.id = this.componentId;
  104. this.data.file_list.push(file);
  105. this.data.file_id_list.push(file.file_id);
  106. },
  107. getCoursewareComponentContent_View() {
  108. GetCoursewareComponentContent_View({ courseware_id: this.coursewareId, component_id: this.componentId }).then(
  109. ({ content }) => {
  110. if (content) this.data = JSON.parse(content);
  111. },
  112. );
  113. },
  114. },
  115. };
  116. </script>
  117. <style lang="scss" scoped></style>