From b2586546f7c8206cfb69c26e3fdb598f1c3c2df9 Mon Sep 17 00:00:00 2001 From: jyt <1592211625@qq.com> Date: Fri, 29 Apr 2022 11:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=B8=E9=94=99=E8=AF=8D=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=BA=E7=BA=AF=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/mine/details.vue | 12 +++++-- pages/mine/details2.vue | 72 +++++++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 33 deletions(-) diff --git a/pages/mine/details.vue b/pages/mine/details.vue index 892745d..067bef4 100644 --- a/pages/mine/details.vue +++ b/pages/mine/details.vue @@ -112,7 +112,7 @@ 常错词: - + @@ -169,7 +169,7 @@ - + @@ -583,6 +583,13 @@ }, //确认加入常错词 Confirmtheexit() { + let reg = /^[0-9]+$/ + if(reg.test(this.thewrongword)){ + this.$refs.uToast.show({ + title: '错误词不能为纯数字', + type: 'warning', + }) + }else{ if (this.thewrongword) { if (this.reswrongword) { let parames = { @@ -619,6 +626,7 @@ }); return } + } }, //取消加入常错词 Cancelout() { diff --git a/pages/mine/details2.vue b/pages/mine/details2.vue index ac469a7..6715eea 100644 --- a/pages/mine/details2.vue +++ b/pages/mine/details2.vue @@ -145,7 +145,7 @@ 错误词: - + @@ -412,6 +412,7 @@ 确认 + @@ -1220,44 +1221,53 @@ }, //确认加入常错词 Confirmtheexit() { - if (this.thewrongword) { - if (this.reswrongword) { - let parames = { - customerId: this.customerId, - cupid: this.luyinList[this.csdFileindex].id, - wrongWord: this.thewrongword, //错误词 - correctWord: this.reswrongword, //正确词 - translateHtmlContent: this.messagelisy, - } - this.isshow2 = false; - - - let sas = this.textItself.replace(this.thewrongword, this.reswrongword) - this.dialogList[this.argtextindex1].message[this.argtextindex2].onebest = sas - - this.dialogList.forEach(res => { - res.message.forEach(asd => { - asd.isshow = false; + let reg = /^[0-9]+$/ + if(reg.test(this.thewrongword)){ + this.$refs.uToast.show({ + title: '错误词不能为纯数字', + type: 'warning', + }) + }else{ + if (this.thewrongword) { + if (this.reswrongword) { + let parames = { + customerId: this.customerId, + cupid: this.luyinList[this.csdFileindex].id, + wrongWord: this.thewrongword, //错误词 + correctWord: this.reswrongword, //正确词 + translateHtmlContent: this.messagelisy, + } + this.isshow2 = false; + + + let sas = this.textItself.replace(this.thewrongword, this.reswrongword) + this.dialogList[this.argtextindex1].message[this.argtextindex2].onebest = sas + + this.dialogList.forEach(res => { + res.message.forEach(asd => { + asd.isshow = false; + }) }) - }) - this.$u.post("/corpus/addCorrectWord", parames).then(data => { - this.thewrongword = ""; - this.reswrongword = ""; - }) + this.$u.post("/corpus/addCorrectWord", parames).then(data => { + this.thewrongword = ""; + this.reswrongword = ""; + }) + } else { + uni.showToast({ + title: '正确值不能为空', + duration: 2000 + }); + return + } } else { uni.showToast({ - title: '正确值不能为空', + title: '错误词不能为空', duration: 2000 }); return } - } else { - uni.showToast({ - title: '错误词不能为空', - duration: 2000 - }); - return } + }, //取消加入常错词 Cancelout() {