dlt-for-react 1.0.24 → 1.1.1

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.
Files changed (212) hide show
  1. package/README.md +12 -2
  2. package/lib/components/Button/index.js +79 -0
  3. package/lib/components/HqSelector/HqLsrySelector/index.js +3 -5
  4. package/lib/components/HqSelector/HqRySelector/index.js +3 -5
  5. package/lib/components/HqSelector/HqWzSelector/index.js +3 -5
  6. package/lib/components/KyEditableTable/component.js +3 -5
  7. package/lib/components/KyEditableTable/index.js +7 -13
  8. package/lib/components/KyExcel/index.js +3 -5
  9. package/lib/components/KyInputPicker/render.js +13 -43
  10. package/lib/components/KyInputPicker/setting-checkbox.js +3 -5
  11. package/lib/components/KyInputPicker/setting-multiSelect.js +3 -5
  12. package/lib/components/KyInputPicker/setting-nhcascader.js +3 -5
  13. package/lib/components/KyInputPicker/setting-select.js +3 -5
  14. package/lib/components/KyInputPicker/setting-stu-selector.js +3 -5
  15. package/lib/components/KyInputPicker/setting-tea-selector.js +3 -5
  16. package/lib/components/KyTable/checkButtons.js +4 -7
  17. package/lib/components/KyTree/index.js +6 -16
  18. package/lib/components/KyUpload/index.js +10 -20
  19. package/lib/components/NHAuditPanel/config/Axios.js +263 -0
  20. package/lib/components/NHAuditPanel/config/api.js +479 -0
  21. package/lib/components/NHAuditPanel/config/data.js +156 -0
  22. package/lib/components/NHAuditPanel/config/typeMap.js +1234 -0
  23. package/lib/components/NHAuditPanel/config/uiValidate.js +92 -0
  24. package/lib/components/NHAuditPanel/index.js +413 -0
  25. package/lib/components/NHAuditPanel/node.js +619 -0
  26. package/lib/components/NHCascader/index.js +355 -0
  27. package/lib/components/NHCheckboxGroup/index.js +135 -0
  28. package/lib/components/NHDynamicFormShow/baseInfo/index.js +194 -0
  29. package/lib/components/NHDynamicFormShow/custom/index.js +553 -0
  30. package/lib/components/NHDynamicFormShow/customModule/common/CommonMethod.js +43 -0
  31. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/EditForm.js +1113 -0
  32. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/index.js +263 -0
  33. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/EditForm.js +880 -0
  34. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/index.js +171 -0
  35. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/EditForm.js +865 -0
  36. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/index.js +138 -0
  37. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/EditForm.js +571 -0
  38. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/index.js +147 -0
  39. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/EditForm.js +474 -0
  40. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/index.js +139 -0
  41. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/EditForm.js +506 -0
  42. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/index.js +143 -0
  43. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/EditForm.js +1074 -0
  44. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/index.js +172 -0
  45. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/EditForm.js +927 -0
  46. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/index.js +195 -0
  47. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/EditForm.js +1064 -0
  48. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/index.js +183 -0
  49. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/EditForm.js +763 -0
  50. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/index.js +137 -0
  51. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/EditForm.js +819 -0
  52. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/index.js +137 -0
  53. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/EditForm.js +700 -0
  54. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/index.js +162 -0
  55. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/EditForm.js +743 -0
  56. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/index.js +177 -0
  57. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/EditForm.js +848 -0
  58. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/index.js +138 -0
  59. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/EditForm.js +777 -0
  60. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/index.js +161 -0
  61. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/EditForm.js +706 -0
  62. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/index.js +130 -0
  63. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/cfjcEditForm.js +413 -0
  64. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/index.js +135 -0
  65. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/EditForm.js +1013 -0
  66. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/index.js +175 -0
  67. package/lib/components/NHDynamicFormShow/customModule/jjrlx/EditForm.js +1345 -0
  68. package/lib/components/NHDynamicFormShow/customModule/jjrlx/index.js +274 -0
  69. package/lib/components/NHDynamicFormShow/customModule/jxj/EditForm.js +669 -0
  70. package/lib/components/NHDynamicFormShow/customModule/jxj/index.js +134 -0
  71. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/EditForm.js +378 -0
  72. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/index.js +120 -0
  73. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/EditForm.js +638 -0
  74. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/index.js +133 -0
  75. package/lib/components/NHDynamicFormShow/customModule/qgzx/EditForm.js +965 -0
  76. package/lib/components/NHDynamicFormShow/customModule/qgzx/index.js +237 -0
  77. package/lib/components/NHDynamicFormShow/customModule/qjgl/EditForm.js +823 -0
  78. package/lib/components/NHDynamicFormShow/customModule/qjgl/index.js +188 -0
  79. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/EditForm.js +401 -0
  80. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/index.js +472 -0
  81. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/EditForm.js +304 -0
  82. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHCascader/index.js +375 -0
  83. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/RadioGroup.js +118 -0
  84. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/index.js +62 -0
  85. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/input-const.js +55 -0
  86. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/render.js +1238 -0
  87. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/index.js +375 -0
  88. package/lib/components/NHDynamicFormShow/customModule/rych/collective/EditForm.js +554 -0
  89. package/lib/components/NHDynamicFormShow/customModule/rych/collective/index.js +130 -0
  90. package/lib/components/NHDynamicFormShow/customModule/rych/personal/EditForm.js +542 -0
  91. package/lib/components/NHDynamicFormShow/customModule/rych/personal/index.js +133 -0
  92. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/EditForm.js +575 -0
  93. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/index.js +130 -0
  94. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/EditForm.js +563 -0
  95. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/index.js +133 -0
  96. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/EditForm.js +745 -0
  97. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/index.js +164 -0
  98. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/EditForm.js +587 -0
  99. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/index.js +143 -0
  100. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/EditForm.js +743 -0
  101. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/index.js +172 -0
  102. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/EditForm.js +1410 -0
  103. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/index.js +274 -0
  104. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/EditForm.js +755 -0
  105. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/index.js +130 -0
  106. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/EditForm.js +814 -0
  107. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/index.js +188 -0
  108. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/EditForm.js +769 -0
  109. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/index.js +130 -0
  110. package/lib/components/NHDynamicFormShow/customModule/whgcrych/EditForm.js +1004 -0
  111. package/lib/components/NHDynamicFormShow/customModule/whgcrych/index.js +126 -0
  112. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/EditForm.js +503 -0
  113. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/index.js +149 -0
  114. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/EditForm.js +379 -0
  115. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/index.js +148 -0
  116. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/EditForm.js +748 -0
  117. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/index.js +135 -0
  118. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/EditForm.js +762 -0
  119. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/index.js +134 -0
  120. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/cfjcEditForm.js +682 -0
  121. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/index.js +135 -0
  122. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/index.js +152 -0
  123. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/wjsbEditForm.js +783 -0
  124. package/lib/components/NHDynamicFormShow/customModule/zxj/EditForm.js +764 -0
  125. package/lib/components/NHDynamicFormShow/customModule/zxj/index.js +138 -0
  126. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/cfjcEditForm.js +677 -0
  127. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/index.js +138 -0
  128. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/EditForm.js +1173 -0
  129. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/index.js +242 -0
  130. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistForm.js +862 -0
  131. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistIndex.js +201 -0
  132. package/lib/components/NHDynamicFormShow/customModule/zzsd/stuinfo/messageInfo.js +196 -0
  133. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/index.js +167 -0
  134. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/wjsbEditForm.js +1096 -0
  135. package/lib/components/NHDynamicFormShow/index.js +647 -0
  136. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/cardItem/index.js +279 -0
  137. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/index.js +206 -0
  138. package/lib/components/NHDynamicFormShow/oneOnMany/index.js +419 -0
  139. package/lib/components/NHDynamicFormShow/oneOnOne/EditForm.js +401 -0
  140. package/lib/components/NHDynamicFormShow/oneOnOne/index.js +271 -0
  141. package/lib/components/NHImagePicker/index.js +554 -0
  142. package/lib/components/NHInputPicker/RadioGroup.js +118 -0
  143. package/lib/components/NHInputPicker/index.js +62 -0
  144. package/lib/components/NHInputPicker/input-const.js +55 -0
  145. package/lib/components/NHInputPicker/render.js +1271 -0
  146. package/lib/components/NHListView/index.js +374 -0
  147. package/lib/components/NHMapGeolocation/index.js +537 -0
  148. package/lib/components/NHMapGeolocation/initMap/initGdMap.js +104 -0
  149. package/lib/components/NHMapGeolocation/initMap/initTencentMap.js +138 -0
  150. package/lib/components/NHMapGeolocation/style.js +51 -0
  151. package/lib/components/NHMultiSelect/index.js +272 -0
  152. package/lib/components/NHRadioGroup/index.js +118 -0
  153. package/lib/components/NHSelect/index.js +364 -0
  154. package/lib/components/NHTreeMenu/index.js +126 -0
  155. package/lib/components/NHTreeMenu/treeNode.js +164 -0
  156. package/lib/components/StuSelector/index.js +611 -0
  157. package/lib/index.js +187 -118
  158. package/lib/layouts/KyInputPicker/edit-page.js +585 -0
  159. package/lib/layouts/KyInputPicker/index.js +220 -0
  160. package/lib/layouts/KyInputPicker/input-const.js +134 -0
  161. package/lib/layouts/KyInputPicker/render.js +2477 -0
  162. package/lib/layouts/KyInputPicker/setting-checkbox.js +850 -0
  163. package/lib/layouts/KyInputPicker/setting-datepicker.js +430 -0
  164. package/lib/layouts/KyInputPicker/setting-datetimepicker.js +443 -0
  165. package/lib/layouts/KyInputPicker/setting-input.js +555 -0
  166. package/lib/layouts/KyInputPicker/setting-inputNumber.js +612 -0
  167. package/lib/layouts/KyInputPicker/setting-monthpicker.js +434 -0
  168. package/lib/layouts/KyInputPicker/setting-multiSelect.js +532 -0
  169. package/lib/layouts/KyInputPicker/setting-nhcascader.js +584 -0
  170. package/lib/layouts/KyInputPicker/setting-old-upload.js +428 -0
  171. package/lib/layouts/KyInputPicker/setting-radio.js +468 -0
  172. package/lib/layouts/KyInputPicker/setting-rangepicker.js +466 -0
  173. package/lib/layouts/KyInputPicker/setting-select.js +534 -0
  174. package/lib/layouts/KyInputPicker/setting-stu-selector.js +507 -0
  175. package/lib/layouts/KyInputPicker/setting-switch.js +274 -0
  176. package/lib/layouts/KyInputPicker/setting-tea-selector.js +507 -0
  177. package/lib/layouts/KyInputPicker/setting-textarea.js +619 -0
  178. package/lib/layouts/KyInputPicker/setting-timepicker.js +437 -0
  179. package/lib/layouts/KyInputPicker/setting-upload.js +766 -0
  180. package/lib/layouts/KyModal/buildTitle.js +81 -0
  181. package/lib/layouts/KyModal/dragM.js +127 -0
  182. package/lib/layouts/KyModal/index.js +321 -0
  183. package/lib/layouts/KyPreview/index.js +219 -0
  184. package/lib/layouts/KyUpload/index.js +1155 -0
  185. package/lib/layouts/LeftMenu/index.js +5 -11
  186. package/lib/layouts/NavigationBar/index.js +4 -10
  187. package/lib/layouts/Top/editPassWord.js +5 -7
  188. package/lib/layouts/Top/index.js +6 -20
  189. package/lib/layouts/TopMenu/index.js +11 -14
  190. package/lib/layouts/layout/index.js +7 -13
  191. package/lib/layouts/{Login → login}/index-pre.js +3 -5
  192. package/lib/layouts/{Login → login}/index.js +6 -8
  193. package/lib/layouts/{Login → login}/login.js +8 -17
  194. package/lib/layouts/mixTop/index.js +13 -28
  195. package/lib/layouts/settingDrawer/index.js +3 -5
  196. package/lib/routes/AuthorizedRoute.js +7 -13
  197. package/lib/utils/NHCore.js +46 -2
  198. package/lib/utils/browserJudge.js +33 -0
  199. package/lib/utils/common.js +18 -20
  200. package/lib/utils/createUuid.js +11 -31
  201. package/lib/utils/device.js +44 -0
  202. package/lib/utils/dynamicLoadCss.js +14 -0
  203. package/lib/utils/dynamicLoadJs.js +21 -0
  204. package/lib/utils/getLoginUser.js +1 -1
  205. package/lib/utils/getSize.js +2 -11
  206. package/lib/utils/getStyle.js +26 -0
  207. package/lib/utils/getSuitHeight.js +49 -0
  208. package/lib/utils/hasAuth.js +11 -0
  209. package/lib/utils/index.js +1 -34
  210. package/lib/utils/loadJS.js +40 -0
  211. package/package.json +1 -1
  212. /package/lib/layouts/{Login → login}/lyPassword.js +0 -0
