easy3wui 1.5.37-beta1 → 1.5.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -278,12 +278,13 @@ var formItemStyle = {
278
278
  marginBottom: 6
279
279
  };
280
280
  // 手机号区号及正则表 当有国家区号相同时后加区号在原本的区号基础上加 '+序号'
281
- var arrMobileAssociation = [{ label: '中国', value: '+86', pattern: /^1[34578]\d{9}$/ }, { label: '香港', value: '+852', pattern: /^\d+$/ }, { label: '台湾', value: '+886', pattern: /^\d+$/ }, { label: '澳门', value: '+853', pattern: /^\d+$/ },
281
+ var arrMobileAssociationDefault = [{ label: '中国', value: '+86', pattern: /^1[34578]\d{9}$/ }, { label: '香港', value: '+852', pattern: /^\d+$/ }, { label: '台湾', value: '+886', pattern: /^\d+$/ }, { label: '澳门', value: '+853', pattern: /^\d+$/ },
282
282
  // { label: '香港', value: '+852', pattern: /^([5|6|9])\d{7}$/ },
283
283
  // { label: '台湾', value: '+886', pattern: /^[0][9]\d{8}$/ },
284
284
  // { label: '澳门', value: '+853', pattern: /^6\d{7}$/ },
285
285
  { label: '美国', value: '+1', pattern: /^\d+$/ }, { label: '德国', value: '+49', pattern: /^\d+$/ }, { label: '法国', value: '+33', pattern: /^\d+$/ }, { label: '英国', value: '+34', pattern: /^\d+$/ }, { label: '日本', value: '+81', pattern: /^\d+$/ }, { label: '韩国', value: '+82', pattern: /^\d+$/ }, { label: '澳大利亚', value: '+61', pattern: /^\d+$/ }, { label: '加拿大', value: '+1+0', pattern: /^\d+$/ }, { label: '印度', value: '+91', pattern: /^\d+$/ }, { label: '俄罗斯', value: '+7', pattern: /^\d+$/ }];
286
- var objMobileRegular = {
286
+ // 号码正则
287
+ var objMobileRegularDefault = {
287
288
  '+86': /^1[34578]\d{9}$/,
288
289
  '+852': /^\d+$/,
289
290
  '+886': /^\d+$/,
@@ -542,12 +543,9 @@ var Easy3wFormPage = function (_Component) {
542
543
  addRules = [{ max: maxLength, message: '\u5F55\u5165\u6587\u5B57\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7' + maxLength, transform: _this.touchTransform }].concat(addRules);
543
544
  }
544
545
  } else if (fieldType === 'mobile') {
545
- var mobileAddonBefore = form.getFieldValue('mobileAddonBefore');
546
- // console.log('mobileAddonBefore', mobileAddonBefore, objMobileRegular[mobileAddonBefore]);
547
- // objMobileRegular[mobileAddonBefore]
548
- addRules = [{ pattern: objMobileRegular[mobileAddonBefore], message: '手机格式错误!' }].concat(addRules);
546
+ var e3wMobileNation = form.getFieldValue(fieldId + 'AddonBefore');
547
+ addRules = [{ pattern: _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[e3wMobileNation] : objMobileRegularDefault[e3wMobileNation], message: '手机格式错误!' }].concat(addRules);
549
548
  }
550
-
551
549
  var decoratorObj = {
552
550
  rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }].concat(addRules)
553
551
  };
