Browse Source

客户档案和公出面谈联系人增加汉字验证

dev01 1 month ago
parent
commit
339a496db1
2 changed files with 26 additions and 1 deletions
  1. 13 0
      src/pages/customerProfile/index.jsx
  2. 13 1
      src/pages/interview/index.jsx

+ 13 - 0
src/pages/customerProfile/index.jsx

@@ -651,6 +651,19 @@ class CustomerProfile extends Component {
           icon: "none",
         });
         return
+      } else if ('name,position,department'.indexOf(i) > -1) {
+        if (!data[i].match(/^[\D].*[\u4e00-\u9fff]+$/)) {
+          let keyObjName = {
+            name: "姓名",
+            position: "职位",
+            department: "部门"
+          };
+          Taro.showToast({
+            title: `请输入正确的${keyObjName[i]},不能以数字开头,且至少包含一个汉字`,
+            icon: "none",
+          });
+          return
+        }
       } else if (i == "mobile") {
         if (!(/^1[3-9]\d{9}$/.test(data[i]))) {
           Taro.showToast({

+ 13 - 1
src/pages/interview/index.jsx

@@ -745,7 +745,6 @@ class CustomerProfile extends Component {
   // 新建联系人
   add() {
     let data = this.state.obj
-    console.log(data)
     for (let i in data) {
       if (!data[i] && data[i] !== 0) {
         Taro.showToast({
@@ -753,6 +752,19 @@ class CustomerProfile extends Component {
           icon: "none",
         });
         return
+      } else if ('name,position,department'.indexOf(i) > -1) {
+        if (!data[i].match(/^[\D].*[\u4e00-\u9fff]+$/)) {
+          let keyObjName = {
+            name: "姓名",
+            position: "职位",
+            department: "部门"
+          };
+          Taro.showToast({
+            title: `请输入正确的${keyObjName[i]},不能以数字开头,且至少包含一个汉字`,
+            icon: "none",
+          });
+          return
+        }
       } else if (i == "mobile") {
         if (!(/^1[3-9]\d{9}$/.test(data[i]))) {
           Taro.showToast({