@@ -0,0 +1,537 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _inputItem = require('antd-mobile/lib/input-item');
8
+
9
+ var _inputItem2 = _interopRequireDefault(_inputItem);
10
+
11
+ var _textareaItem = require('antd-mobile/lib/textarea-item');
12
+
13
+ var _textareaItem2 = _interopRequireDefault(_textareaItem);
14
+
15
+ var _list = require('antd-mobile/lib/list');
16
+
17
+ var _list2 = _interopRequireDefault(_list);
18
+
19
+ var _activityIndicator = require('antd-mobile/lib/activity-indicator');
20
+
21
+ var _activityIndicator2 = _interopRequireDefault(_activityIndicator);
22
+
23
+ var _toast = require('antd-mobile/lib/toast');
24
+
25
+ var _toast2 = _interopRequireDefault(_toast);
26
+
27
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
28
+
29
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
30
+
31
+ require('antd-mobile/lib/input-item/style/css');
32
+
33
+ require('antd-mobile/lib/textarea-item/style/css');
34
+
35
+ require('antd-mobile/lib/list/style/css');
36
+
37
+ require('antd-mobile/lib/activity-indicator/style/css');
38
+
39
+ require('antd-mobile/lib/toast/style/css');
40
+
41
+ var _react = require('react');
42
+
43
+ var _react2 = _interopRequireDefault(_react);
44
+
45
+ var _propTypes = require('prop-types');
46
+
47
+ var _propTypes2 = _interopRequireDefault(_propTypes);
48
+
49
+ var _loadJS = require('../../utils/loadJS');
50
+
51
+ var _loadJS2 = _interopRequireDefault(_loadJS);
52
+
53
+ var _equalsObj = require('../../utils/equalsObj');
54
+
55
+ var _equalsObj2 = _interopRequireDefault(_equalsObj);
56
+
57
+ var _initGdMap = require('./initMap/initGdMap');
58
+
59
+ var _initTencentMap = require('./initMap/initTencentMap');
60
+
61
+ var _NHFetch = require('../../utils/NHFetch');
62
+
63
+ var _NHFetch2 = _interopRequireDefault(_NHFetch);
64
+
65
+ var _style = require('./style');
66
+
67
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
68
+
69
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
70
+
71
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72
+
73
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
74
+
75
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
76
+
77
+ var TypeMap = Object.freeze({ //定位地图类型 TX:腾讯地图 GD:高德地图(高德需配置HTTPS,比腾讯地图准确)
78
+ GD: Symbol.for('GD_MAP'),
79
+ TX: Symbol.for('TX_MAP')
80
+ }),
81
+ csbz = Object.freeze('XTGL_MAP_LOCATION_KEY'),
82
+ dwsbStr = Object.freeze('定位失败'),
83
+ KeyMap = Object.freeze({ //定位地图类型 TX:腾讯地图 GD:高德地图(高德需配置HTTPS,比腾讯地图准确)
84
+ GD: Symbol.for('c296c467f43274c1e0e9dc4a4005f7d3'),
85
+ TX: Symbol.for('SHOBZ-BUM63-4YM3D-3CKVA-3NEF6-3BBZX')
86
+ });
87
+
88
+ var lnglatDefault = '113.37401,23.12598';
89
+
90
+ /**
91
+ * @author qianzhiwei
92
+ * @description 地图定位
93
+ *
94
+ * 高德:需要 https 的站点才可使用,所部署服务的服务器要能被内外网访问
95
+ * 腾讯:安卓微信端浏览器也需要 https 的站点才可使用 (安卓本机浏览器和 ios 都行)
96
+ *
97
+ * ******** 本地测试需要开通内外网映射 ********
98
+ *
99
+ * 1、有form获取回调值:
100
+ * <NHMapGeolocation currentMapType={'GD'}
101
+ form={this.props.form}
102
+ title={fieldMap.DWDZ.title}
103
+ { ...getFieldProps('dwdz',{required:required}) }
104
+ required={required}/>
105
+ * this.props.form.validateFields((err, formData) => {
106
+ console.log('formData', formData)
107
+ })
108
+
109
+ 2、无form获取回调值
110
+ <NHMapGeolocation ref={'NHMapGeolocation'} beforeLocationName={'返校确认'} afterLocationName={'已确认'} onClick={(isScope) => { this.confirmBack(isScope) }} />
111
+ console.log('this.formRef.retData()', this.refs.NHMapGeolocation.retData())
112
+ */
113
+
114
+ var NHMapGeolocation = function (_Component) {
115
+ _inherits(NHMapGeolocation, _Component);
116
+
117
+ function NHMapGeolocation(props) {
118
+ _classCallCheck(this, NHMapGeolocation);
119
+
120
+ var _this = _possibleConstructorReturn(this, (NHMapGeolocation.__proto__ || Object.getPrototypeOf(NHMapGeolocation)).call(this, props));
121
+
122
+ _this.queryCsz = function (csbz, csbz_state) {
123
+ (0, _NHFetch2.default)('api/zhxg-xtgl/openapi/getCsszByCsbz', 'GET', { csbz: csbz }).then(function (res) {
124
+ if (res && res.code === 200) {
125
+ var data = res.data;
126
+ var csz = data.csz;
127
+ // let opts = {}
128
+ // opts[csbz_state] = csz
129
+ // this.setState(opts)
130
+ _this.setState(_defineProperty({}, csbz_state, csz));
131
+ }
132
+ });
133
+ };
134
+
135
+ _this.renderJsInit = function (key) {
136
+ var currentMapType = _this.props.currentMapType;
137
+
138
+ var type = TypeMap[currentMapType];
139
+ switch (type) {
140
+ case Symbol.for('GD_MAP'):
141
+ return (0, _initGdMap.initGdJS)(key);
142
+ case Symbol.for('TX_MAP'):
143
+ return (0, _initTencentMap.initTencentJS)(key);
144
+ default:
145
+ _this.notFoundThrowException(currentMapType);
146
+ }
147
+ };
148
+
149
+ _this.renderMapInit = function (currentMapType, key, fn) {
150
+ switch (currentMapType) {
151
+ case Symbol.for('GD_MAP'):
152
+ return (0, _initGdMap.initGdMap)(fn);
153
+ case Symbol.for('TX_MAP'):
154
+ return (0, _initTencentMap.initTencentMap)(key, fn);
155
+ default:
156
+ _this.notFoundThrowException(currentMapType);
157
+ }
158
+ };
159
+
160
+ _this.reLocation = function (key, fn) {
161
+ var currentMapType = _this.props.currentMapType;
162
+
163
+ _this.setState({ currentAddress: undefined });
164
+ _this.props.form && _this.props.form.setFieldsValue({ mapGeolocation_currentAddress: undefined });
165
+ _this.renderMapInit(TypeMap[currentMapType], key, fn);
166
+ };
167
+
168
+ _this.notFoundThrowException = function (msg) {
169
+ _toast2.default.fail('请到系统管理设置地图秘钥');
170
+ throw new NHMapGeolocationNotFoundException('\u521D\u59CB\u5316\u5730\u56FE\u5931\u8D25,\u627E\u4E0D\u5230\u76F8\u5E94\u7684\u5730\u56FE\u7C7B\u578B\uFF01Can\'t find this currentMapType[' + msg + ']!');
171
+ };
172
+
173
+ _this.transferMsg = function (result) {
174
+ var _result$data = result.data,
175
+ data = _result$data === undefined ? {} : _result$data;
176
+
177
+ if (result && result.status === 'complete') {
178
+ var currentAddress = data.formattedAddress,
179
+ currentPosition = data.position,
180
+ locationType = data.location_type;
181
+ //是否需要判断本次定位在定位范围内
182
+
183
+ if (_this.props.containCircleFlag) {
184
+ var currentMapType = _this.props.currentMapType;
185
+ var _this$state = _this.state,
186
+ sourceLngLat = _this$state.lnglat,
187
+ radius = _this$state.radius;
188
+
189
+ var isContain = _this.containCircle(currentMapType, currentPosition, sourceLngLat, radius);
190
+ result.isContain = isContain;
191
+ }
192
+ _this.setState({ result: result, currentAddress: currentAddress, currentPosition: currentPosition, locationType: locationType, status: 'success' });
193
+ _this.buildFieldsValue(currentAddress, result, result.status);
194
+ } else {
195
+ var msg = data.msg; //错误信息
196
+
197
+ _toast2.default.fail(msg != '' && msg != undefined ? msg : dwsbStr, 1, function () {
198
+ _this.setState({ result: result, currentAddress: dwsbStr, status: 'error' });
199
+ _this.buildFieldsValue(dwsbStr, result, result.status);
200
+ });
201
+ }
202
+ };
203
+
204
+ _this.retData = function () {
205
+ return {
206
+ state: _this.state
207
+ };
208
+ };
209
+
210
+ _this.isScope = function (currentPosition) {
211
+ console.log('currentPosition', currentPosition);
212
+ var currentMapType = _this.props.currentMapType;
213
+ var _this$state2 = _this.state,
214
+ sourceLngLat = _this$state2.lnglat,
215
+ radius = _this$state2.radius,
216
+ currentAddress = _this$state2.currentAddress,
217
+ isScope = _this$state2.isScope,
218
+ confirmScope = _this$state2.confirmScope;
219
+
220
+ if (confirmScope) {
221
+ return false;
222
+ } //定位成功后,不能再次定位
223
+ if (!currentAddress) {
224
+ _toast2.default.fail('请先等定位地址成功显示后,再确认定位!');
225
+ return false;
226
+ }
227
+ var isScope_result = _this.containCircle(currentMapType, currentPosition, sourceLngLat, radius) || false;
228
+ _this.setState({ isScope: isScope_result });
229
+ if (_this.props.onClick) {
230
+ _this.props.onClick(isScope_result);
231
+ }
232
+ };
233
+
234
+ _this.isConfirm = function (flag) {
235
+ console.log('flag', flag);
236
+ _this.setState({ confirmScope: flag });
237
+ };
238
+
239
+ _this.state = {
240
+ result: {}, //定位信息
241
+ currentAddress: '', //当前定位地址
242
+ currentPosition: '', //当前定位坐标方位
243
+ locationType: '', //定位结果的来源,可能的值有:'html5'、'ip'、'sdk'
244
+ status: '', //定位成功或失败 success、error
245
+ key: '', //当前地图密钥
246
+ lnglat: '', //目标经纬度
247
+ radius: '', //半径
248
+ isScope: false, //定位成功true后,不允许再定位了
249
+ confirmScope: false //父组件定位确认成功后修改状态
250
+ };
251
+ return _this;
252
+ }
253
+
254
+ _createClass(NHMapGeolocation, [{
255
+ key: 'componentDidMount',
256
+ value: function componentDidMount() {
257
+ this.initScript();
258
+ if (this.props.form) {
259
+ //查询目标经纬度
260
+ this.queryCsz('XTGL_MAP_LNGLAT', 'lnglat');
261
+ //查询半径
262
+ this.queryCsz('XTGL_MAP_LNGLAT_RADIUS', 'radius');
263
+ }
264
+ }
265
+ }, {
266
+ key: 'componentWillReceiveProps',
267
+ value: function componentWillReceiveProps(nextprops) {
268
+ if ('form' in nextprops && !(0, _equalsObj2.default)(this.props.form, nextprops.form)) {
269
+ this.initScript();
270
+ }
271
+ }
272
+
273
+ //根据标识查询系统配置项
274
+
275
+ }, {
276
+ key: 'initScript',
277
+ value: function initScript() {
278
+ var _this2 = this;
279
+
280
+ (0, _NHFetch2.default)('api/zhxg-xtgl/openapi/getCsszByCsbz', 'GET', { csbz: csbz }).then(function (res) {
281
+ if (res && res.code === 200) {
282
+ var data = res.data;
283
+ var key = data.csz || KeyMap[_this2.props.currentMapType];
284
+ _this2.setState({ key: key });
285
+ var url = _this2.renderJsInit(key) || 'https://webapi.amap.com/maps?v=1.4.15&key=' + key;
286
+ (0, _loadJS2.default)(url, function () {
287
+ return _this2.reLocation(key, _this2.transferMsg);
288
+ });
289
+ }
290
+ });
291
+ }
292
+
293
+ //初始化JS
294
+
295
+
296
+ //初始化地图
297
+
298
+
299
+ //重新定位
300
+
301
+
302
+ //异常处理
303
+
304
+
305
+ //处理数据
306
+
307
+
308
+ //回调:返回state值
309
+
310
+ }, {
311
+ key: 'buildFieldsValue',
312
+
313
+
314
+ //回调:设置表单值
315
+ value: function buildFieldsValue(currentAddress, result, status) {
316
+ var form = this.props.form;
317
+
318
+ console.log('result', result);
319
+ if (form) {
320
+ //const fieldId = fieldProps.ref.__reactBoundArguments ? fieldProps.ref.__reactBoundArguments[0] : 'dwdz'
321
+ //const fieldId = id || (fieldProps.ref.__reactBoundArguments ? fieldProps.ref.__reactBoundArguments[0] : 'dwdz')
322
+ var fieldMap = {};
323
+ //fieldMap[fieldId] = currentAddress
324
+ fieldMap['mapGeolocation_status'] = status;
325
+ fieldMap['mapGeolocation_result'] = result;
326
+ fieldMap['mapGeolocation_currentAddress'] = currentAddress;
327
+ this.props.form.setFieldsValue(fieldMap);
328
+ if (this.props.onChange && typeof this.props.onChange === "function") {
329
+ this.props.onChange(currentAddress);
330
+ }
331
+ }
332
+ this.setState({ currentAddress: currentAddress });
333
+ }
334
+
335
+ //解析定位是否在某范围中
336
+
337
+ }, {
338
+ key: 'containCircle',
339
+
340
+
341
+ //判断范围
342
+ value: function containCircle(currentMapType, currentPosition) {
343
+ var sourceLngLat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : lnglatDefault;
344
+ var radius = arguments[3];
345
+
346
+ var type = TypeMap[currentMapType];
347
+ switch (type) {
348
+ case Symbol.for('GD_MAP'):
349
+ return (0, _initGdMap.containGdCircle)(currentPosition, sourceLngLat, radius);
350
+ case Symbol.for('TX_MAP'):
351
+ return (0, _initTencentMap.containTxCircle)(currentPosition, sourceLngLat, radius);
352
+ default:
353
+ this.notFoundThrowException(currentMapType);
354
+ }
355
+ }
356
+
357
+ //父组件调用,改变定位成功后状态
358
+
359
+ }, {
360
+ key: 'render',
361
+ value: function render() {
362
+ var _this3 = this;
363
+
364
+ var _state = this.state,
365
+ _state$result = _state.result,
366
+ result = _state$result === undefined ? {} : _state$result,
367
+ _state$currentAddress = _state.currentAddress,
368
+ currentAddress = _state$currentAddress === undefined ? '' : _state$currentAddress;
369
+ var _props = this.props,
370
+ form = _props.form,
371
+ _props$required = _props.required,
372
+ required = _props$required === undefined ? true : _props$required,
373
+ title = _props.title;
374
+
375
+ var getFieldProps = form && this.props.form.getFieldProps;
376
+ // let locationNotForm = this.buildLocationNotForm(currentAddress) || undefined
377
+ // let locationForm = this.buildLocationForm(getFieldProps, currentAddress) || undefined
378
+ return _react2.default.createElement(
379
+ 'div',
380
+ null,
381
+ _react2.default.createElement(
382
+ _list2.default,
383
+ null,
384
+ form && _react2.default.createElement(
385
+ _list2.default.Item,
386
+ { wrap: true, multipleLine: true, extra: _react2.default.createElement(
387
+ 'a',
388
+ { onClick: function onClick() {
389
+ _this3.reLocation(_this3.state.key, _this3.transferMsg);
390
+ } },
391
+ !currentAddress ? _react2.default.createElement(_activityIndicator2.default, { animating: true, text: "正在定位..." }) : '重新定位'
392
+ )
393
+ },
394
+ _react2.default.createElement(
395
+ 'div',
396
+ null,
397
+ title
398
+ )
399
+ ),
400
+ _react2.default.createElement(
401
+ _list2.default.Item,
402
+ { wrap: true, multipleLine: true },
403
+ _react2.default.createElement(
404
+ 'div',
405
+ null,
406
+ !form ? this.buildLocationNotForm(currentAddress) || undefined : this.buildLocationForm(getFieldProps, currentAddress) || undefined
407
+ )
408
+ )
409
+ )
410
+ );
411
+ }
412
+ }, {
413
+ key: 'buildLocationForm',
414
+ value: function buildLocationForm(getFieldProps, currentAddress) {
415
+ return _react2.default.createElement(
416
+ 'div',
417
+ { style: { marginTop: '0.4rem' } },
418
+ _react2.default.createElement(_textareaItem2.default, _extends({ autoHeight: true, editable: false, placeholder: "定位信息" }, getFieldProps('mapGeolocation_currentAddress', {
419
+ initialValue: currentAddress
420
+ }))),
421
+ _react2.default.createElement(
422
+ 'div',
423
+ { style: { display: 'none' } },
424
+ _react2.default.createElement(_inputItem2.default, getFieldProps('mapGeolocation_status')),
425
+ _react2.default.createElement(_inputItem2.default, getFieldProps('mapGeolocation_result'))
426
+ )
427
+ );
428
+ }
429
+ }, {
430
+ key: 'buildLocationNotForm',
431
+ value: function buildLocationNotForm(currentAddress) {
432
+ var _this4 = this;
433
+
434
+ //return <span>{currentAddress || <ActivityIndicator animating text={"正在定位..."} />}</span>
435
+ return _react2.default.createElement(
436
+ 'div',
437
+ { style: _style.startBox_style },
438
+ _react2.default.createElement(
439
+ 'div',
440
+ { style: _style.clockBotton_style,
441
+ onClick: function onClick() {
442
+ return _this4.isScope(_this4.state.currentPosition);
443
+ }
444
+ },
445
+ !this.state.confirmScope ? this.props.beforeLocationName || '定位' : this.props.afterLocationName || '定位成功'
446
+ ),
447
+ _react2.default.createElement(
448
+ 'div',
449
+ { style: _style.lcoationbBox_style },
450
+ currentAddress || _react2.default.createElement(_activityIndicator2.default, { animating: true, text: "正在定位..." }),
451
+ _react2.default.createElement(
452
+ 'a',
453
+ { onClick: function onClick() {
454
+ _this4.reLocation(_this4.state.key, _this4.transferMsg);
455
+ } },
456
+ currentAddress && !this.state.confirmScope && '重新定位'
457
+ )
458
+ )
459
+ );
460
+ }
461
+ }]);
462
+
463
+ return NHMapGeolocation;
464
+ }(_react.Component);
465
+
466
+ exports.default = NHMapGeolocation;
467
+
468
+
469
+ function NHMapGeolocationNotFoundException(message) {
470
+ this.message = message;
471
+ this.name = "NHMapGeolocationException";
472
+ }
473
+
474
+ // const startBox_style = {
475
+ // width: '92%',
476
+ // marginLeft: '4%',
477
+ // height: '298px',
478
+ // background: 'rgba(255, 255, 255, 1)',
479
+ // borderRadius: '5px',
480
+ // marginTop: '12px',
481
+ // padding: '18.5px 15px 27.5px 15px',
482
+ // }
483
+
484
+ // const clockBotton_style = {
485
+ // width: '140px',
486
+ // height: '140px',
487
+ // background: 'radial-gradient(circle, rgba(24, 144, 255, 1), rgba(88, 175, 255, 1))',
488
+ // boxShadow: '0px 2px 15px 0px rgba(24, 144, 255, 0.26)',
489
+ // borderRadius: '50%',
490
+ // fontSize: '19px',
491
+ // fontWeight: '500',
492
+ // color: 'rgba(255, 255, 255, 1)',
493
+ // textAlign: 'center',
494
+ // paddingTop: '60px',
495
+ // marginLeft: '50%',
496
+ // transform: 'translateX(-50%)',
497
+ // marginTop: '50px',
498
+ // }
499
+
500
+ // const lcoationbBox_style = {
501
+ // display: 'flex',
502
+ // alignItems: 'center',
503
+ // marginLeft: '50%',
504
+ // transform: 'translateX(-50%)',
505
+ // marginTop: '20px',
506
+ // width: 'fit-content',
507
+ // height: '28px',
508
+ // background: 'rgba(240, 242, 245, 1)',
509
+ // borderRadius: '14px',
510
+ // fontSize: '14px',
511
+ // fontWeight: '400',
512
+ // color: 'rgba(128, 128, 128, 1)',
513
+ // textAlign: 'center',
514
+ // padding: '0 11.5px',
515
+ // whiteSpace: 'nowrap',
516
+ // }
517
+
518
+ var title_style = {
519
+ height: 'fit-content',
520
+ display: 'flex',
521
+ alignItems: 'center'
522
+
523
+ //属性默认值
524
+ };NHMapGeolocation.defaultProps = {
525
+ currentMapType: 'GD', //默认高德地图
526
+ title: '定位地址', //标签名
527
+ required: true, //是否必填
528
+ containCircleFlag: false //是否需要判断定位地址是否存在目标定位范围内
529
+
530
+
531
+ //属性检查
532
+ };NHMapGeolocation.propTypes = {
533
+ currentMapType: _propTypes2.default.string, //当前启用的地图类型【GD:高德地图、TX:腾讯地图】
534
+ title: _propTypes2.default.string,
535
+ required: _propTypes2.default.bool,
536
+ containCircleFlag: _propTypes2.default.bool
537
+ };
@@ -0,0 +1,104 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ /**
7
+ * 参考高德地图 JS API
8
+ * 文档:
9
+ * https://lbs.amap.com/api/javascript-api/guide/services/geolocation
10
+ * https://lbs.amap.com/api/javascript-api/reference/location#m_AMap.Geolocation
11
+ */
12
+
13
+ var js2 = 'https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js';
14
+
15
+ //加载js
16
+ var initGdJS = exports.initGdJS = function initGdJS(key) {
17
+ var gimgSript = document.createElement('script');
18
+ gimgSript.type = 'text/javascript';
19
+ gimgSript.src = js2;
20
+ document.getElementById('root').appendChild(gimgSript);
21
+ return 'https://webapi.amap.com/maps?v=1.4.15&key=' + key + '&plugin=AMap.CircleEditor';
22
+ };
23
+
24
+ var initGdMap = exports.initGdMap = function initGdMap(fn) {
25
+ var map = new AMap.Map('iCenter', {
26
+ resizeEnable: true
27
+ });
28
+ AMap.plugin('AMap.Geolocation', function () {
29
+ var geolocation = new AMap.Geolocation({
30
+ enableHighAccuracy: true, //是否使用高精度定位,默认:true
31
+ timeout: 10000, //超过10秒后停止定位,默认:无穷大
32
+ maximumAge: 0, //定位结果缓存0毫秒,默认:0
33
+ convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
34
+ showButton: true, //显示定位按钮,默认:true
35
+ buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
36
+ buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
37
+ showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
38
+ showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
39
+ panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
40
+ zoomToAccuracy: true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
41
+ });
42
+ map.addControl(geolocation);
43
+ geolocation.getCurrentPosition(function (status, result) {
44
+ var ret = { status: status, data: result };
45
+ if (status == 'complete') {
46
+ onComplete(result, function () {
47
+ return fn(ret);
48
+ });
49
+ } else {
50
+ onError(result, fn(ret));
51
+ }
52
+ });
53
+ });
54
+ };
55
+
56
+ /**
57
+ * 解析定位是否在某范围中
58
+ * @param {当前获取定位位置} targetLat
59
+ * @param {设定好的目标位置} sourceLat
60
+ */
61
+ var containGdCircle = exports.containGdCircle = function containGdCircle(targetLnglat, sourceLnglat, radius) {
62
+ console.log('targetLnglat', targetLnglat, "sourceLnglat", sourceLnglat);
63
+ var lnglat = new AMap.LngLat(targetLnglat.lng, targetLnglat.lat); //当前获取定位位置
64
+ var sourceLnglatSplit = sourceLnglat.split(',');
65
+ var circle = new AMap.Circle({ //目标定位范围
66
+ center: new AMap.LngLat(sourceLnglatSplit[0], sourceLnglatSplit[1]),
67
+ radius: radius, //半径
68
+ zIndex: 50
69
+ });
70
+ var isContain = circle.contains(lnglat);
71
+ if (isContain) {
72
+ console.log("在圆内");
73
+ } else {
74
+ console.log("不在圆内");
75
+ }
76
+ return isContain;
77
+ };
78
+
79
+ //解析定位结果
80
+ function onComplete(data, fn) {
81
+ if (fn) {
82
+ fn();
83
+ }
84
+ return data;
85
+ // document.getElementById('status').innerHTML = '定位成功'
86
+ // console.log(data);
87
+ // var str = [];
88
+ // str.push('定位结果:' + data.position);
89
+ // str.push('定位类别:' + data.location_type);
90
+ // if (data.accuracy) {
91
+ // str.push('精度:' + data.accuracy + ' 米');
92
+ // }//如为IP精确定位结果则没有精度信息
93
+ // str.push('是否经过偏移:' + (data.isConverted ? '是' : '否'));
94
+ // document.getElementById('result').innerHTML = str.join('<br>');
95
+ }
96
+
97
+ //解析定位错误信息
98
+ function onError(data, fn) {
99
+ if (fn) {
100
+ fn();
101
+ }
102
+ // document.getElementById('status').innerHTML = '定位失败'
103
+ // document.getElementById('result').innerHTML = '失败原因排查信息:' + data.message;
104
+ }