Explorar o código

子女 赡养人增加姓名认证

roose %!s(int64=4) %!d(string=hai) anos
pai
achega
a5fae8aab5
Modificáronse 1 ficheiros con 31 adicións e 1 borrados
  1. 31 1
      pages/collectInfo/collectInfo.js

+ 31 - 1
pages/collectInfo/collectInfo.js

@@ -2344,10 +2344,24 @@ Page({
   },
   // 子女姓名
   tab2Change2: function (e) {
+    let han = /^[\u4e00-\u9fa5]+$/;
+    if (!han.test(e.detail.value )) {
+      wx.showModal({
+        showCancel: false,
+        content: '您输入的内容不是汉字哦'
+      })
+      return false;
+    };
+    if (e.detail.value .length < 2) {
+      wx.showModal({
+        showCancel: false,
+        content: '赡养人姓名不可以少于两个字哦'
+      })
+      return false
+    }
     let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].name';
     console.log(this.data.childInfo[this.data.activeIndex].Info, "多个数字的问题");
     console.log(JSON.stringify(this.data.childInfo[this.data.activeIndex].Info));
-
     this.setData({
       [child]: e.detail.value
     })
@@ -2480,6 +2494,7 @@ Page({
   tab3Change1: function (e) {
     // 否是1
     console.log(e.detail.value, "1111111");
+
     let isHasOther = 'otherInfo[' + this.data.activeIndex + '].isHasOther'
     if (e.detail.value == '0') {
       this.setData({
@@ -2509,6 +2524,21 @@ Page({
   },
   // 其他赡养人姓名
   tab3Change2: function (e) {
+    let han = /^[\u4e00-\u9fa5]+$/;
+    if (!han.test(e.detail.value )) {
+      wx.showModal({
+        showCancel: false,
+        content: '您输入的内容不是汉字哦'
+      })
+      return false;
+    };
+    if (e.detail.value .length < 2) {
+      wx.showModal({
+        showCancel: false,
+        content: '赡养人姓名不可以少于两个字哦'
+      })
+      return false
+    }
     let Info = 'otherInfo[' + this.data.activeIndex + '].Info.name'
     this.setData({
       [Info]: e.detail.value,