|
|
|
@ -293,6 +293,10 @@ export default { |
|
|
|
// 监听内容变化,动态赋值 |
|
|
|
this.quillEditor.on('text-change', () => { |
|
|
|
this.dataForm.newsContent = this.quillEditor.root.innerHTML |
|
|
|
console.log(this.dataForm.newsContent.length) |
|
|
|
if ((this.dataForm.newsContent).length > 10000) { |
|
|
|
return this.$message.error('您输入的的内容已超过字数') |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 上传图片之前 (富文本) |
|
|
|
@ -316,6 +320,9 @@ export default { |
|
|
|
// 上传图片end |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
if ((this.dataForm.newsContent).length > 10000) { |
|
|
|
return this.$message.error('您输入的的内容已超过字数不能提交') |
|
|
|
} |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
@ -355,6 +362,9 @@ export default { |
|
|
|
}, 1000, { 'leading': true, 'trailing': false }), |
|
|
|
// 存草稿 |
|
|
|
draftDataFormSubmitHandle: debounce(function () { |
|
|
|
if ((this.dataForm.newsContent).length > 10000) { |
|
|
|
return this.$message.error('您输入的的内容已超过字数不能提交') |
|
|
|
} |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
@ -368,9 +378,25 @@ export default { |
|
|
|
type: 'success', |
|
|
|
duration: 500, |
|
|
|
onClose: () => { |
|
|
|
this.dataForm = {} |
|
|
|
this.dataForm.id = '' |
|
|
|
this.dataForm.streetId = '' |
|
|
|
this.dataForm.communityId = null |
|
|
|
this.dataForm.gridId = null |
|
|
|
this.dataForm.newsCateroryId = '' |
|
|
|
this.dataForm.newsTitle = '' |
|
|
|
this.dataForm.newsReleaseStartTime = '' |
|
|
|
this.dataForm.newsReleaseEndTime = '' |
|
|
|
this.dataForm.newsContent = '' |
|
|
|
this.dataForm.newsImageUrl = '' |
|
|
|
this.dataForm.street = '' |
|
|
|
this.dataForm.community = null |
|
|
|
this.dataForm.grid = null |
|
|
|
this.dataForm.newsProperty = '' |
|
|
|
this.visible = false |
|
|
|
this.time = [] |
|
|
|
this.quillEditor.root.innerHTML = '' |
|
|
|
this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null |
|
|
|
this.communityList = this.gridList = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => { }) |
|
|
|
@ -381,17 +407,7 @@ export default { |
|
|
|
this.dataForm.newsImageUrl = res.data.url |
|
|
|
}, |
|
|
|
beforeAvatarUpload (file) { |
|
|
|
const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png') |
|
|
|
const isLt2M = file.size / 1024 / 1024 < 0.5 |
|
|
|
|
|
|
|
if (!isJPG) { |
|
|
|
this.$message.error('上传图片只能是 JPG/PNG 格式!') |
|
|
|
} |
|
|
|
if (!isLt2M) { |
|
|
|
this.$message.error('上传图片大小不能超过 500KB!') |
|
|
|
} |
|
|
|
this.loading = true |
|
|
|
return isJPG && isLt2M |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
|
|