From a46560cc6295c4ea2aed4644202f004561a0d14d Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Tue, 17 Dec 2019 10:34:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=AE=A1=E7=90=86=20-=20?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=86=85=E5=AE=B9=E4=B8=8D=E8=83=BD=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E5=88=A4=E6=96=AD=EF=BC=8C=E6=9B=B4=E6=94=B9=E5=9C=A8?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=8F=90=E4=BA=A4=E6=97=B6=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/news/notice-add-or-update.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/views/modules/news/notice-add-or-update.vue b/src/views/modules/news/notice-add-or-update.vue index 0cbe3576..6974b936 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, '') // 去除HTML tag + str = str.replace(/[ | ]*\n/g, '\n') // 去除行尾空白 + str = str.replace(/ /ig, '') // 去掉  + 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) {