|
@@ -0,0 +1,46 @@
|
|
|
|
+<template>
|
|
|
|
+ <el-upload action="#" :show-file-list="false" multiple :auto-upload="false" :on-change="onChange">
|
|
|
|
+ <el-button type="primary" slot="trigger">批量选择音频</el-button>
|
|
|
|
+ <el-button :disabled="disabled" @click="getUpload">上传</el-button>
|
|
|
|
+ </el-upload>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { upload } from '@/api/music/list'
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ data: new FormData(),
|
|
|
|
+ fileList: [],
|
|
|
|
+ // 是否选完文件
|
|
|
|
+ disabled: true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 选择文件
|
|
|
|
+ onChange(file) {
|
|
|
|
+ this.data.append('multipartFiles', file.raw)
|
|
|
|
+ this.disabled = false
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 上传
|
|
|
|
+ getUpload() {
|
|
|
|
+ this.$emit('loading')
|
|
|
|
+ upload(this.data).then(res => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.$message.success('上传成功!')
|
|
|
|
+ this.disabled = true
|
|
|
|
+ this.data = []
|
|
|
|
+ this.$emit('upload')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+::v-deep .el-upload {
|
|
|
|
+ margin: 0 10px;
|
|
|
|
+}
|
|
|
|
+</style>
|