上传文件

This commit is contained in:
2020-11-12 09:53:30 +08:00
parent 84d3e45292
commit 4b83d61df7
4 changed files with 55 additions and 36 deletions

View File

@@ -9,6 +9,7 @@
class="avatar-uploader"
:show-upload-list="false"
:customRequest="uploadspic"
:beforeUpload="imgs"
@change="handleChange"
>
<a-avatar :size="85" shape="circle" :src="userinfo.img">
@@ -177,7 +178,7 @@
<a-upload
list-type="picture"
:customRequest="uploads"
:beforeUpload="beforeVideoUpload"
:beforeUpload="video"
>
<div class="upload-image">
<PlaySquareOutlined
@@ -531,7 +532,7 @@ import {
} from "@/api/index";
import { message } from "ant-design-vue";
import { useI18n } from "@/utils/i18n";
import { provenvideo } from '@/utils/common';
import { provenimg, provenvideo } from '@/utils/common';
export default defineComponent({
name: "Archives",
@@ -977,15 +978,20 @@ export default defineComponent({
setheadimg(res.video.url);
}
function beforeVideoUpload(file: any){
console.log(file)
const type = provenvideo(file.name);
if(!type){
message.error("文件类型错误,请重新选择")
}
return false;
// function beforeVideoUpload(file: any){
// console.log(file)
// const type = provenvideo(file.name);
// // if(!type){
// // message.error("文件类型错误,请重新选择")
// // }
// return type;
// }
function video(file: any){
return provenvideo(file)
}
function imgs(file: any){
return provenimg(file)
}
function setname(){
setusername(formData.value.name).then(()=>{
showname.value = true;
@@ -1040,8 +1046,9 @@ export default defineComponent({
lan,
interestslist,
isdisabled,
beforeVideoUpload,
setname
setname,
video,
imgs
};
},
});