update
This commit is contained in:
parent
1137456a74
commit
9ae30b3e27
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user