From c18dcc1a57dc03c0183bb40ce4768639ffcba84b Mon Sep 17 00:00:00 2001 From: jyt <1592211625@qq.com> Date: Thu, 28 Apr 2022 19:31:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=B8=E9=94=99=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Receive/index.vue | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/views/Receive/index.vue b/src/views/Receive/index.vue index b76a323..e3cc803 100644 --- a/src/views/Receive/index.vue +++ b/src/views/Receive/index.vue @@ -1361,19 +1361,24 @@ export default { //常错词确认 subMsg() { - this.$refs.form.validate((valid) => { - if (valid) { - this.form.correctWord = this.form.correctWord.replace(/[^\w\u4e00-\u9fa5]/g,"") - this.form.wrongWord = this.form.wrongWord.replace(/[^\w\u4e00-\u9fa5]/g,"") - this.dialogFormVisible = false; - let sas = this.textItself.replace( - this.form.wrongWord, - this.form.correctWord - ); - this.transcriptionlist[this.argtextindex].onebest = sas; - this.subWrongMsg(); - } - }); + let reg = /^[0-9]+$/ + if(reg.test(this.form.wrongWord)){ + this.$message.warning("常错词不能为纯数字!"); + }else{ + this.$refs.form.validate((valid) => { + if (valid) { + this.form.correctWord = this.form.correctWord.replace(/[^\w\u4e00-\u9fa5]/g,"") + this.form.wrongWord = this.form.wrongWord.replace(/[^\w\u4e00-\u9fa5]/g,"") + this.dialogFormVisible = false; + let sas = this.textItself.replace( + this.form.wrongWord, + this.form.correctWord + ); + this.transcriptionlist[this.argtextindex].onebest = sas; + this.subWrongMsg(); + } + }); + } }, //常错词提交 subWrongMsg() {