This commit is contained in:
landaiqing 2023-12-26 01:48:59 +08:00
parent 1137456a74
commit 9ae30b3e27

View File

@ -1,13 +1,14 @@
<template>
<el-upload
class="avatar-uploader"
action
action="#"
:show-file-list="false"
:http-request="selectPicUpload"
:auto-upload="true"
:before-upload="beforeAvatarUpload"
:on-remove="handleRemove"
:limit="1"
name="multipartFile"
>
<img v-if="imageUrl" width="200px" height="200px" :src="imageUrl" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
@ -38,9 +39,10 @@ export default {
selectPicUpload(obj) {
// let _this = this;
let fd = new FormData(); //formData
fd.append("file", obj.file); //
console.log(fd.get('file'));
fd.append("multipartFile", obj.file); //
console.log(fd.get('multipartFile'))
if (localStorage.getItem('userRole') === '0'&&localStorage.getItem('Authorization')) {
axios({
method: 'post',
url: '/api/uploadfile',
@ -48,8 +50,11 @@ export default {
params:{
cate:'img',
name:'dark_logo',
},
data:fd,
data:{
multipartFile:fd,
}
}).then(function (res) {
console.log(res);
// if(res.data.msg!==""){
@ -66,9 +71,8 @@ export default {
// type: 'success',
// offset: 0
// });
// // _this.imageUrl=_this.getImage('dark_logo');
// _this.imageUrl=_this.getImage('dark_logo');
// }
}).catch((error) => {
console.log(error)
Vue.prototype.$notify.error({