roose 4 лет назад
Родитель
Сommit
2b2e6b0877
1 измененных файлов с 19 добавлено и 1 удалено
  1. 19 1
      pages/collectInfo/collectInfo.js

+ 19 - 1
pages/collectInfo/collectInfo.js

@@ -479,6 +479,7 @@ Page({
       })
       return false
     }
+    
     if (!han.test(this.data.addOldname)) {
       wx.showModal({
         showCancel: false,
@@ -1104,10 +1105,27 @@ Page({
       return
     } else {
       console.log(this.data.nameArr)
+      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 name = 'nameArr[' + this.data.activeIndex + '].name'
+      let oldName = 'oldInfo[' + this.data.activeIndex + '].name'
       this.setData({
         oldName: false,
-        [name]: e.detail.value
+        [name]: e.detail.value,
+        [oldName]: e.detail.value
       })
       console.log(this.data.nameArr)
     }