update
This commit is contained in:
parent
1137456a74
commit
9ae30b3e27
@ -1,13 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-upload
|
<el-upload
|
||||||
class="avatar-uploader"
|
class="avatar-uploader"
|
||||||
action
|
action="#"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:http-request="selectPicUpload"
|
:http-request="selectPicUpload"
|
||||||
:auto-upload="true"
|
:auto-upload="true"
|
||||||
:before-upload="beforeAvatarUpload"
|
:before-upload="beforeAvatarUpload"
|
||||||
:on-remove="handleRemove"
|
:on-remove="handleRemove"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
|
name="multipartFile"
|
||||||
>
|
>
|
||||||
<img v-if="imageUrl" width="200px" height="200px" :src="imageUrl" class="avatar" />
|
<img v-if="imageUrl" width="200px" height="200px" :src="imageUrl" class="avatar" />
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||||
@ -38,9 +39,10 @@ export default {
|
|||||||
selectPicUpload(obj) {
|
selectPicUpload(obj) {
|
||||||
// let _this = this;
|
// let _this = this;
|
||||||
let fd = new FormData(); //参数的格式是formData格式的
|
let fd = new FormData(); //参数的格式是formData格式的
|
||||||
fd.append("file", obj.file); //参数
|
fd.append("multipartFile", obj.file); //参数
|
||||||
console.log(fd.get('file'));
|
console.log(fd.get('multipartFile'))
|
||||||
if (localStorage.getItem('userRole') === '0'&&localStorage.getItem('Authorization')) {
|
if (localStorage.getItem('userRole') === '0'&&localStorage.getItem('Authorization')) {
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: '/api/uploadfile',
|
url: '/api/uploadfile',
|
||||||
@ -48,8 +50,11 @@ export default {
|
|||||||
params:{
|
params:{
|
||||||
cate:'img',
|
cate:'img',
|
||||||
name:'dark_logo',
|
name:'dark_logo',
|
||||||
|
|
||||||
},
|
},
|
||||||
data:fd,
|
data:{
|
||||||
|
multipartFile:fd,
|
||||||
|
}
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
// if(res.data.msg!=="添加成功!"){
|
// if(res.data.msg!=="添加成功!"){
|
||||||
@ -66,9 +71,8 @@ export default {
|
|||||||
// type: 'success',
|
// type: 'success',
|
||||||
// offset: 0
|
// offset: 0
|
||||||
// });
|
// });
|
||||||
// // _this.imageUrl=_this.getImage('dark_logo');
|
// _this.imageUrl=_this.getImage('dark_logo');
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
Vue.prototype.$notify.error({
|
Vue.prototype.$notify.error({
|
||||||
|
Loading…
Reference in New Issue
Block a user