From 741d1f7b2e2ac1c3f89d80dfac7625e3427e2367 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 12 十月 2022 17:43:02 +0800
Subject: [PATCH] 2022.10.12

---
 pages/m_user/behaviors/b_inputCheck.js |   75 ++++++++++++++++++++++++-------------
 1 files changed, 48 insertions(+), 27 deletions(-)

diff --git a/pages/m_user/behaviors/b_inputCheck.js b/pages/m_user/behaviors/b_inputCheck.js
index 39eb81f..db93e12 100644
--- a/pages/m_user/behaviors/b_inputCheck.js
+++ b/pages/m_user/behaviors/b_inputCheck.js
@@ -1,5 +1,7 @@
 /**
- * 
+ * 淇℃伅杈撳叆閫昏緫
+ * 鍖呮嫭杈撳叆淇℃伅瀛樺偍銆佽緭鍏ヨ鑼冩�ф娴嬨�侀敊璇彁绀虹瓑
+ * @see "/data/sceneInfo.js"
  */
 module.exports = Behavior({
   data: {
@@ -10,6 +12,33 @@
     attached: function () {}
   },
   methods: {
+    selectChange(e) {
+      const index = e.currentTarget.dataset.index
+      const options = e.detail.options
+      this.setData({
+        [`msg[${index}].options`]: options
+      })
+    },
+
+    pickerChange(e) {
+      console.log(e);
+      const {
+        index,
+        mode
+      } = e.currentTarget.dataset
+      let i = e.detail.value.concat(e.detail.code)
+      if (mode == 'region') {
+        this.setData({
+          [`msg[${index}].value`]: i
+        })
+      } else if (mode == 'selector') {
+        this.setData({
+          [`msg[${index}].selectIndex`]: i,
+          [`msg[${index}].value`]: this.data.msg[index].options[i].value
+        })
+      }
+    },
+
     changeMsg(e) {
       let id = e.detail.params.id
       let value = e.detail.params.value
@@ -24,30 +53,6 @@
             [nPath]: false
           })
         }
-      }
-    },
-
-    onSubmit: function () {
-      console.log('onSubmit');
-      if (!this.submitCheck()) return
-
-      let msg = this.data.msg
-      if (msg) {
-        let info = {}
-        msg.forEach(m => {
-          info[m.id] = m.value
-        });
-        // console.log(info);
-        this.setData({info})
-        this.triggerEvent('onSubmit', info)
-        // wx.showToast({
-        //   title: 'onSubmit',
-        //   duration: 1000,
-        //   icon: 'none',
-        //   success: (res) => {},
-        //   fail: (res) => {},
-        //   complete: (res) => {},
-        // })
       }
     },
 
@@ -109,7 +114,7 @@
           }
         }
         //杈撳叆妗�
-        else if (m.value === "") {
+        else if (m.value === "" || m.value === null || m.value === undefined) {
           this.showErrorMsg(i)
           return false
         }
@@ -164,6 +169,22 @@
           })
         }).exec();
       }).exec();
-    }
+    },
+
+    onSubmit: function () {
+      console.log('onSubmit');
+      if (!this.submitCheck()) return
+
+      let msg = this.data.msg
+      if (msg) {
+        let info = {}
+        msg.forEach(m => {
+          info[m.id] = m.value
+        });
+        this.setData({info})
+        this.triggerEvent('onSubmit', info)
+        this.submit()
+      }
+    },
   }
 })
\ No newline at end of file

--
Gitblit v1.9.3