|
@@ -171,6 +171,33 @@
|
|
{{item}}
|
|
{{item}}
|
|
</p>
|
|
</p>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item
|
|
|
|
+ v-if="form.type!='video'"
|
|
|
|
+ label="音频解说:"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-upload
|
|
|
|
+ class="upload-demo"
|
|
|
|
+ :action="uploadUrl+'audio'"
|
|
|
|
+ :headers="{ token }"
|
|
|
|
+ :on-error="handleError"
|
|
|
|
+ :on-success="handleAudioSuccess"
|
|
|
|
+ :before-upload="beforeAudioUpload"
|
|
|
|
+ :show-file-list="false"
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="primary">点击上传</el-button>
|
|
|
|
+ </el-upload>
|
|
|
|
+ <template v-if="form.audioPath">
|
|
|
|
+ <div>音频名称:{{form.audioName}} <el-button size="small" style="margin-left:20px;" @click="form.audioName='',form.audioPath=''" type='text'>删除</el-button></div>
|
|
|
|
+ <audio style="margin-top:10px;" v-if="form.audioPath" :src="form.audioPath" controls></audio>
|
|
|
|
+ </template>
|
|
|
|
+ <p style="color:#999;line-height:1;margin-top:20px">格式要求:</p>
|
|
|
|
+ <p style="color:#999;" >
|
|
|
|
+ 1、支持mp3,wav,wma格式 <br/>
|
|
|
|
+ 2、最大为50M大小。
|
|
|
|
+ </p>
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<div class="add-right">
|
|
<div class="add-right">
|
|
@@ -305,6 +332,8 @@ export default {
|
|
thumb: "",
|
|
thumb: "",
|
|
type: 'model',
|
|
type: 'model',
|
|
filePath:'',
|
|
filePath:'',
|
|
|
|
+ audioPath:'',
|
|
|
|
+ audioName:'',
|
|
zoneId: "",
|
|
zoneId: "",
|
|
fileName:'',
|
|
fileName:'',
|
|
description:''
|
|
description:''
|
|
@@ -339,6 +368,8 @@ export default {
|
|
this.changeType = false
|
|
this.changeType = false
|
|
this.form.filePath = ''
|
|
this.form.filePath = ''
|
|
this.form.fileName = ''
|
|
this.form.fileName = ''
|
|
|
|
+ this.form.audioPath = ''
|
|
|
|
+ this.form.audioName = ''
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
this.changeType = true
|
|
this.changeType = true
|
|
});
|
|
});
|
|
@@ -401,7 +432,7 @@ export default {
|
|
this.form.fileName = data.fileName;
|
|
this.form.fileName = data.fileName;
|
|
},
|
|
},
|
|
beforefileUpload(file){
|
|
beforefileUpload(file){
|
|
- let typeArr = this.form.type === 'img' ? ['.png','jpeg','gif','jpg'] : (this.form.type === 'video'? ['avi','mov','rmvb','rm','flv','mp4','3gp']:['4dage'])
|
|
|
|
|
|
+ let typeArr = this.form.type === 'img' ? ['png','jpeg','gif','jpg'] : (this.form.type === 'video'? ['avi','mov','rmvb','rm','flv','mp4','3gp']:['4dage'])
|
|
let type = this.isTypeBySend(file.name,typeArr);
|
|
let type = this.isTypeBySend(file.name,typeArr);
|
|
if (!type) {
|
|
if (!type) {
|
|
this.$message.error('只允许指定文件格式的文件');
|
|
this.$message.error('只允许指定文件格式的文件');
|
|
@@ -417,6 +448,34 @@ export default {
|
|
}
|
|
}
|
|
this.loading = this.$loading(this.loadOption)
|
|
this.loading = this.$loading(this.loadOption)
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ handleAudioSuccess(res){
|
|
|
|
+ this.loading.close()
|
|
|
|
+ let { data } = res;
|
|
|
|
+ this.form.audioPath = data.filePath;
|
|
|
|
+ this.form.audioName = data.fileName;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ beforeAudioUpload(file) {
|
|
|
|
+ let typeArr = ['mp3','wav','wma']
|
|
|
|
+ let type = this.isTypeBySend(file.name,typeArr);
|
|
|
|
+ if (!type) {
|
|
|
|
+ this.$message.error('只允许mp3,wav,wma等格式的音频文件');
|
|
|
|
+ return type
|
|
|
|
+ }
|
|
|
|
+ if (!type) {
|
|
|
|
+ this.$message.error('只允许mp3,wav,wma等格式的音频文件');
|
|
|
|
+ return type
|
|
|
|
+ }
|
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 50;
|
|
|
|
+
|
|
|
|
+ if (!isLt2M) {
|
|
|
|
+ this.$message.error("上传头像图片大小不能超过 50MB!");
|
|
|
|
+ return isLt2M;
|
|
|
|
+ }
|
|
|
|
+ this.loading = this.$loading(this.loadOption)
|
|
|
|
+ },
|
|
|
|
+
|
|
beforeAvatarUpload(file) {
|
|
beforeAvatarUpload(file) {
|
|
let type = this.isImage(file.name);
|
|
let type = this.isImage(file.name);
|
|
if (!type) {
|
|
if (!type) {
|
|
@@ -471,6 +530,8 @@ export default {
|
|
type: 'model',
|
|
type: 'model',
|
|
filePath:'',
|
|
filePath:'',
|
|
zoneId: "",
|
|
zoneId: "",
|
|
|
|
+ audioPath:'',
|
|
|
|
+ audioName:'',
|
|
fileName:'',
|
|
fileName:'',
|
|
description:''
|
|
description:''
|
|
};
|
|
};
|
|
@@ -525,6 +586,8 @@ export default {
|
|
type,
|
|
type,
|
|
filePath,
|
|
filePath,
|
|
fileName,
|
|
fileName,
|
|
|
|
+ audioPath,
|
|
|
|
+ audioName,
|
|
description,
|
|
description,
|
|
zoneId
|
|
zoneId
|
|
} = this.form;
|
|
} = this.form;
|
|
@@ -540,6 +603,8 @@ export default {
|
|
id,
|
|
id,
|
|
filePath,
|
|
filePath,
|
|
fileName,
|
|
fileName,
|
|
|
|
+ audioPath,
|
|
|
|
+ audioName,
|
|
description,
|
|
description,
|
|
name,
|
|
name,
|
|
zoneId,
|
|
zoneId,
|