|
@@ -34,9 +34,9 @@
|
|
|
<span class="table-span">{{ row.name }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="大小" prop="size" width="120">
|
|
|
+ <el-table-column label="大小" prop="sizeText" width="120">
|
|
|
<template slot-scope="{row}" >
|
|
|
- <span class="table-span">{{ row.size }}</span>
|
|
|
+ <span class="table-span">{{ row.sizeText }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="音/视频" prop="type" width="100">
|
|
@@ -149,8 +149,10 @@ import MD5 from "js-md5";
|
|
|
})
|
|
|
},
|
|
|
async uploadMedia(file){
|
|
|
- console.log(file);
|
|
|
- if(this.uploadingFileNames.some(item=> item.split('.')[0] == file.name.split('.')[0])){
|
|
|
+ // console.log(file,this.uploadingFileNames,'this.uploadingFileNames');
|
|
|
+ let fileFront=file.name.split('.')[0]
|
|
|
+
|
|
|
+ if(this.uploadingFileNames.some(item=> item == fileFront)){
|
|
|
return this.$message.error(file.name+'同名文件正在上传,请稍后重试')
|
|
|
}
|
|
|
if(!(this.fileExp.test(file.name))){
|
|
@@ -164,11 +166,17 @@ import MD5 from "js-md5";
|
|
|
if(!res.flag){
|
|
|
return this.$message.error(res.msg);
|
|
|
}
|
|
|
+
|
|
|
+ let audioDuration = res.duration
|
|
|
|
|
|
if(!( (this.fileList.length+this.uploadingFileNames.length) < this.fileLimit)){
|
|
|
return this.$message.error(`上传文件已超过${this.fileLimit}个,${file.name}上传失败`)
|
|
|
}
|
|
|
- // TODO: 调用接口判断是否与数据库的文件重复
|
|
|
+ // 判断于 在库的文件名是否重名
|
|
|
+ let flag=true
|
|
|
+ let checkRes = await asrInterface.speechFlieRepetitionCheck({FileName:fileFront})
|
|
|
+ if(checkRes.Ret == 200) flag=false
|
|
|
+ if(flag) return
|
|
|
|
|
|
if(!this.uploadHint){
|
|
|
this.uploadHint = this.$message({
|
|
@@ -179,7 +187,6 @@ import MD5 from "js-md5";
|
|
|
})
|
|
|
}
|
|
|
// 上传
|
|
|
- let fileFront=file.name.split('.')[0]
|
|
|
this.uploadingFileNames.push(fileFront)
|
|
|
|
|
|
const t = new Date().getTime().toString();
|
|
@@ -190,8 +197,8 @@ import MD5 from "js-md5";
|
|
|
this.$store.state.dynamicOutLinks.ObjectStorageClient ||
|
|
|
JSON.parse(localStorage.getItem('dynamicOutLinks')).ObjectStorageClient
|
|
|
let options={}
|
|
|
- if((file.size/1024/1024 > 200)){
|
|
|
- // 大于200MB,分片上传
|
|
|
+ if((file.size/1024/1024 > 100)){
|
|
|
+ // 大于100MB,分片上传
|
|
|
console.log("切片上传");
|
|
|
// 上传的配置
|
|
|
options={
|
|
@@ -215,13 +222,14 @@ import MD5 from "js-md5";
|
|
|
}
|
|
|
let windowNum=this.current
|
|
|
uploadFileDirect(clientType,file.raw,temName,options).then(res=>{
|
|
|
- console.log(windowNum,this.current,'this.current');
|
|
|
if(!this.diaShow || (this.current!=windowNum)) return
|
|
|
let item = {
|
|
|
name:fileFront,
|
|
|
fileUrl:res,
|
|
|
- size:this.sizeFormat(file.size),
|
|
|
- type:this.videoExp.test(res)?"视频":"音频"
|
|
|
+ sizeText:this.sizeFormat(file.size),
|
|
|
+ size:file.size,
|
|
|
+ type:this.videoExp.test(res)?"视频":"音频",
|
|
|
+ duration:audioDuration || 0
|
|
|
}
|
|
|
this.fileList.push(item)
|
|
|
}).finally(()=>{
|
|
@@ -252,10 +260,11 @@ import MD5 from "js-md5";
|
|
|
let audioElement = new Audio(url);
|
|
|
audioElement.addEventListener('loadeddata', () => {
|
|
|
if(audioElement.duration>(60*60*5+1)){
|
|
|
- resolve({flag:false,msg:file.name+'时长已超限'})
|
|
|
+ resolve({flag:false,msg:file.name+'时长已超限',duration:audioElement.duration})
|
|
|
}else{
|
|
|
- resolve({flag:true,msg:''})
|
|
|
+ resolve({flag:true,msg:'',duration:audioElement.duration})
|
|
|
}
|
|
|
+ URL.revokeObjectURL(url);
|
|
|
});
|
|
|
setTimeout(()=>{
|
|
|
resolve({flag:false,msg:file.name+"获取不到时长,请重试"})
|
|
@@ -282,7 +291,9 @@ import MD5 from "js-md5";
|
|
|
Files:this.fileList.map(f =>{
|
|
|
return {
|
|
|
FileName:f.name,
|
|
|
- ResourceUrl:f.fileUrl
|
|
|
+ ResourceUrl:f.fileUrl,
|
|
|
+ FileSecond:Math.round(f.duration),
|
|
|
+ FileSize:f.size
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -295,7 +306,6 @@ import MD5 from "js-md5";
|
|
|
this.$emit("update:diaShow",false)
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
},
|