Browse Source

逻辑调整

test
liwei 3 years ago
parent
commit
f888326cfd
1 changed files with 24 additions and 14 deletions
  1. +24
    -14
      src/views/personalCenter/userAvatar.vue

+ 24
- 14
src/views/personalCenter/userAvatar.vue View File

@ -86,7 +86,8 @@ export default {
}
},
created() {
this.options.img = this.picHeader + '/' + JSON.parse(localStorage.getItem("userInfo")).avatar
this.options.img = this.picHeader + '/' + JSON.parse(localStorage.getItem("userInfo")).avatar;
this.previews.url=this.options.img;
},
methods: {
//
@ -109,7 +110,7 @@ export default {
},
//
editCropper() {
this.open = true
this.open = true;
},
//
requestUpload() {
@ -129,18 +130,22 @@ export default {
},
//
uploadImg() {
var formData = new FormData()
formData.append('upload', this.newFile)
put('/admin/base/user/updatepic',formData).then(res => {
if (res.code === 200) {
this.open = false
this.options.img = `${this.picHeader}/${res.data}`
this.updateHeadPic()
this.msgSuccess('修改成功')
} else {
this.msgError(res.msg)
}
})
if(cropper.getBlob()){
var formData = new FormData();
formData.append('upload', cropper.getBlob(), this.newFile.name)
put('/admin/base/user/updatepic',formData).then(res => {
if (res.code === 200) {
this.open = false
this.options.img = `${this.picHeader}/${res.data}`
this.updateHeadPic()
this.msgSuccess('修改成功')
} else {
this.msgError(res.msg)
}
})
}else{
this.open = false
}
},
//
realTime(data) {
@ -155,4 +160,9 @@ export default {
width: auto;
}
}
.vue--picture-cropper__img{
width: 100%;
height: 100%;
object-fit: contain;
}
</style>

Loading…
Cancel
Save