fix(components): 适配后端图片上传接口变动
This commit is contained in:
parent
310e94da29
commit
8cf2e0c7b3
@ -156,7 +156,8 @@ export default {
|
||||
portfolioDescription: '',
|
||||
portfolioDescriptionHtml: ''
|
||||
},
|
||||
isLoading: false
|
||||
isLoading: false,
|
||||
headImgType: '0'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -195,6 +196,7 @@ export default {
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function () {
|
||||
_ts.$set(_ts, 'headImgUrl', this.result);
|
||||
_ts.$set(_ts, 'headImgType', '1');
|
||||
// _ts.$refs.cropper?.replace(this.result);
|
||||
}
|
||||
},
|
||||
@ -204,7 +206,7 @@ export default {
|
||||
let data = _ts.portfolio;
|
||||
data.portfolioDescription = _ts.$refs.contentEditor.contentValue();
|
||||
data.portfolioDescriptionHtml = await _ts.$refs.contentEditor.contentHtml();
|
||||
data.headImgType = 0;
|
||||
data.headImgType = _ts.headImgType;
|
||||
data.headImgUrl = _ts.headImgUrl;
|
||||
if ((data.portfolioDescription || undefined) === undefined || (data.portfolioDescriptionHtml || undefined) === undefined) {
|
||||
this.$message.error('请输入必填信息');
|
||||
@ -287,6 +289,7 @@ export default {
|
||||
},
|
||||
reset() {
|
||||
this.headImgUrl = ''
|
||||
this.$set(this, 'headImgType', '0');
|
||||
// this.$refs.cropper.clearCrop()
|
||||
},
|
||||
},
|
||||
|
@ -155,7 +155,7 @@ export default {
|
||||
if (res && res.data && res.data.url) {
|
||||
let user = _ts.user;
|
||||
user.avatarUrl = res.data.url;
|
||||
user.avatarType = '0';
|
||||
user.avatarType = '1';
|
||||
_ts.$set(_ts, 'user', user);
|
||||
_ts.$set(_ts, 'avatarUrl', res.data.url);
|
||||
} else {
|
||||
@ -193,7 +193,13 @@ export default {
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.avatarUrl = JSON.parse(JSON.stringify(this.oldAvatarUrl))
|
||||
let _ts = this;
|
||||
const avatarUrl = JSON.parse(JSON.stringify(this.oldAvatarUrl))
|
||||
let user = _ts.user;
|
||||
user.avatarUrl = avatarUrl;
|
||||
user.avatarType = '0';
|
||||
_ts.$set(_ts, 'user', user);
|
||||
_ts.$set(_ts, 'avatarUrl', avatarUrl);
|
||||
// this.$refs.cropper.clearCrop();
|
||||
},
|
||||
// get image data for post processing, e.g. upload or setting image src
|
||||
|
Loading…
Reference in New Issue
Block a user