@@ -1158,7 +1156,14 @@ var Easy3wFormPage = function (_Component) {
1158
1156
 
1159
1157
  var addonBeforeCmptPros = item.addonBeforeCmptPros || {};
1160
1158
  addonBeforeCmptPros = (0, _extends3['default'])({ allowClear: false, style: { minWidth: '90px' } }, addonBeforeCmptPros);
1161
- var itemArea = _this.selectHandler({ cmptPros: (0, _extends3['default'])({ optionLst: arrMobileAssociation }, addonBeforeCmptPros) });
1159
+ var itemArea = _this.selectHandler({
1160
+ cmptPros: (0, _extends3['default'])({
1161
+ onChange: function onChange(value) {
1162
+ return _this.onBlurMobileNation(value, fieldId);
1163
+ },
1164
+ optionLst: _comonConfig.arrMobileAssociation || arrMobileAssociationDefault
1165
+ }, addonBeforeCmptPros)
1166
+ });
1162
1167
 
1163
1168
  var decoratorObj = {
1164
1169
  rules: [{ required: required, message: '请填写区号' }],
@@ -1171,19 +1176,28 @@ var Easy3wFormPage = function (_Component) {
1171
1176
  }
1172
1177
  }, cmptPros));
1173
1178
  }, _this.onBlurMobile = function (e, fieldId) {
1174
- var mobileAreaCode = _this.props.form.getFieldValue(fieldId + 'AddonBefore');
1175
- if (e && e.target && e.target.value && mobileAreaCode) {
1176
- var xhr = new XMLHttpRequest();
1177
- xhr.onreadystatechange = function () {
1178
- if (xhr.readyState === 4 && xhr.status === 200) {
1179
- // 请求成功,处理响应数据
1180
- }
1181
- };
1182
- var data = JSON.stringify({ e3wMobile: e.target.value, e3wMobileNation: mobileAreaCode });
1183
- xhr.open("POST", _comonConfig.easy3w4fMobileLibUpdateUrl, true); // 异步请求
1184
- xhr.setRequestHeader("Content-Type", "application/json"); // 设置请求头
1185
- xhr.send(data); // 发送请求
1186
- }
1179
+ var e3wMobileNation = _this.props.form.getFieldValue(fieldId + 'AddonBefore');
1180
+ var pattern = _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[e3wMobileNation] : objMobileRegularDefault[e3wMobileNation];
1181
+ if (e && e.target && e.target.value && e3wMobileNation && pattern.test(e.target.value)) {
1182
+ _this.updateMobileInfo(e.target.value, e3wMobileNation);
1183
+ }
1184
+ }, _this.onBlurMobileNation = function (value, fieldId) {
1185
+ var e3wMobile = _this.props.form.getFieldValue(fieldId);
1186
+ var pattern = _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[value] : objMobileRegularDefault[value];
1187
+ if (e3wMobile && value && pattern.test(e3wMobile)) {
1188
+ _this.updateMobileInfo(e3wMobile, value);
1189
+ }
1190
+ }, _this.updateMobileInfo = function (e3wMobile, e3wMobileNation) {
1191
+ var xhr = new XMLHttpRequest();
1192
+ xhr.onreadystatechange = function () {
1193
+ if (xhr.readyState === 4 && xhr.status === 200) {
1194
+ // 请求成功,处理响应数据
1195
+ }
1196
+ };
1197
+ var data = JSON.stringify({ e3wMobile: e3wMobile, e3wMobileNation: e3wMobileNation });
1198
+ xhr.open('POST', _comonConfig.easy3w4fMobileLibUpdateUrl, true); // 异步请求
1199
+ xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
1200
+ xhr.send(data); // 发送请求
1187
1201
  }, _this.selectHandler = function (item) {
1188
1202
  var cmptPros = item.cmptPros;
1189
1203
  var optionLst = cmptPros.optionLst;
@@ -1676,7 +1690,11 @@ var Easy3wFormPage = function (_Component) {
1676
1690
  /** input end */
1677
1691
  /** mobile start */
1678
1692
 
1679
- // 手机录入框失去焦点
1693
+ // 手机号录入框失去焦点
1694
+
1695
+ // 手机归属值变更
1696
+
1697
+ // 更新手机信息
1680
1698
 
1681
1699
  /** mobile end */
1682
1700
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wui",
3
- "version": "1.5.37-beta1",
3
+ "version": "1.5.38",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",