dlt-for-react 1.1.3 → 1.1.4
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.
- package/README.md +4 -0
- package/lib/index.js +7 -1
- package/lib/layouts/Top/index.js +1 -1
- package/lib/layouts/layout/index.js +77 -31
- package/lib/layouts/mixTop/index.js +3 -3
- package/lib/utils/createUuid.js +31 -11
- package/lib/utils/getLoginUser.js +1 -1
- package/lib/utils/getSize.js +11 -2
- package/lib/utils/index.js +35 -2
- package/package.json +1 -1
- package/lib/components/Button/index.js +0 -79
- package/lib/components/NHAuditPanel/config/Axios.js +0 -263
- package/lib/components/NHAuditPanel/config/api.js +0 -479
- package/lib/components/NHAuditPanel/config/data.js +0 -156
- package/lib/components/NHAuditPanel/config/typeMap.js +0 -1234
- package/lib/components/NHAuditPanel/config/uiValidate.js +0 -92
- package/lib/components/NHAuditPanel/index.js +0 -413
- package/lib/components/NHAuditPanel/node.js +0 -619
- package/lib/components/NHCascader/index.js +0 -355
- package/lib/components/NHCheckboxGroup/index.js +0 -135
- package/lib/components/NHDynamicFormShow/baseInfo/index.js +0 -194
- package/lib/components/NHDynamicFormShow/custom/index.js +0 -553
- package/lib/components/NHDynamicFormShow/customModule/common/CommonMethod.js +0 -43
- package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/EditForm.js +0 -1113
- package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/index.js +0 -263
- package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/EditForm.js +0 -880
- package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/index.js +0 -171
- package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/EditForm.js +0 -865
- package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/index.js +0 -138
- package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/EditForm.js +0 -571
- package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/index.js +0 -147
- package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/EditForm.js +0 -474
- package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/index.js +0 -139
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/EditForm.js +0 -506
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/index.js +0 -143
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/EditForm.js +0 -1074
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/index.js +0 -172
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/EditForm.js +0 -927
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/index.js +0 -195
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/EditForm.js +0 -1064
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/index.js +0 -183
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/EditForm.js +0 -763
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/index.js +0 -137
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/EditForm.js +0 -819
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/index.js +0 -137
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/EditForm.js +0 -700
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/index.js +0 -162
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/EditForm.js +0 -743
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/index.js +0 -177
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/EditForm.js +0 -848
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/index.js +0 -138
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/EditForm.js +0 -777
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/index.js +0 -161
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/EditForm.js +0 -706
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/index.js +0 -130
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/cfjcEditForm.js +0 -413
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/index.js +0 -135
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/EditForm.js +0 -1013
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/index.js +0 -175
- package/lib/components/NHDynamicFormShow/customModule/jjrlx/EditForm.js +0 -1345
- package/lib/components/NHDynamicFormShow/customModule/jjrlx/index.js +0 -274
- package/lib/components/NHDynamicFormShow/customModule/jxj/EditForm.js +0 -669
- package/lib/components/NHDynamicFormShow/customModule/jxj/index.js +0 -134
- package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/EditForm.js +0 -378
- package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/index.js +0 -120
- package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/EditForm.js +0 -638
- package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/index.js +0 -133
- package/lib/components/NHDynamicFormShow/customModule/qgzx/EditForm.js +0 -965
- package/lib/components/NHDynamicFormShow/customModule/qgzx/index.js +0 -237
- package/lib/components/NHDynamicFormShow/customModule/qjgl/EditForm.js +0 -823
- package/lib/components/NHDynamicFormShow/customModule/qjgl/index.js +0 -188
- package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/EditForm.js +0 -401
- package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/index.js +0 -472
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/EditForm.js +0 -304
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHCascader/index.js +0 -375
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/RadioGroup.js +0 -118
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/index.js +0 -62
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/input-const.js +0 -55
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/render.js +0 -1238
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/index.js +0 -375
- package/lib/components/NHDynamicFormShow/customModule/rych/collective/EditForm.js +0 -554
- package/lib/components/NHDynamicFormShow/customModule/rych/collective/index.js +0 -130
- package/lib/components/NHDynamicFormShow/customModule/rych/personal/EditForm.js +0 -542
- package/lib/components/NHDynamicFormShow/customModule/rych/personal/index.js +0 -133
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/EditForm.js +0 -575
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/index.js +0 -130
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/EditForm.js +0 -563
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/index.js +0 -133
- package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/EditForm.js +0 -745
- package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/index.js +0 -164
- package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/EditForm.js +0 -587
- package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/index.js +0 -143
- package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/EditForm.js +0 -743
- package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/index.js +0 -172
- package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/EditForm.js +0 -1410
- package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/index.js +0 -274
- package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/EditForm.js +0 -755
- package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/index.js +0 -130
- package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/EditForm.js +0 -814
- package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/index.js +0 -188
- package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/EditForm.js +0 -769
- package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/index.js +0 -130
- package/lib/components/NHDynamicFormShow/customModule/whgcrych/EditForm.js +0 -1004
- package/lib/components/NHDynamicFormShow/customModule/whgcrych/index.js +0 -126
- package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/EditForm.js +0 -503
- package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/index.js +0 -149
- package/lib/components/NHDynamicFormShow/customModule/whtlyhk/EditForm.js +0 -379
- package/lib/components/NHDynamicFormShow/customModule/whtlyhk/index.js +0 -148
- package/lib/components/NHDynamicFormShow/customModule/whtlzxj/EditForm.js +0 -748
- package/lib/components/NHDynamicFormShow/customModule/whtlzxj/index.js +0 -135
- package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/EditForm.js +0 -762
- package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/index.js +0 -134
- package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/cfjcEditForm.js +0 -682
- package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/index.js +0 -135
- package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/index.js +0 -152
- package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/wjsbEditForm.js +0 -783
- package/lib/components/NHDynamicFormShow/customModule/zxj/EditForm.js +0 -764
- package/lib/components/NHDynamicFormShow/customModule/zxj/index.js +0 -138
- package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/cfjcEditForm.js +0 -677
- package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/index.js +0 -138
- package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/EditForm.js +0 -1173
- package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/index.js +0 -242
- package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistForm.js +0 -862
- package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistIndex.js +0 -201
- package/lib/components/NHDynamicFormShow/customModule/zzsd/stuinfo/messageInfo.js +0 -196
- package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/index.js +0 -167
- package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/wjsbEditForm.js +0 -1096
- package/lib/components/NHDynamicFormShow/index.js +0 -647
- package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/cardItem/index.js +0 -279
- package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/index.js +0 -206
- package/lib/components/NHDynamicFormShow/oneOnMany/index.js +0 -419
- package/lib/components/NHDynamicFormShow/oneOnOne/EditForm.js +0 -401
- package/lib/components/NHDynamicFormShow/oneOnOne/index.js +0 -271
- package/lib/components/NHImagePicker/index.js +0 -554
- package/lib/components/NHInputPicker/RadioGroup.js +0 -118
- package/lib/components/NHInputPicker/index.js +0 -62
- package/lib/components/NHInputPicker/input-const.js +0 -55
- package/lib/components/NHInputPicker/render.js +0 -1271
- package/lib/components/NHListView/index.js +0 -374
- package/lib/components/NHMapGeolocation/index.js +0 -537
- package/lib/components/NHMapGeolocation/initMap/initGdMap.js +0 -104
- package/lib/components/NHMapGeolocation/initMap/initTencentMap.js +0 -138
- package/lib/components/NHMapGeolocation/style.js +0 -51
- package/lib/components/NHMultiSelect/index.js +0 -272
- package/lib/components/NHRadioGroup/index.js +0 -118
- package/lib/components/NHSelect/index.js +0 -364
- package/lib/components/NHTreeMenu/index.js +0 -126
- package/lib/components/NHTreeMenu/treeNode.js +0 -164
- package/lib/components/StuSelector/index.js +0 -611
- package/lib/layouts/KyInputPicker/edit-page.js +0 -585
- package/lib/layouts/KyInputPicker/index.js +0 -220
- package/lib/layouts/KyInputPicker/input-const.js +0 -134
- package/lib/layouts/KyInputPicker/render.js +0 -2477
- package/lib/layouts/KyInputPicker/setting-checkbox.js +0 -850
- package/lib/layouts/KyInputPicker/setting-datepicker.js +0 -430
- package/lib/layouts/KyInputPicker/setting-datetimepicker.js +0 -443
- package/lib/layouts/KyInputPicker/setting-input.js +0 -555
- package/lib/layouts/KyInputPicker/setting-inputNumber.js +0 -612
- package/lib/layouts/KyInputPicker/setting-monthpicker.js +0 -434
- package/lib/layouts/KyInputPicker/setting-multiSelect.js +0 -532
- package/lib/layouts/KyInputPicker/setting-nhcascader.js +0 -584
- package/lib/layouts/KyInputPicker/setting-old-upload.js +0 -428
- package/lib/layouts/KyInputPicker/setting-radio.js +0 -468
- package/lib/layouts/KyInputPicker/setting-rangepicker.js +0 -466
- package/lib/layouts/KyInputPicker/setting-select.js +0 -534
- package/lib/layouts/KyInputPicker/setting-stu-selector.js +0 -507
- package/lib/layouts/KyInputPicker/setting-switch.js +0 -274
- package/lib/layouts/KyInputPicker/setting-tea-selector.js +0 -507
- package/lib/layouts/KyInputPicker/setting-textarea.js +0 -619
- package/lib/layouts/KyInputPicker/setting-timepicker.js +0 -437
- package/lib/layouts/KyInputPicker/setting-upload.js +0 -766
- package/lib/layouts/KyModal/buildTitle.js +0 -81
- package/lib/layouts/KyModal/dragM.js +0 -127
- package/lib/layouts/KyModal/index.js +0 -321
- package/lib/layouts/KyPreview/index.js +0 -219
- package/lib/layouts/KyUpload/index.js +0 -1155
- package/lib/utils/browserJudge.js +0 -33
- package/lib/utils/dynamicLoadCss.js +0 -14
- package/lib/utils/dynamicLoadJs.js +0 -21
- package/lib/utils/getStyle.js +0 -26
- package/lib/utils/getSuitHeight.js +0 -49
- package/lib/utils/hasAuth.js +0 -11
- package/lib/utils/loadJS.js +0 -40
- /package/lib/layouts/{login → Login}/index-pre.js +0 -0
- /package/lib/layouts/{login → Login}/index.js +0 -0
- /package/lib/layouts/{login → Login}/login.js +0 -0
- /package/lib/layouts/{login → Login}/lyPassword.js +0 -0
|
@@ -1,537 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,104 +0,0 @@
|
|
|
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
|
-
}
|