ソースを参照

优化年龄信息不修改为问题

张田田 7 ヶ月 前
コミット
8e1e8bcd40

+ 4 - 2
miniprogram/module/user/pages/user-edit/user-edit.ts

@@ -15,7 +15,7 @@ Component({
     tickleBehavior,
   ],
   lifetimes: {
-    attached() {},
+    attached() { },
   },
   properties: {},
   data: {
@@ -54,7 +54,7 @@ Component({
         birth.getDate() !== day
       ) return { valid: false, message: '出生日期无效' };
       const Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
-      const Vi = ['1','0','X','9','8','7','6','5','4','3','2'];
+      const Vi = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
       let sum = 0;
       for (let i = 0; i < 17; i++) sum += parseInt(code[i]) * Wi[i];
       const check = Vi[sum % 11];
@@ -70,6 +70,8 @@ Component({
         that.updateByCardno(value);
       } else if (field === 'age') {
         that.setData({ ['model.age']: value });
+      } else if (field === 'name') {
+        that.setData({ ['model.name']: value });
       }
     },
     onFormChange(event: WechatMiniprogram.CustomEvent) {

+ 1 - 1
miniprogram/module/user/pages/user-edit/user-edit.wxml

@@ -6,7 +6,7 @@
     <form-fix _loading="{{dirty}}" delay="200">
       <!-- <t-cell t-class="cell-border-gradient" title="手机号" note="{{model['phone']}}" /> -->
       <t-cell title="姓名">
-        <input class="cell-field__inner" slot="note" name="name" value="{{model['name']}}" type="text" placeholder="请输入姓名" confirm-type="next" />
+        <input class="cell-field__inner" slot="note" name="name" value="{{model['name']}}" type="text" placeholder="请输入姓名" confirm-type="next" data-field="name" bindinput="onFormInput"  />
       </t-cell>
       <view class="cell-row">
         <view class="label">身份证号</view>