|
@@ -7,7 +7,6 @@
|
|
|
class="upload-demo"
|
|
|
:action="url"
|
|
|
:on-preview="handlePreview"
|
|
|
- multiple
|
|
|
:limit="filleNumber ? filleNumber : 1"
|
|
|
:before-upload="handlebeforeUpload"
|
|
|
:on-exceed="handleExceed"
|
|
@@ -17,6 +16,7 @@
|
|
|
:before-remove="beforeRemove"
|
|
|
:on-remove="handleRemove"
|
|
|
:show-file-list="showList?false:true"
|
|
|
+ :on-progress="uploadVideoProcess"
|
|
|
>
|
|
|
<template v-if="styleType==='upload'">
|
|
|
<div class="upload-style">
|
|
@@ -39,6 +39,7 @@
|
|
|
</div>
|
|
|
</el-upload>
|
|
|
<!-- <div class="zhezhao" v-loading.fullscreen.lock="fullscreenLoading"></div> -->
|
|
|
+ <el-progress style="width: 500px" v-if="progressFlag" :percentage="loadProgress"></el-progress>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -64,6 +65,8 @@ export default {
|
|
|
uploadName: "",
|
|
|
uploadTip:"",
|
|
|
loading: false,
|
|
|
+ loadProgress: 0, // 动态显示进度条
|
|
|
+ progressFlag: false, // 关闭进度条
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -106,7 +109,17 @@ export default {
|
|
|
activated() {},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
- handleChange(file, fileList) {},
|
|
|
+ handleChange(file, fileList) {
|
|
|
+
|
|
|
+ },
|
|
|
+ uploadVideoProcess(event, file, fileList) {
|
|
|
+ this.progressFlag = true; // 显示进度条
|
|
|
+ this.loadProgress = parseInt(event.percent); // 动态获取文件上传进度
|
|
|
+ if (this.loadProgress >= 100) {
|
|
|
+ this.loadProgress = 100
|
|
|
+ setTimeout( () => {this.progressFlag = false}, 1000) // 一秒后关闭进度条
|
|
|
+ }
|
|
|
+ },
|
|
|
handleSuccess(response, file, fileList) {
|
|
|
if (response.status == 1) {
|
|
|
response.duration = response.file_info_list[0].media_duration
|
|
@@ -136,6 +149,11 @@ export default {
|
|
|
this.$message.warning('上传视频大小不能超过2G');
|
|
|
return false; // 必须返回false
|
|
|
}
|
|
|
+ } else if (this.uploadType === 'mp3') {
|
|
|
+ if (file.size > 20 * 1024 * 1024) {
|
|
|
+ this.$message.warning('上传音频大小不能超过20M');
|
|
|
+ return false; // 必须返回false
|
|
|
+ }
|
|
|
}else if(this.uploadType === 'video&radio'){
|
|
|
if (file.size > 500 * 1024 * 1024) {
|
|
|
this.$message.warning('上传文件大小不能超过500M');
|
|
@@ -153,12 +171,12 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
- this.loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: "Loading",
|
|
|
- spinner: "el-icon-loading",
|
|
|
- background: "rgba(0, 0, 0, 0.7)",
|
|
|
- });
|
|
|
+ // this.loading = this.$loading({
|
|
|
+ // lock: true,
|
|
|
+ // text: "Loading",
|
|
|
+ // spinner: "el-icon-loading",
|
|
|
+ // background: "rgba(0, 0, 0, 0.7)",
|
|
|
+ // });
|
|
|
},
|
|
|
handleRemove(file, fileList) {
|
|
|
this.changeFillId(fileList, this.fileName);
|