|
|
@@ -14,7 +14,7 @@
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>更新音频稿件信息</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateVideoInfo">更新</el-button>
|
|
|
+ <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateAudioPost">更新</el-button>
|
|
|
</div>
|
|
|
<div class="text item">
|
|
|
<el-form ref="form" :model="form" label-width="80px">
|
|
|
@@ -28,32 +28,6 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
- <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>更新音频文件</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateVideoFile">更新</el-button>
|
|
|
- </div>
|
|
|
- <div class="text item">
|
|
|
- <uploader
|
|
|
- class="uploader-example"
|
|
|
- :options="options"
|
|
|
- :auto-start="true"
|
|
|
- @file-added="onFileAdded"
|
|
|
- @file-success="onFileSuccess"
|
|
|
- @file-progress="onFileProgress"
|
|
|
- @file-error="onFileError"
|
|
|
- >
|
|
|
- <uploader-unsupport />
|
|
|
- <uploader-drop>
|
|
|
- <p>拖动音频文件到此处或</p>
|
|
|
- <uploader-btn :attrs="attrs">选择音频文件</uploader-btn>
|
|
|
- </uploader-drop>
|
|
|
- <uploader-list />
|
|
|
- </uploader>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
</el-row>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
@@ -65,159 +39,36 @@ export default {
|
|
|
name: 'EditAudio',
|
|
|
data() {
|
|
|
return {
|
|
|
- /***********************************************************************/
|
|
|
- options: {
|
|
|
- target: '//oss.reghao.cn/',
|
|
|
- chunkSize: 1024 * 1024 * 1024, // 1GiB
|
|
|
- fileParameterName: 'file',
|
|
|
- testChunks: false,
|
|
|
- query: (file, chunk) => {
|
|
|
- return {
|
|
|
- channelId: 2
|
|
|
- }
|
|
|
- },
|
|
|
- headers: {
|
|
|
- Authorization: '1234567890'
|
|
|
- }
|
|
|
- },
|
|
|
- attrs: {
|
|
|
- accept: 'audio/*'
|
|
|
- },
|
|
|
- imgHeaders: {
|
|
|
- Authorization: '1234567890'
|
|
|
- },
|
|
|
- imgData: {
|
|
|
- channelId: 3
|
|
|
- },
|
|
|
- /***********************************************************************/
|
|
|
- coverUrl: null,
|
|
|
- coverFile: null,
|
|
|
- imageList: [],
|
|
|
- imageUrl: '',
|
|
|
- // 提交给后端的数据
|
|
|
- tagsStr: null,
|
|
|
form: {
|
|
|
- videoFileId: null,
|
|
|
- coverUrl: null,
|
|
|
title: null,
|
|
|
description: null,
|
|
|
- categoryId: 0,
|
|
|
- tags: [],
|
|
|
- scope: null,
|
|
|
- width: 0,
|
|
|
- height: 0,
|
|
|
- duration: 0
|
|
|
},
|
|
|
- videoInfo: null
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- document.title = '编辑音频'
|
|
|
+ document.title = '编辑音频稿件'
|
|
|
|
|
|
const audioId = this.$route.params.audioId
|
|
|
getAudioPost(audioId).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
const audioInfo = res.data
|
|
|
- this.imageUrl = audioInfo.coverUrl
|
|
|
this.form.title = audioInfo.title
|
|
|
this.form.description = audioInfo.description
|
|
|
- this.form.scope = audioInfo.scope
|
|
|
} else {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- /***********************************************************************/
|
|
|
- onFileAdded(file) {
|
|
|
- if (file.file.size > 1024*1024*1024) {
|
|
|
- file.cancel()
|
|
|
- this.$notify(
|
|
|
- {
|
|
|
- title: '提示',
|
|
|
- message: '音频文件应小于 1GiB',
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
- }
|
|
|
- )
|
|
|
- return
|
|
|
- }
|
|
|
- this.setTitle(file.file.name)
|
|
|
- this.processVideo(file.file)
|
|
|
- },
|
|
|
- onFileProgress(rootFile, file, chunk) {
|
|
|
- },
|
|
|
- onFileSuccess(rootFile, file, response, chunk) {
|
|
|
- const res = JSON.parse(response)
|
|
|
- if (res.code === 0) {
|
|
|
- const resData = res.data
|
|
|
- this.form.audioFileId = resData.uploadId
|
|
|
-
|
|
|
- this.$notify(
|
|
|
- {
|
|
|
- title: '提示',
|
|
|
- message: '音频已上传',
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
- },
|
|
|
- onFileError(rootFile, file, response, chunk) {
|
|
|
- this.$notify(
|
|
|
- {
|
|
|
- title: '提示',
|
|
|
- message: '文件上传错误',
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
- }
|
|
|
- )
|
|
|
- },
|
|
|
- /***********************************************************************/
|
|
|
- beforeAvatarUpload(file) {
|
|
|
- const isJPG = file.type === 'image/jpeg'
|
|
|
- const isLt2M = file.size / 1024 / 1024 < 2
|
|
|
- if (!isJPG) {
|
|
|
- this.$message.error('上传头像图片只能是 JPG 格式!')
|
|
|
- }
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error('上传头像图片大小不能超过 2MB!')
|
|
|
- }
|
|
|
- return isJPG && isLt2M
|
|
|
- },
|
|
|
- handleAvatarSuccess(res, file) {
|
|
|
- this.imageList.push(file)
|
|
|
- this.imageUrl = URL.createObjectURL(file.raw)
|
|
|
- if (res.code === 0) {
|
|
|
- const resData = res.data
|
|
|
- const uploadId = resData.uploadId
|
|
|
- const url = resData.url
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
- setTitle(title) {
|
|
|
- if (title.length > 50) {
|
|
|
- this.form.title = title.substring(0, 50)
|
|
|
- this.form.description = title
|
|
|
- } else {
|
|
|
- this.form.title = title
|
|
|
- }
|
|
|
- },
|
|
|
onReturnAudio() {
|
|
|
this.$router.push('/post/audio')
|
|
|
},
|
|
|
- onUpdateVideoFile() {
|
|
|
- console.log('更新音频文件')
|
|
|
- },
|
|
|
- onUpdateVideoCover() {
|
|
|
- console.log('更新音频封面')
|
|
|
+ onUpdateAudioPost() {
|
|
|
+ this.$notify({
|
|
|
+ message: '接口待实现',
|
|
|
+ type: 'info',
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
},
|
|
|
- onUpdateVideoInfo() {
|
|
|
- console.log('更新音频信息')
|
|
|
- },
|
|
|
- onUpdateVideoScope() {
|
|
|
- console.log('更新音频作用域')
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -230,10 +81,6 @@ export default {
|
|
|
padding-left: 0.5%;
|
|
|
padding-right: 0.5%;
|
|
|
}
|
|
|
-
|
|
|
- .coverImg {
|
|
|
- height: 120px !important;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
.movie-list {
|
|
|
@@ -241,45 +88,4 @@ export default {
|
|
|
padding-left: 6%;
|
|
|
padding-right: 6%;
|
|
|
}
|
|
|
-
|
|
|
-.uploader-example {
|
|
|
- width: 500px;
|
|
|
- padding: 15px;
|
|
|
- margin: 40px auto 0;
|
|
|
- font-size: 12px;
|
|
|
- box-shadow: 0 0 10px rgba(0, 0, 0, .4);
|
|
|
-}
|
|
|
-.uploader-example .uploader-btn {
|
|
|
- margin-right: 4px;
|
|
|
-}
|
|
|
-.uploader-example .uploader-list {
|
|
|
- max-height: 440px;
|
|
|
- overflow: auto;
|
|
|
- overflow-x: hidden;
|
|
|
- overflow-y: auto;
|
|
|
-}
|
|
|
-
|
|
|
-.avatar-uploader .el-upload {
|
|
|
- border: 1px dashed #d9d9d9;
|
|
|
- border-radius: 6px;
|
|
|
- cursor: pointer;
|
|
|
- position: relative;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-.avatar-uploader .el-upload:hover {
|
|
|
- border-color: #409EFF;
|
|
|
-}
|
|
|
-.avatar-uploader-icon {
|
|
|
- font-size: 28px;
|
|
|
- color: #8c939d;
|
|
|
- width: 320px;
|
|
|
- height: 240px;
|
|
|
- line-height: 178px;
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-.avatar {
|
|
|
- width: 320px;
|
|
|
- height: 240px;
|
|
|
- display: block;
|
|
|
-}
|
|
|
</style>
|