修复作品集提交裁剪bug

This commit is contained in:
祝梦园 2023-09-26 11:13:51 +08:00
parent ea65d42f42
commit c81ae742bc

View File

@ -166,7 +166,6 @@ export default {
}, },
methods: { methods: {
realTime(data) { realTime(data) {
console.log(data)
this.cropImg = data this.cropImg = data
}, },
_initEditor(data) { _initEditor(data) {
@ -305,14 +304,12 @@ export default {
let portfolioDescription = _ts.contentEditor.getValue(); let portfolioDescription = _ts.contentEditor.getValue();
let portfolioDescriptionHtml = _ts.contentEditor.getHTML(); let portfolioDescriptionHtml = _ts.contentEditor.getHTML();
let data = _ts.portfolio; let data = _ts.portfolio;
this.$refs.cropper.getCropData(img => {
data.headImgUrl = img
data.portfolioDescription = portfolioDescription; data.portfolioDescription = portfolioDescription;
data.portfolioDescriptionHtml = portfolioDescriptionHtml; data.portfolioDescriptionHtml = portfolioDescriptionHtml;
data.headImgUrl = _ts.headImgUrl // data.headImgUrl = _ts.headImgUrl
data.headImgType = '0'; data.headImgType = '0';
// // _ts.$set(_ts, 'headImgUrl', _ts.cropImg);
console.log(data)
if ((data.portfolioDescription || undefined) == undefined || (data.portfolioDescriptionHtml || undefined) == undefined) { if ((data.portfolioDescription || undefined) == undefined || (data.portfolioDescriptionHtml || undefined) == undefined) {
this.$message.error('请输入必填信息'); this.$message.error('请输入必填信息');
return false return false
@ -333,6 +330,7 @@ export default {
} }
_ts.$set(_ts, 'loading', false) _ts.$set(_ts, 'loading', false)
}).catch(error => _ts.$set(_ts, 'loading', false)) }).catch(error => _ts.$set(_ts, 'loading', false))
})
}, },
deletePortfolio() { deletePortfolio() {
let _ts = this; let _ts = this;
@ -364,28 +362,6 @@ export default {
this.headImgUrl = '' this.headImgUrl = ''
// this.$refs.cropper.clearCrop() // this.$refs.cropper.clearCrop()
}, },
// get image data for post processing, e.g. upload or setting image src
// cropImage() {
// let _ts = this;
// try {
// _ts.cropImg = _ts.$refs.cropper.startCrop();
// this.$refs.cropper.getCropData(data => {
// console.log(data)
// return false
// // do something
// let portfolio = data;
// // portfolio.headImgUrl = data;
// // portfolio.headImgType = '0';
// _ts.$set(_ts, 'portfolio', portfolio);
// // _ts.$set(_ts, 'headImgUrl', _ts.cropImg);
// _ts.$message.success(' !');
// })
//
// } catch (e) {
// _ts.$message.error(' !');
// return;
// }
// }
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
let _ts = this; let _ts = this;
@ -437,8 +413,8 @@ export default {
let portfolioContent = ''; let portfolioContent = '';
if (_ts.idPortfolio) { if (_ts.idPortfolio) {
this.isEdit = true // this.isEdit = true
// _ts.$set(_ts, 'isEdit', true); _ts.$set(_ts, 'isEdit', true);
_ts.$set(_ts, 'portfolio', JSON.parse(JSON.stringify(_ts.portfolioDetail))); _ts.$set(_ts, 'portfolio', JSON.parse(JSON.stringify(_ts.portfolioDetail)));
_ts.$set(_ts, 'headImgUrl', _ts.portfolioDetail.headImgUrl); _ts.$set(_ts, 'headImgUrl', _ts.portfolioDetail.headImgUrl);
if (!this.isEdit) { if (!this.isEdit) {