diff --git a/src/views/modules/news/notice-add-or-update.vue b/src/views/modules/news/notice-add-or-update.vue index 0cbe3576..bc6065ca 100644 --- a/src/views/modules/news/notice-add-or-update.vue +++ b/src/views/modules/news/notice-add-or-update.vue @@ -108,7 +108,7 @@ export default { { required: true, message: this.$t('validate.required'), trigger: 'blur' } ], noticeContent: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } + { required: true, message: this.$t(' ') } ] } } @@ -205,12 +205,23 @@ export default { } }).catch(() => { }) }, + removeHTMLTag (str) { + str = str.replace(/<\/?[^>]*>/g, '') + str = str.replace(/[|]*\n/g, '\n') + str = str.replace(/ /gi, '') + return str + }, // 表单提交 dataFormSubmitHandle: debounce(function () { if (this.dataForm.noticeContent != null && this.dataForm.noticeContent !== undefined) { + this.dataForm.noticeContent = this.removeHTMLTag(this.dataForm.noticeContent) if ((this.dataForm.noticeContent).length > 10000) { return this.$message.error('您输入的的内容已超过字数不能提交') + } else if (this.dataForm.noticeContent.length === 0) { + return this.$message.error('通知内容不能空') } + } else { + return this.$message.error('通知内容不能为空') } this.$refs['dataForm'].validate((valid) => { if (!valid) {