Browse Source

常错词不能为纯数字

Jyt
jyt 2 years ago
parent
commit
b2586546f7
2 changed files with 51 additions and 33 deletions
  1. +10
    -2
      pages/mine/details.vue
  2. +41
    -31
      pages/mine/details2.vue

+ 10
- 2
pages/mine/details.vue View File

@@ -112,7 +112,7 @@
<viwe class="tian-view-t1"></viwe> <viwe class="tian-view-t1"></viwe>
<viwe class="tian-view-t2">常错词:</viwe> <viwe class="tian-view-t2">常错词:</viwe>
<viwe class="tian-view-t3"> <viwe class="tian-view-t3">
<input type="text" v-model="thewrongword" class="tian-input" placeholder="请输入" />
<input type="text" v-model="thewrongword" :disabled="true" class="tian-input" placeholder="请输入" />
</viwe> </viwe>
</view> </view>
<view class="tian-view"> <view class="tian-view">
@@ -169,7 +169,7 @@
</view> </view>
</view> </view>


<u-toast ref="uToast" />
</view> </view>
</template> </template>


@@ -583,6 +583,13 @@
}, },
//确认加入常错词 //确认加入常错词
Confirmtheexit() { Confirmtheexit() {
let reg = /^[0-9]+$/
if(reg.test(this.thewrongword)){
this.$refs.uToast.show({
title: '错误词不能为纯数字',
type: 'warning',
})
}else{
if (this.thewrongword) { if (this.thewrongword) {
if (this.reswrongword) { if (this.reswrongword) {
let parames = { let parames = {
@@ -619,6 +626,7 @@
}); });
return return
} }
}
}, },
//取消加入常错词 //取消加入常错词
Cancelout() { Cancelout() {


+ 41
- 31
pages/mine/details2.vue View File

@@ -145,7 +145,7 @@
<viwe class="tian-view-t1"></viwe> <viwe class="tian-view-t1"></viwe>
<viwe class="tian-view-t2">错误词:</viwe> <viwe class="tian-view-t2">错误词:</viwe>
<viwe class="tian-view-t3"> <viwe class="tian-view-t3">
<input type="text" v-model="thewrongword" class="tian-input" maxlength="8" placeholder="请输入" />
<input type="text" v-model="thewrongword" :disabled="true" class="tian-input" maxlength="8" placeholder="请输入" />
</viwe> </viwe>
</view> </view>
<view class="tian-view"> <view class="tian-view">
@@ -412,6 +412,7 @@
<view class="bounced3-2" @tap="roletab()">确认</view> <view class="bounced3-2" @tap="roletab()">确认</view>
</view> </view>
</view> </view>
<u-toast ref="uToast" />
</view> </view>
</template> </template>


@@ -1220,44 +1221,53 @@
}, },
//确认加入常错词 //确认加入常错词
Confirmtheexit() { 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 { } else {
uni.showToast({ uni.showToast({
title: '正确值不能为空',
title: '错误词不能为空',
duration: 2000 duration: 2000
}); });
return return
} }
} else {
uni.showToast({
title: '错误词不能为空',
duration: 2000
});
return
} }
}, },
//取消加入常错词 //取消加入常错词
Cancelout() { Cancelout() {


Loading…
Cancel
Save