@smart100/spu-web-plugin 1.0.8 → 1.0.10

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.
@@ -1,4 +1,4 @@
1
- var version = "1.0.8";
1
+ var version = "1.0.10";
2
2
 
3
3
  /** Detect free variable `global` from Node.js. */
4
4
  var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
@@ -4139,63 +4139,6 @@ function getAugmentedNamespace(n) {
4139
4139
  return a;
4140
4140
  }
4141
4141
 
4142
- var dist = {exports: {}};
4143
-
4144
- (function (module, exports) {
4145
- (function(m,p){module.exports=p();})(commonjsGlobal,function(){function m(a){var b=[];a.AMapUI&&b.push(p(a.AMapUI));a.Loca&&b.push(r(a.Loca));return Promise.all(b)}function p(a){return new Promise(function(h,c){var f=[];if(a.plugins)for(var e=0;e<a.plugins.length;e+=1)-1==d.AMapUI.plugins.indexOf(a.plugins[e])&&f.push(a.plugins[e]);if(g.AMapUI===b.failed)c("\u524d\u6b21\u8bf7\u6c42 AMapUI \u5931\u8d25");
4146
- else if(g.AMapUI===b.notload){g.AMapUI=b.loading;d.AMapUI.version=a.version||d.AMapUI.version;e=d.AMapUI.version;var l=document.body||document.head,k=document.createElement("script");k.type="text/javascript";k.src="https://webapi.amap.com/ui/"+e+"/main.js";k.onerror=function(a){g.AMapUI=b.failed;c("\u8bf7\u6c42 AMapUI \u5931\u8d25");};k.onload=function(){g.AMapUI=b.loaded;if(f.length)window.AMapUI.loadUI(f,function(){for(var a=0,b=f.length;a<b;a++){var c=f[a].split("/").slice(-1)[0];window.AMapUI[c]=
4147
- arguments[a];}for(h();n.AMapUI.length;)n.AMapUI.splice(0,1)[0]();});else for(h();n.AMapUI.length;)n.AMapUI.splice(0,1)[0]();};l.appendChild(k);}else g.AMapUI===b.loaded?a.version&&a.version!==d.AMapUI.version?c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c AMapUI \u6df7\u7528"):f.length?window.AMapUI.loadUI(f,function(){for(var a=0,b=f.length;a<b;a++){var c=f[a].split("/").slice(-1)[0];window.AMapUI[c]=arguments[a];}h();}):h():a.version&&a.version!==d.AMapUI.version?c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c AMapUI \u6df7\u7528"):
4148
- n.AMapUI.push(function(a){a?c(a):f.length?window.AMapUI.loadUI(f,function(){for(var a=0,b=f.length;a<b;a++){var c=f[a].split("/").slice(-1)[0];window.AMapUI[c]=arguments[a];}h();}):h();});})}function r(a){return new Promise(function(h,c){if(g.Loca===b.failed)c("\u524d\u6b21\u8bf7\u6c42 Loca \u5931\u8d25");else if(g.Loca===b.notload){g.Loca=b.loading;d.Loca.version=a.version||d.Loca.version;var f=d.Loca.version,e=d.AMap.version.startsWith("2"),l=f.startsWith("2");if(e&&!l||!e&&l)c("JSAPI \u4e0e Loca \u7248\u672c\u4e0d\u5bf9\u5e94\uff01\uff01");
4149
- else {e=d.key;l=document.body||document.head;var k=document.createElement("script");k.type="text/javascript";k.src="https://webapi.amap.com/loca?v="+f+"&key="+e;k.onerror=function(a){g.Loca=b.failed;c("\u8bf7\u6c42 AMapUI \u5931\u8d25");};k.onload=function(){g.Loca=b.loaded;for(h();n.Loca.length;)n.Loca.splice(0,1)[0]();};l.appendChild(k);}}else g.Loca===b.loaded?a.version&&a.version!==d.Loca.version?c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c Loca \u6df7\u7528"):h():a.version&&a.version!==d.Loca.version?
4150
- c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c Loca \u6df7\u7528"):n.Loca.push(function(a){a?c(a):c();});})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var b;(function(a){a.notload="notload";a.loading="loading";a.loaded="loaded";a.failed="failed";})(b||(b={}));var d={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},g={AMap:b.notload,AMapUI:b.notload,Loca:b.notload},n={AMap:[],AMapUI:[],Loca:[]},q=[],t=function(a){"function"==typeof a&&
4151
- (g.AMap===b.loaded?a(window.AMap):q.push(a));};return {load:function(a){return new Promise(function(h,c){if(g.AMap==b.failed)c("");else if(g.AMap==b.notload){var f=a.key,e=a.version,l=a.plugins;f?(window.AMap&&"lbs.amap.com"!==location.host&&c("\u7981\u6b62\u591a\u79cdAPI\u52a0\u8f7d\u65b9\u5f0f\u6df7\u7528"),d.key=f,d.AMap.version=e||d.AMap.version,d.AMap.plugins=l||d.AMap.plugins,g.AMap=b.loading,e=document.body||document.head,window.___onAPILoaded=function(d){delete window.___onAPILoaded;if(d)g.AMap=
4152
- b.failed,c(d);else for(g.AMap=b.loaded,m(a).then(function(){h(window.AMap);})["catch"](c);q.length;)q.splice(0,1)[0]();},l=document.createElement("script"),l.type="text/javascript",l.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+d.AMap.version+"&key="+f+"&plugin="+d.AMap.plugins.join(","),l.onerror=function(a){g.AMap=b.failed;c(a);},e.appendChild(l)):c("\u8bf7\u586b\u5199key");}else if(g.AMap==b.loaded)if(a.key&&a.key!==d.key)c("\u591a\u4e2a\u4e0d\u4e00\u81f4\u7684 key");else if(a.version&&
4153
- a.version!==d.AMap.version)c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c JSAPI \u6df7\u7528");else {f=[];if(a.plugins)for(e=0;e<a.plugins.length;e+=1)-1==d.AMap.plugins.indexOf(a.plugins[e])&&f.push(a.plugins[e]);if(f.length)window.AMap.plugin(f,function(){m(a).then(function(){h(window.AMap);})["catch"](c);});else m(a).then(function(){h(window.AMap);})["catch"](c);}else if(a.key&&a.key!==d.key)c("\u591a\u4e2a\u4e0d\u4e00\u81f4\u7684 key");else if(a.version&&a.version!==d.AMap.version)c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c JSAPI \u6df7\u7528");
4154
- else {var k=[];if(a.plugins)for(e=0;e<a.plugins.length;e+=1)-1==d.AMap.plugins.indexOf(a.plugins[e])&&k.push(a.plugins[e]);t(function(){if(k.length)window.AMap.plugin(k,function(){m(a).then(function(){h(window.AMap);})["catch"](c);});else m(a).then(function(){h(window.AMap);})["catch"](c);});}})},reset:function(){delete window.AMap;delete window.AMapUI;delete window.Loca;d={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}};g={AMap:b.notload,AMapUI:b.notload,
4155
- Loca:b.notload};n={AMap:[],AMapUI:[],Loca:[]};}}});
4156
- } (dist));
4157
-
4158
- var distExports = dist.exports;
4159
- var AMapLoader$1 = /*@__PURE__*/getDefaultExportFromCjs(distExports);
4160
-
4161
- // 高德地图 web端key 和 安全密钥
4162
- var amapKey = {
4163
- // 测试开发环境
4164
- dev: {
4165
- key: '38fa4702d240e1e6ee5cc8ca059b254f',
4166
- securityjscode: '96f2af5670b7a41a56dcd2e8b63c1e06'
4167
- },
4168
- // 生产环境
4169
- production: {
4170
- key: '1993ac213d2f4675ac1bffb1b03ef1f0',
4171
- securityjscode: '816fe46b7b7bce145940b93c1e4818fa'
4172
- }
4173
- };
4174
- // const amapkey = process.env.NODE_ENV !== 'production' ? amapKey.dev.key : amapKey.production.key
4175
- // const amapsecurityjscode = process.env.NODE_ENV !== 'production' ? amapKey.dev.securityjscode : amapKey.production.securityjscode
4176
- var amapkey = amapKey.production.key;
4177
- var amapsecurityjscode = amapKey.production.securityjscode;
4178
- var load = function load(options) {
4179
- var _options$AMapUI;
4180
- if (!window._AMapSecurityConfig) {
4181
- window._AMapSecurityConfig = {
4182
- securityJsCode: amapsecurityjscode
4183
- };
4184
- }
4185
- return AMapLoader$1.load({
4186
- key: amapkey,
4187
- version: '2.0',
4188
- plugins: (options === null || options === void 0 ? void 0 : options.plugins) || [],
4189
- AMapUI: {
4190
- version: '1.1',
4191
- plugins: (options === null || options === void 0 || (_options$AMapUI = options.AMapUI) === null || _options$AMapUI === void 0 ? void 0 : _options$AMapUI.plugins) || []
4192
- }
4193
- });
4194
- };
4195
- var AMapLoader = {
4196
- load: load
4197
- };
4198
-
4199
4142
  var vconsole_min = {exports: {}};
4200
4143
 
4201
4144
  /*!
@@ -16139,6 +16082,107 @@ function decrypt(base64) {
16139
16082
  return result;
16140
16083
  }
16141
16084
 
16085
+ var TenantSetting = /*#__PURE__*/function () {
16086
+ function TenantSetting() {
16087
+ _classCallCheck$1(this, TenantSetting);
16088
+ }
16089
+ _createClass$1(TenantSetting, [{
16090
+ key: "requestAndSetTenantSetting",
16091
+ value: function () {
16092
+ var _requestAndSetTenantSetting = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(tenantcode) {
16093
+ var _res$data, res, _tenantSetting;
16094
+ return _regeneratorRuntime$1().wrap(function _callee$(_context) {
16095
+ while (1) switch (_context.prev = _context.next) {
16096
+ case 0:
16097
+ _context.prev = 0;
16098
+ _context.next = 3;
16099
+ return normalAxios$1.post('/api/auth/tenantsettings', {
16100
+ tenantcode: tenantcode || ''
16101
+ }, {
16102
+ isSendToken: false,
16103
+ isSendTecode: true,
16104
+ isShowErrorMessage: false
16105
+ });
16106
+ case 3:
16107
+ res = _context.sent;
16108
+ _tenantSetting = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.econfig) || '';
16109
+ if (_tenantSetting) {
16110
+ _tenantSetting = decrypt(_tenantSetting);
16111
+ }
16112
+ // console.log(tenantSetting)
16113
+ // debugger
16114
+ if (_tenantSetting) {
16115
+ lsProxy.setItem('tenantsetting', _tenantSetting);
16116
+ } else {
16117
+ this.removeTenantSetting();
16118
+ }
16119
+ _context.next = 13;
16120
+ break;
16121
+ case 9:
16122
+ _context.prev = 9;
16123
+ _context.t0 = _context["catch"](0);
16124
+ console.error(_context.t0);
16125
+ this.removeTenantSetting();
16126
+ case 13:
16127
+ case "end":
16128
+ return _context.stop();
16129
+ }
16130
+ }, _callee, this, [[0, 9]]);
16131
+ }));
16132
+ function requestAndSetTenantSetting(_x) {
16133
+ return _requestAndSetTenantSetting.apply(this, arguments);
16134
+ }
16135
+ return requestAndSetTenantSetting;
16136
+ }()
16137
+ }, {
16138
+ key: "removeTenantSetting",
16139
+ value: function removeTenantSetting() {
16140
+ lsProxy.removeItem('tenantsetting');
16141
+ }
16142
+ }, {
16143
+ key: "get",
16144
+ value: function get(key) {
16145
+ var tenantsettingStr = lsProxy.getItem('tenantsetting');
16146
+ if (tenantsettingStr) {
16147
+ var tenantsetting = JSON.parse(tenantsettingStr);
16148
+ // tenantsetting.lbssetting = {
16149
+ // enable: '1',
16150
+ // setting: {
16151
+ // type: '',
16152
+ // key: {
16153
+ // web: '',
16154
+ // android: '',
16155
+ // ios: '',
16156
+ // harmony: ''
16157
+ // },
16158
+ // secretkey: {
16159
+ // web: '',
16160
+ // android: '',
16161
+ // ios: '',
16162
+ // harmony: ''
16163
+ // }
16164
+ // }
16165
+ // }
16166
+ // tenantsetting.lbssetting.setting.type = 'amap'
16167
+ // tenantsetting.lbssetting.setting.key.web = '1993ac213d2f4675ac1bffb1b03ef1f0'
16168
+ // tenantsetting.lbssetting.setting.secretkey.web = '816fe46b7b7bce145940b93c1e4818fa'
16169
+ // tenantsetting.lbssetting.setting.type = 'tencent'
16170
+ // tenantsetting.lbssetting.setting.key.web = 'NHBBZ-K5LCQ-LF35M-2CTDP-E4OO7-AIBFT'
16171
+ // tenantsetting.lbssetting.setting.type = 'baidu'
16172
+ // tenantsetting.lbssetting.setting.key.web = '7r3bsPeQqJ74vsxf3EOXg7C1AM4lOWA1'
16173
+ if (key) {
16174
+ return tenantsetting[key];
16175
+ }
16176
+ return tenantsetting;
16177
+ } else {
16178
+ return null;
16179
+ }
16180
+ }
16181
+ }]);
16182
+ return TenantSetting;
16183
+ }();
16184
+ var tenantSetting = new TenantSetting();
16185
+
16142
16186
  function getToken() {
16143
16187
  return getData('token');
16144
16188
  // return lsProxy.getItem('token') as string
@@ -16483,54 +16527,6 @@ function _getAndSetTenant() {
16483
16527
  }));
16484
16528
  return _getAndSetTenant.apply(this, arguments);
16485
16529
  }
16486
- function requestAndSetTenantSetting(_x2) {
16487
- return _requestAndSetTenantSetting.apply(this, arguments);
16488
- }
16489
- function _requestAndSetTenantSetting() {
16490
- _requestAndSetTenantSetting = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(tenantcode) {
16491
- var _res$data2, res, tenantSetting;
16492
- return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
16493
- while (1) switch (_context5.prev = _context5.next) {
16494
- case 0:
16495
- _context5.prev = 0;
16496
- _context5.next = 3;
16497
- return normalAxios$1.post('/api/auth/tenantsettings', {
16498
- tenantcode: tenantcode || ''
16499
- }, {
16500
- isSendToken: false,
16501
- isSendTecode: true,
16502
- isShowErrorMessage: false
16503
- });
16504
- case 3:
16505
- res = _context5.sent;
16506
- tenantSetting = (res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 || (_res$data2 = _res$data2.resp_data) === null || _res$data2 === void 0 ? void 0 : _res$data2.econfig) || '';
16507
- if (tenantSetting) {
16508
- tenantSetting = decrypt(tenantSetting);
16509
- }
16510
- // console.log(tenantSetting)
16511
- if (tenantSetting) {
16512
- lsProxy.setItem('tenantsetting', tenantSetting);
16513
- } else {
16514
- removeTenantSetting();
16515
- }
16516
- _context5.next = 13;
16517
- break;
16518
- case 9:
16519
- _context5.prev = 9;
16520
- _context5.t0 = _context5["catch"](0);
16521
- console.error(_context5.t0);
16522
- removeTenantSetting();
16523
- case 13:
16524
- case "end":
16525
- return _context5.stop();
16526
- }
16527
- }, _callee5, null, [[0, 9]]);
16528
- }));
16529
- return _requestAndSetTenantSetting.apply(this, arguments);
16530
- }
16531
- function removeTenantSetting() {
16532
- lsProxy.removeItem('tenantsetting');
16533
- }
16534
16530
  function updateToken() {
16535
16531
  var loginState = getLoginState();
16536
16532
  if (!loginState.islogin && loginState.type <= 1) {
@@ -16597,7 +16593,7 @@ function startRefreshtoken() {
16597
16593
  if (loginState.type === 2) {
16598
16594
  time = 0;
16599
16595
  } else {
16600
- console.error('未登录,10秒后尝试更新token');
16596
+ // console.error('未登录,10秒后尝试更新token')
16601
16597
  time = 30000;
16602
16598
  }
16603
16599
  }
@@ -16622,14 +16618,14 @@ function startRefreshtoken() {
16622
16618
  })), time);
16623
16619
  }
16624
16620
  // 单点登录
16625
- function singleLogin(_x3) {
16621
+ function singleLogin(_x2) {
16626
16622
  return _singleLogin.apply(this, arguments);
16627
16623
  }
16628
16624
  function _singleLogin() {
16629
- _singleLogin = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6(query) {
16625
+ _singleLogin = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(query) {
16630
16626
  var flag, token, refreshtoken, tokenexpires, envname, context, setBaseInfo, isneedlogin, loginRole, refreshTokenUser, tokenUser, nowEnvname, envData;
16631
- return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
16632
- while (1) switch (_context6.prev = _context6.next) {
16627
+ return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
16628
+ while (1) switch (_context5.prev = _context5.next) {
16633
16629
  case 0:
16634
16630
  setBaseInfo = function _setBaseInfo() {
16635
16631
  setToken(token);
@@ -16649,7 +16645,7 @@ function _singleLogin() {
16649
16645
  envname = query.envname;
16650
16646
  context = query.context;
16651
16647
  if (!checkLoginByToken(token)) {
16652
- _context6.next = 60;
16648
+ _context5.next = 60;
16653
16649
  break;
16654
16650
  }
16655
16651
  isneedlogin = true; // 是否需要走单点登录流程
@@ -16671,91 +16667,91 @@ function _singleLogin() {
16671
16667
  // isneedlogin = true
16672
16668
  // debugger
16673
16669
  if (!isneedlogin) {
16674
- _context6.next = 58;
16670
+ _context5.next = 58;
16675
16671
  break;
16676
16672
  }
16677
16673
  setBaseInfo();
16678
16674
  // 单点登录写入 token 之后
16679
16675
  // 1、如果 refreshtoken 不完整 则换取完整的 refreshtoken
16680
- _context6.prev = 14;
16676
+ _context5.prev = 14;
16681
16677
  if (!checkLogin()) {
16682
- _context6.next = 21;
16678
+ _context5.next = 21;
16683
16679
  break;
16684
16680
  }
16685
16681
  refreshTokenUser = getUserByToken(getRefreshToken());
16686
16682
  tokenUser = getUserByToken(getToken());
16687
16683
  if (!(!(refreshTokenUser !== null && refreshTokenUser !== void 0 && refreshTokenUser.tokenId) && tokenUser !== null && tokenUser !== void 0 && tokenUser.tokenId)) {
16688
- _context6.next = 21;
16684
+ _context5.next = 21;
16689
16685
  break;
16690
16686
  }
16691
- _context6.next = 21;
16687
+ _context5.next = 21;
16692
16688
  return updateToken();
16693
16689
  case 21:
16694
- _context6.next = 26;
16690
+ _context5.next = 26;
16695
16691
  break;
16696
16692
  case 23:
16697
- _context6.prev = 23;
16698
- _context6.t0 = _context6["catch"](14);
16699
- console.error(_context6.t0);
16693
+ _context5.prev = 23;
16694
+ _context5.t0 = _context5["catch"](14);
16695
+ console.error(_context5.t0);
16700
16696
  case 26:
16701
16697
  // 2、重新计算刷新 token 时间 因为刚开始进入就 startRefreshtoken 检测到没有 token 会过10秒才执行刷新 token 操作
16702
16698
  startRefreshtoken();
16703
16699
  // 获取环境信息和租户配置信息
16704
- _context6.next = 29;
16700
+ _context5.next = 29;
16705
16701
  return getEnvname();
16706
16702
  case 29:
16707
- nowEnvname = _context6.sent;
16703
+ nowEnvname = _context5.sent;
16708
16704
  if (!nowEnvname) {
16709
- _context6.next = 50;
16705
+ _context5.next = 50;
16710
16706
  break;
16711
16707
  }
16712
- _context6.next = 33;
16708
+ _context5.next = 33;
16713
16709
  return requestEnvdata(nowEnvname);
16714
16710
  case 33:
16715
- envData = _context6.sent;
16711
+ envData = _context5.sent;
16716
16712
  if (!envData) {
16717
- _context6.next = 46;
16713
+ _context5.next = 46;
16718
16714
  break;
16719
16715
  }
16720
16716
  saveEnvdata(envData);
16721
16717
  if (!envData.tenantcode) {
16722
- _context6.next = 42;
16718
+ _context5.next = 42;
16723
16719
  break;
16724
16720
  }
16725
16721
  setTecode(envData.tenantcode);
16726
16722
  // 租户配置
16727
- _context6.next = 40;
16728
- return requestAndSetTenantSetting(envData.tenantcode);
16723
+ _context5.next = 40;
16724
+ return tenantSetting.requestAndSetTenantSetting(envData.tenantcode);
16729
16725
  case 40:
16730
- _context6.next = 44;
16726
+ _context5.next = 44;
16731
16727
  break;
16732
16728
  case 42:
16733
- removeTenantSetting();
16729
+ tenantSetting.removeTenantSetting();
16734
16730
  removeTecode();
16735
16731
  case 44:
16736
- _context6.next = 48;
16732
+ _context5.next = 48;
16737
16733
  break;
16738
16734
  case 46:
16739
16735
  removeEnvdata();
16740
16736
  removeTecode();
16741
16737
  case 48:
16742
- _context6.next = 52;
16738
+ _context5.next = 52;
16743
16739
  break;
16744
16740
  case 50:
16745
16741
  removeEnvdata();
16746
16742
  removeTecode();
16747
16743
  case 52:
16748
- _context6.next = 54;
16744
+ _context5.next = 54;
16749
16745
  return getAndSetTenant();
16750
16746
  case 54:
16751
- _context6.next = 56;
16747
+ _context5.next = 56;
16752
16748
  return getAndSetUserInfo();
16753
16749
  case 56:
16754
16750
  // 单点登录后 获取 web 开发者模式 如果是则设置 isdebugger
16755
16751
  urlquery.dealWebDebugger();
16756
16752
  flag = true;
16757
16753
  case 58:
16758
- _context6.next = 63;
16754
+ _context5.next = 63;
16759
16755
  break;
16760
16756
  case 60:
16761
16757
  flag = false;
@@ -16763,10 +16759,10 @@ function _singleLogin() {
16763
16759
  console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires 是否非法或过期。');
16764
16760
  case 63:
16765
16761
  if (!flag) {
16766
- _context6.next = 66;
16762
+ _context5.next = 66;
16767
16763
  break;
16768
16764
  }
16769
- _context6.next = 66;
16765
+ _context5.next = 66;
16770
16766
  return core$1.initGetData();
16771
16767
  case 66:
16772
16768
  if (flag) {
@@ -16777,15 +16773,15 @@ function _singleLogin() {
16777
16773
  envname && delete query.envname;
16778
16774
  context && delete query.context;
16779
16775
  }
16780
- return _context6.abrupt("return", {
16776
+ return _context5.abrupt("return", {
16781
16777
  flag: flag,
16782
16778
  query: query
16783
16779
  });
16784
16780
  case 68:
16785
16781
  case "end":
16786
- return _context6.stop();
16782
+ return _context5.stop();
16787
16783
  }
16788
- }, _callee6, null, [[14, 23]]);
16784
+ }, _callee5, null, [[14, 23]]);
16789
16785
  }));
16790
16786
  return _singleLogin.apply(this, arguments);
16791
16787
  }
@@ -16826,7 +16822,7 @@ function installAuth(options) {
16826
16822
  }
16827
16823
  }, _callee2);
16828
16824
  }));
16829
- return function (_x4, _x5, _x6) {
16825
+ return function (_x3, _x4, _x5) {
16830
16826
  return _ref2.apply(this, arguments);
16831
16827
  };
16832
16828
  }());
@@ -16912,6 +16908,44 @@ function toggleHttpOrHttps(url) {
16912
16908
  }
16913
16909
  return res;
16914
16910
  }
16911
+ var urlMap = new Map();
16912
+ function importJS(url) {
16913
+ var attrName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
16914
+ var p = urlMap.get(url);
16915
+ if (p) {
16916
+ return p.then(function () {
16917
+ return Promise.resolve(attrName ? get$1(window, attrName) : undefined);
16918
+ });
16919
+ }
16920
+ var script = document.createElement('script');
16921
+ script.setAttribute('type', 'text/javascript');
16922
+ script.setAttribute('src', url);
16923
+ document.getElementsByTagName('head')[0].appendChild(script);
16924
+ p = new Promise(function (resolve, reject) {
16925
+ script.onload = script.onreadystatechange = function () {
16926
+ var f = script.readyState;
16927
+ if (f && f !== 'loaded' && f !== 'complete') return;
16928
+ script.onload = script.onreadystatechange = null;
16929
+ resolve(undefined);
16930
+ };
16931
+ script.onerror = function () {
16932
+ return reject(new Error('加载失败'));
16933
+ };
16934
+ });
16935
+ urlMap.set(url, p);
16936
+ // console.log('importJS:', url, attrName)
16937
+ return p.then(function () {
16938
+ return Promise.resolve(attrName ? get$1(window, attrName) : undefined);
16939
+ });
16940
+ }
16941
+ var delay = function delay() {
16942
+ var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
16943
+ return new Promise(function (resolve) {
16944
+ setTimeout(function () {
16945
+ resolve(null);
16946
+ }, timeout);
16947
+ });
16948
+ };
16915
16949
 
16916
16950
  var Urlquery = /*#__PURE__*/function () {
16917
16951
  function Urlquery() {
@@ -16987,347 +17021,1260 @@ function installUrlquery() {
16987
17021
  urlquery.init();
16988
17022
  }
16989
17023
 
16990
- var AMap = null;
16991
- var geocoder = null;
16992
- var geolocation = null;
17024
+ // 高德地图 web端key 和 安全密钥
17025
+ var AMapKey = {
17026
+ // 测试开发环境
17027
+ dev: {
17028
+ key: '38fa4702d240e1e6ee5cc8ca059b254f',
17029
+ securityJsCode: '96f2af5670b7a41a56dcd2e8b63c1e06'
17030
+ },
17031
+ // 生产环境
17032
+ production: {
17033
+ key: '1993ac213d2f4675ac1bffb1b03ef1f0',
17034
+ securityJsCode: '816fe46b7b7bce145940b93c1e4818fa'
17035
+ }
17036
+ };
17037
+ var getAMapKey = function getAMapKey() {
17038
+ if (mapService.isLbssettingEnable && mapService.type === 'amap') {
17039
+ return {
17040
+ key: mapService.key,
17041
+ securityJsCode: mapService.secretkey
17042
+ };
17043
+ } else {
17044
+ return {
17045
+ key: AMapKey.production.key,
17046
+ securityJsCode: AMapKey.production.securityJsCode
17047
+ };
17048
+ }
17049
+ };
17050
+
17051
+ var dist = {exports: {}};
17052
+
17053
+ (function (module, exports) {
17054
+ (function(m,p){module.exports=p();})(commonjsGlobal,function(){function m(a){var b=[];a.AMapUI&&b.push(p(a.AMapUI));a.Loca&&b.push(r(a.Loca));return Promise.all(b)}function p(a){return new Promise(function(h,c){var f=[];if(a.plugins)for(var e=0;e<a.plugins.length;e+=1)-1==d.AMapUI.plugins.indexOf(a.plugins[e])&&f.push(a.plugins[e]);if(g.AMapUI===b.failed)c("\u524d\u6b21\u8bf7\u6c42 AMapUI \u5931\u8d25");
17055
+ else if(g.AMapUI===b.notload){g.AMapUI=b.loading;d.AMapUI.version=a.version||d.AMapUI.version;e=d.AMapUI.version;var l=document.body||document.head,k=document.createElement("script");k.type="text/javascript";k.src="https://webapi.amap.com/ui/"+e+"/main.js";k.onerror=function(a){g.AMapUI=b.failed;c("\u8bf7\u6c42 AMapUI \u5931\u8d25");};k.onload=function(){g.AMapUI=b.loaded;if(f.length)window.AMapUI.loadUI(f,function(){for(var a=0,b=f.length;a<b;a++){var c=f[a].split("/").slice(-1)[0];window.AMapUI[c]=
17056
+ arguments[a];}for(h();n.AMapUI.length;)n.AMapUI.splice(0,1)[0]();});else for(h();n.AMapUI.length;)n.AMapUI.splice(0,1)[0]();};l.appendChild(k);}else g.AMapUI===b.loaded?a.version&&a.version!==d.AMapUI.version?c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c AMapUI \u6df7\u7528"):f.length?window.AMapUI.loadUI(f,function(){for(var a=0,b=f.length;a<b;a++){var c=f[a].split("/").slice(-1)[0];window.AMapUI[c]=arguments[a];}h();}):h():a.version&&a.version!==d.AMapUI.version?c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c AMapUI \u6df7\u7528"):
17057
+ n.AMapUI.push(function(a){a?c(a):f.length?window.AMapUI.loadUI(f,function(){for(var a=0,b=f.length;a<b;a++){var c=f[a].split("/").slice(-1)[0];window.AMapUI[c]=arguments[a];}h();}):h();});})}function r(a){return new Promise(function(h,c){if(g.Loca===b.failed)c("\u524d\u6b21\u8bf7\u6c42 Loca \u5931\u8d25");else if(g.Loca===b.notload){g.Loca=b.loading;d.Loca.version=a.version||d.Loca.version;var f=d.Loca.version,e=d.AMap.version.startsWith("2"),l=f.startsWith("2");if(e&&!l||!e&&l)c("JSAPI \u4e0e Loca \u7248\u672c\u4e0d\u5bf9\u5e94\uff01\uff01");
17058
+ else {e=d.key;l=document.body||document.head;var k=document.createElement("script");k.type="text/javascript";k.src="https://webapi.amap.com/loca?v="+f+"&key="+e;k.onerror=function(a){g.Loca=b.failed;c("\u8bf7\u6c42 AMapUI \u5931\u8d25");};k.onload=function(){g.Loca=b.loaded;for(h();n.Loca.length;)n.Loca.splice(0,1)[0]();};l.appendChild(k);}}else g.Loca===b.loaded?a.version&&a.version!==d.Loca.version?c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c Loca \u6df7\u7528"):h():a.version&&a.version!==d.Loca.version?
17059
+ c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c Loca \u6df7\u7528"):n.Loca.push(function(a){a?c(a):c();});})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var b;(function(a){a.notload="notload";a.loading="loading";a.loaded="loaded";a.failed="failed";})(b||(b={}));var d={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},g={AMap:b.notload,AMapUI:b.notload,Loca:b.notload},n={AMap:[],AMapUI:[],Loca:[]},q=[],t=function(a){"function"==typeof a&&
17060
+ (g.AMap===b.loaded?a(window.AMap):q.push(a));};return {load:function(a){return new Promise(function(h,c){if(g.AMap==b.failed)c("");else if(g.AMap==b.notload){var f=a.key,e=a.version,l=a.plugins;f?(window.AMap&&"lbs.amap.com"!==location.host&&c("\u7981\u6b62\u591a\u79cdAPI\u52a0\u8f7d\u65b9\u5f0f\u6df7\u7528"),d.key=f,d.AMap.version=e||d.AMap.version,d.AMap.plugins=l||d.AMap.plugins,g.AMap=b.loading,e=document.body||document.head,window.___onAPILoaded=function(d){delete window.___onAPILoaded;if(d)g.AMap=
17061
+ b.failed,c(d);else for(g.AMap=b.loaded,m(a).then(function(){h(window.AMap);})["catch"](c);q.length;)q.splice(0,1)[0]();},l=document.createElement("script"),l.type="text/javascript",l.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+d.AMap.version+"&key="+f+"&plugin="+d.AMap.plugins.join(","),l.onerror=function(a){g.AMap=b.failed;c(a);},e.appendChild(l)):c("\u8bf7\u586b\u5199key");}else if(g.AMap==b.loaded)if(a.key&&a.key!==d.key)c("\u591a\u4e2a\u4e0d\u4e00\u81f4\u7684 key");else if(a.version&&
17062
+ a.version!==d.AMap.version)c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c JSAPI \u6df7\u7528");else {f=[];if(a.plugins)for(e=0;e<a.plugins.length;e+=1)-1==d.AMap.plugins.indexOf(a.plugins[e])&&f.push(a.plugins[e]);if(f.length)window.AMap.plugin(f,function(){m(a).then(function(){h(window.AMap);})["catch"](c);});else m(a).then(function(){h(window.AMap);})["catch"](c);}else if(a.key&&a.key!==d.key)c("\u591a\u4e2a\u4e0d\u4e00\u81f4\u7684 key");else if(a.version&&a.version!==d.AMap.version)c("\u4e0d\u5141\u8bb8\u591a\u4e2a\u7248\u672c JSAPI \u6df7\u7528");
17063
+ else {var k=[];if(a.plugins)for(e=0;e<a.plugins.length;e+=1)-1==d.AMap.plugins.indexOf(a.plugins[e])&&k.push(a.plugins[e]);t(function(){if(k.length)window.AMap.plugin(k,function(){m(a).then(function(){h(window.AMap);})["catch"](c);});else m(a).then(function(){h(window.AMap);})["catch"](c);});}})},reset:function(){delete window.AMap;delete window.AMapUI;delete window.Loca;d={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}};g={AMap:b.notload,AMapUI:b.notload,
17064
+ Loca:b.notload};n={AMap:[],AMapUI:[],Loca:[]};}}});
17065
+ } (dist));
17066
+
17067
+ var distExports = dist.exports;
17068
+ var AMapLoader$1 = /*@__PURE__*/getDefaultExportFromCjs(distExports);
17069
+
17070
+ var MapService = /*#__PURE__*/function () {
17071
+ function MapService() {
17072
+ _classCallCheck$1(this, MapService);
17073
+ _defineProperty$1(this, "isInit", false);
17074
+ _defineProperty$1(this, "AMap", null);
17075
+ _defineProperty$1(this, "TMap", null);
17076
+ _defineProperty$1(this, "BMap", null);
17077
+ _defineProperty$1(this, "MapCore", null);
17078
+ }
17079
+ _createClass$1(MapService, [{
17080
+ key: "isLbssettingEnable",
17081
+ get: function get() {
17082
+ var _tenantSetting$get;
17083
+ return ((_tenantSetting$get = tenantSetting.get('lbssetting')) === null || _tenantSetting$get === void 0 ? void 0 : _tenantSetting$get.enable) === '1';
17084
+ }
17085
+ }, {
17086
+ key: "setting",
17087
+ get: function get() {
17088
+ var _tenantSetting$get2;
17089
+ return (_tenantSetting$get2 = tenantSetting.get('lbssetting')) === null || _tenantSetting$get2 === void 0 ? void 0 : _tenantSetting$get2.setting;
17090
+ }
17091
+ }, {
17092
+ key: "key",
17093
+ get: function get() {
17094
+ if (this.isLbssettingEnable) {
17095
+ var _this$setting;
17096
+ return ((_this$setting = this.setting) === null || _this$setting === void 0 || (_this$setting = _this$setting.key) === null || _this$setting === void 0 ? void 0 : _this$setting.web) || '';
17097
+ } else {
17098
+ return AMapKey.production.key;
17099
+ }
17100
+ }
17101
+ }, {
17102
+ key: "secretkey",
17103
+ get: function get() {
17104
+ if (this.isLbssettingEnable) {
17105
+ var _this$setting2;
17106
+ return ((_this$setting2 = this.setting) === null || _this$setting2 === void 0 || (_this$setting2 = _this$setting2.secretkey) === null || _this$setting2 === void 0 ? void 0 : _this$setting2.web) || '';
17107
+ } else {
17108
+ return AMapKey.production.securityJsCode;
17109
+ }
17110
+ }
17111
+ }, {
17112
+ key: "type",
17113
+ get: function get() {
17114
+ if (this.isLbssettingEnable) {
17115
+ var _this$setting3;
17116
+ return ((_this$setting3 = this.setting) === null || _this$setting3 === void 0 ? void 0 : _this$setting3.type) || 'amap';
17117
+ } else {
17118
+ return 'amap';
17119
+ }
17120
+ }
17121
+ }, {
17122
+ key: "init",
17123
+ value: // get AMap() {
17124
+ // if (!this.isInit || this.type !== 'amap') {
17125
+ // return null
17126
+ // }
17127
+ // return window.AMap
17128
+ // }
17129
+ // get TMap() {
17130
+ // if (!this.isInit || this.type !== 'tencent') {
17131
+ // return null
17132
+ // }
17133
+ // return window.TMap
17134
+ // }
17135
+ // get BMap() {
17136
+ // if (!this.isInit || this.type !== 'baidu') {
17137
+ // return null
17138
+ // }
17139
+ // return window.BMap
17140
+ // }
17141
+ // get MapCore() {
17142
+ // if (!this.isInit) {
17143
+ // return null
17144
+ // }
17145
+ // return window.BMap
17146
+ // }
17147
+ function () {
17148
+ var _init = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
17149
+ var type;
17150
+ return _regeneratorRuntime$1().wrap(function _callee$(_context) {
17151
+ while (1) switch (_context.prev = _context.next) {
17152
+ case 0:
17153
+ if (!this.isInit) {
17154
+ _context.next = 2;
17155
+ break;
17156
+ }
17157
+ return _context.abrupt("return");
17158
+ case 2:
17159
+ this.isInit = true;
17160
+ type = this.type; // if (process.env.NODE_ENV === 'development') {
17161
+ // type = 'baidu'
17162
+ // }
17163
+ if (!(type === 'tencent')) {
17164
+ _context.next = 9;
17165
+ break;
17166
+ }
17167
+ _context.next = 7;
17168
+ return this.initTecent();
17169
+ case 7:
17170
+ _context.next = 17;
17171
+ break;
17172
+ case 9:
17173
+ if (!(type === 'amap')) {
17174
+ _context.next = 14;
17175
+ break;
17176
+ }
17177
+ _context.next = 12;
17178
+ return this.initAmap();
17179
+ case 12:
17180
+ _context.next = 17;
17181
+ break;
17182
+ case 14:
17183
+ if (!(type === 'baidu')) {
17184
+ _context.next = 17;
17185
+ break;
17186
+ }
17187
+ _context.next = 17;
17188
+ return this.initBaidu();
17189
+ case 17:
17190
+ case "end":
17191
+ return _context.stop();
17192
+ }
17193
+ }, _callee, this);
17194
+ }));
17195
+ function init() {
17196
+ return _init.apply(this, arguments);
17197
+ }
17198
+ return init;
17199
+ }() // reset() {
17200
+ // this.isInit = false
17201
+ // }
17202
+ }, {
17203
+ key: "initTecent",
17204
+ value: function () {
17205
+ var _initTecent = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2() {
17206
+ return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
17207
+ while (1) switch (_context2.prev = _context2.next) {
17208
+ case 0:
17209
+ _context2.next = 2;
17210
+ return importJS("https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=".concat(this.key),
17211
+ // `https://map.qq.com/api/gljs?v=1.exp&key=${this.key}`,
17212
+ 'TMap');
17213
+ case 2:
17214
+ this.TMap = window.TMap;
17215
+ this.MapCore = window.TMap;
17216
+ _context2.next = 6;
17217
+ return delay(300);
17218
+ case 6:
17219
+ case "end":
17220
+ return _context2.stop();
17221
+ }
17222
+ }, _callee2, this);
17223
+ }));
17224
+ function initTecent() {
17225
+ return _initTecent.apply(this, arguments);
17226
+ }
17227
+ return initTecent;
17228
+ }()
17229
+ }, {
17230
+ key: "initAmap",
17231
+ value: function () {
17232
+ var _initAmap = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3() {
17233
+ var plugin, AMap;
17234
+ return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
17235
+ while (1) switch (_context3.prev = _context3.next) {
17236
+ case 0:
17237
+ // if (this.secretkey) {
17238
+ // window._AMapSecurityConfig = {
17239
+ // securityJsCode: this.secretkey
17240
+ // }
17241
+ // }
17242
+ plugin = ['AMap.Geolocation']; // plugin.push('AMap.Geocoder') // 不开放地址查询 改用ipaas
17243
+ _context3.next = 3;
17244
+ return AMapLoader$1.load({
17245
+ key: this.key,
17246
+ version: '2.0',
17247
+ plugins: plugin,
17248
+ AMapUI: {
17249
+ version: '1.1',
17250
+ plugins: []
17251
+ }
17252
+ });
17253
+ case 3:
17254
+ AMap = _context3.sent;
17255
+ window.AMap = AMap;
17256
+ this.AMap = AMap;
17257
+ this.MapCore = window.AMap;
17258
+ // console.log(window)
17259
+ // console.log(window.AMap)
17260
+ // console.log(window.AMapUI)
17261
+ // console.log(window.AMapLoader)
17262
+ // console.log(window.AMap === aaaa)
17263
+ case 7:
17264
+ case "end":
17265
+ return _context3.stop();
17266
+ }
17267
+ }, _callee3, this);
17268
+ }));
17269
+ function initAmap() {
17270
+ return _initAmap.apply(this, arguments);
17271
+ }
17272
+ return initAmap;
17273
+ }()
17274
+ }, {
17275
+ key: "initBaidu",
17276
+ value: function () {
17277
+ var _initBaidu = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4() {
17278
+ var _this = this;
17279
+ return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
17280
+ while (1) switch (_context4.prev = _context4.next) {
17281
+ case 0:
17282
+ return _context4.abrupt("return", new Promise(function (resolve, reject) {
17283
+ window.BMAP_INITIAL_CALLBACK = function () {
17284
+ _this.BMap = window.BMap;
17285
+ _this.MapCore = window.BMap;
17286
+ // debugger
17287
+ // 启用google标准坐标体系
17288
+ // coordsType 指定输入输出的坐标类型,BMAP_COORD_GCJ02为gcj02坐标,BMAP_COORD_BD09为bd0ll坐标,默认为BMAP_COORD_BD09。
17289
+ window.BMap.coordType = 'BMAP_COORD_GCJ02';
17290
+ resolve(null);
17291
+ };
17292
+ var script = document.createElement('script');
17293
+ // 使用最新 3.0 api https://lbsyun.baidu.com/index.php?title=jspopular3.0
17294
+ script.src = "https://api.map.baidu.com/api?v=3.0&ak=".concat(_this.key, "&callback=BMAP_INITIAL_CALLBACK");
17295
+ // script.src = `https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=${this.key}&callback=BMAP_INITIAL_CALLBACK`
17296
+ script.onerror = function (err) {
17297
+ reject(err);
17298
+ };
17299
+ document.body.appendChild(script);
17300
+ }));
17301
+ case 1:
17302
+ case "end":
17303
+ return _context4.stop();
17304
+ }
17305
+ }, _callee4);
17306
+ }));
17307
+ function initBaidu() {
17308
+ return _initBaidu.apply(this, arguments);
17309
+ }
17310
+ return initBaidu;
17311
+ }()
17312
+ }]);
17313
+ return MapService;
17314
+ }();
17315
+ var mapService = new MapService();
17316
+
17317
+ function transformLat(x, y) {
17318
+ var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
17319
+ ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0;
17320
+ ret += (20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin(y / 3.0 * Math.PI)) * 2.0 / 3.0;
17321
+ ret += (160.0 * Math.sin(y / 12.0 * Math.PI) + 320 * Math.sin(y * Math.PI / 30.0)) * 2.0 / 3.0;
17322
+ return ret;
17323
+ }
17324
+ function transformLon(x, y) {
17325
+ var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
17326
+ ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0;
17327
+ ret += (20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin(x / 3.0 * Math.PI)) * 2.0 / 3.0;
17328
+ ret += (150.0 * Math.sin(x / 12.0 * Math.PI) + 300.0 * Math.sin(x / 30.0 * Math.PI)) * 2.0 / 3.0;
17329
+ return ret;
17330
+ }
17331
+ function outOfChina(lng, lat) {
17332
+ return lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271;
17333
+ }
17334
+ function delta(lng, lat) {
17335
+ var a = 6378245.0; // 地球长半轴
17336
+ var ee = 0.00669342162296594323; // 扁率
17337
+ var dLat = transformLat(lng - 105.0, lat - 35.0);
17338
+ var dLng = transformLon(lng - 105.0, lat - 35.0);
17339
+ var radLat = lat / 180.0 * Math.PI;
17340
+ var magic = Math.sin(radLat);
17341
+ magic = 1 - ee * magic * magic;
17342
+ var sqrtMagic = Math.sqrt(magic);
17343
+ dLat = dLat * 180.0 / (a * (1 - ee) / (magic * sqrtMagic) * Math.PI);
17344
+ dLng = dLng * 180.0 / (a / sqrtMagic * Math.cos(radLat) * Math.PI);
17345
+ return {
17346
+ lat: dLat,
17347
+ lng: dLng
17348
+ };
17349
+ }
17350
+ function wgs84ToGcj02(lng, lat) {
17351
+ if (outOfChina(lng, lat)) {
17352
+ return {
17353
+ lng: lng,
17354
+ lat: lat
17355
+ };
17356
+ }
17357
+ var d = delta(lng, lat);
17358
+ return {
17359
+ lng: lng + d.lng,
17360
+ lat: lat + d.lat
17361
+ };
17362
+ }
17363
+ /**
17364
+ * 坐标常量说明:
17365
+ * COORDINATES_WGS84 = 1, WGS84坐标
17366
+ * COORDINATES_WGS84_MC = 2, WGS84的平面墨卡托坐标
17367
+ * COORDINATES_GCJ02 = 3,GCJ02坐标
17368
+ * COORDINATES_GCJ02_MC = 4, GCJ02的平面墨卡托坐标
17369
+ * COORDINATES_BD09 = 5, 百度bd09经纬度坐标
17370
+ * COORDINATES_BD09_MC = 6,百度bd09墨卡托坐标
17371
+ * COORDINATES_MAPBAR = 7,mapbar地图坐标
17372
+ * COORDINATES_51 = 8,51地图坐标
17373
+ */
17374
+ var BMapTransformBD09ToGCJ02Points = function BMapTransformBD09ToGCJ02Points(points) {
17375
+ return new Promise(function (resolve, reject) {
17376
+ new window.BMap.Convertor().translate(points, 5, 3, function (data) {
17377
+ if (!data.status) {
17378
+ resolve(data.points);
17379
+ } else {
17380
+ console.error(data);
17381
+ // reject(data.status)
17382
+ resolve(points);
17383
+ }
17384
+ });
17385
+ });
17386
+ };
17387
+
17388
+ var cachetime = 30000; // 缓存时间30秒
16993
17389
  var datetime = null;
16994
17390
  var lastLocation = null;
16995
17391
  var runing = false;
16996
17392
  var locationPromise;
16997
- function init() {
16998
- return _init.apply(this, arguments);
16999
- }
17000
- function _init() {
17001
- _init = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
17393
+ // app端默认坐标为 gcj02
17394
+ var getLocationByNative = /*#__PURE__*/function () {
17395
+ var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
17002
17396
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
17003
17397
  while (1) switch (_context.prev = _context.next) {
17004
17398
  case 0:
17005
- if (AMap) {
17006
- _context.next = 6;
17007
- break;
17008
- }
17009
- _context.next = 3;
17010
- return AMapLoader.load({
17011
- plugins: ['AMap.Geolocation', 'AMap.Geocoder']
17012
- });
17013
- case 3:
17014
- AMap = _context.sent;
17015
- geocoder = new AMap.Geocoder({
17016
- city: '',
17017
- radius: 500
17018
- });
17019
- geolocation = new AMap.Geolocation({
17020
- enableHighAccuracy: true,
17021
- timeout: 3000
17022
- });
17023
- case 6:
17399
+ console.log('getLocationByNative start...');
17400
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
17401
+ var isload = false;
17402
+ setTimeout(function () {
17403
+ if (!isload) {
17404
+ console.error('getLocationByNative fail: timeout 30000');
17405
+ resolve(null);
17406
+ }
17407
+ }, 30000);
17408
+ window.Native.getLocation(function (res, error, status) {
17409
+ // console.log('getLocation res', res)
17410
+ // console.log('getLocation error', error)
17411
+ // console.log('getLocation status', status)
17412
+ isload = true;
17413
+ if (res && res !== null && res !== void 0 && res.longitude && res !== null && res !== void 0 && res.latitude) {
17414
+ var result = {
17415
+ longitude: res.longitude.toString(),
17416
+ latitude: res.latitude.toString(),
17417
+ address: res.address || ''
17418
+ };
17419
+ console.log("getLocationByNative success: ".concat(JSON.stringify(result)));
17420
+ resolve(result);
17421
+ } else {
17422
+ console.error('getLocationByNative fail');
17423
+ resolve(null);
17424
+ }
17425
+ });
17426
+ }));
17427
+ case 2:
17024
17428
  case "end":
17025
17429
  return _context.stop();
17026
17430
  }
17027
17431
  }, _callee);
17028
17432
  }));
17029
- return _init.apply(this, arguments);
17030
- }
17031
- function getAmapLocation() {
17032
- return _getAmapLocation.apply(this, arguments);
17033
- }
17034
- function _getAmapLocation() {
17035
- _getAmapLocation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2() {
17433
+ return function getLocationByNative() {
17434
+ return _ref.apply(this, arguments);
17435
+ };
17436
+ }();
17437
+ // 浏览器定位: 需要开启https
17438
+ var getLocationByNavigator = /*#__PURE__*/function () {
17439
+ var _ref2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2() {
17036
17440
  return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
17037
17441
  while (1) switch (_context2.prev = _context2.next) {
17038
17442
  case 0:
17039
- _context2.next = 2;
17040
- return init();
17041
- case 2:
17443
+ console.log('getLocationByNavigator start...');
17042
17444
  return _context2.abrupt("return", new Promise(function (resolve, reject) {
17043
- // https://blog.csdn.net/Liu331013/article/details/115423749
17044
- geolocation.getCurrentPosition(function (status, result) {
17045
- console.log(status, result);
17046
- if (status === 'complete') {
17047
- var _result$position = result.position,
17048
- lng = _result$position.lng,
17049
- lat = _result$position.lat;
17050
- // console.log('getAmapLocation success')
17051
- resolve({
17052
- longitude: lng.toString(),
17053
- latitude: lat.toString(),
17054
- address: ''
17055
- });
17056
- } else {
17057
- // reject(new Error('getAmapLocation fail'))
17058
- console.error('getAmapLocation fail');
17445
+ if ('geolocation' in navigator) {
17446
+ var time = setTimeout(function () {
17447
+ console.error('getLocationByNavigator fail: timeout 5000');
17059
17448
  resolve(null);
17060
- }
17061
- });
17449
+ }, 5000);
17450
+ navigator.geolocation.getCurrentPosition(function (position) {
17451
+ // console.log(position)
17452
+ // debugger
17453
+ clearTimeout(time);
17454
+ if (position.coords) {
17455
+ // 浏览器定位默认返回 WGS84 坐标 需要转化为 GCJ02 坐标
17456
+ var Gcj02 = wgs84ToGcj02(position.coords.longitude, position.coords.latitude);
17457
+ // console.log(Gcj02)
17458
+ // debugger
17459
+ var result = {
17460
+ latitude: Gcj02.lat.toString(),
17461
+ longitude: Gcj02.lng.toString()
17462
+ };
17463
+ console.log("getLocationByNavigator success: ".concat(JSON.stringify(result)));
17464
+ resolve(result);
17465
+ } else {
17466
+ console.error('getLocationByNavigator fail');
17467
+ resolve(null);
17468
+ }
17469
+ }, function () {
17470
+ clearTimeout(time);
17471
+ console.error('getLocationByNavigator fail');
17472
+ resolve(null);
17473
+ });
17474
+ } else {
17475
+ console.error('getLocationByNavigator fail: navigator.geolocation not support');
17476
+ resolve(null);
17477
+ }
17062
17478
  }));
17063
- case 3:
17479
+ case 2:
17064
17480
  case "end":
17065
17481
  return _context2.stop();
17066
17482
  }
17067
17483
  }, _callee2);
17068
17484
  }));
17069
- return _getAmapLocation.apply(this, arguments);
17070
- }
17071
- function getSpuLocation() {
17072
- return _getSpuLocation.apply(this, arguments);
17073
- }
17074
- function _getSpuLocation() {
17075
- _getSpuLocation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3() {
17485
+ return function getLocationByNavigator() {
17486
+ return _ref2.apply(this, arguments);
17487
+ };
17488
+ }();
17489
+ // ipaas ip 定位
17490
+ var getIPLocationByIpaas = /*#__PURE__*/function () {
17491
+ var _ref3 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3(ip) {
17076
17492
  return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
17077
17493
  while (1) switch (_context3.prev = _context3.next) {
17078
17494
  case 0:
17495
+ console.log('getIPLocationByIpaas start...');
17079
17496
  return _context3.abrupt("return", new Promise(function (resolve, reject) {
17080
- var isload = false;
17081
- setTimeout(function () {
17082
- if (!isload) {
17083
- console.error('getSpuLocation timeout 30000');
17084
- resolve(null);
17085
- }
17086
- }, 30000);
17087
- window.Native.getLocation(function (result, error, status) {
17088
- isload = true;
17089
- // console.log('getLocation result', result)
17090
- // console.log('getLocation error', error)
17091
- // console.log('getLocation status', status)
17092
- if (result && result !== null && result !== void 0 && result.longitude && result !== null && result !== void 0 && result.latitude) {
17093
- resolve({
17094
- longitude: result.longitude.toString(),
17095
- latitude: result.latitude.toString(),
17096
- address: result.address || ''
17497
+ var AMapKey = getAMapKey();
17498
+ normalAxios$1.post('https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001815271', {
17499
+ key: AMapKey.key,
17500
+ ip: ip || ''
17501
+ }).then(function (res) {
17502
+ // console.log(res)
17503
+ // debugger
17504
+ // res.data.rectangle = '113.1017375,22.93212254;113.6770499,23.3809537'
17505
+ if (res.data.rectangle) {
17506
+ var rectangle = res.data.rectangle;
17507
+ var rects = rectangle.split(';').map(function (rect) {
17508
+ var _rect$split = rect.split(','),
17509
+ _rect$split2 = _slicedToArray(_rect$split, 2),
17510
+ longitude = _rect$split2[0],
17511
+ latitude = _rect$split2[1];
17512
+ return {
17513
+ longitude: Number(longitude),
17514
+ latitude: Number(latitude)
17515
+ };
17097
17516
  });
17517
+ var result = {
17518
+ longitude: ((rects[0].longitude + rects[1].longitude) / 2).toString(),
17519
+ latitude: ((rects[0].latitude + rects[1].latitude) / 2).toString()
17520
+ };
17521
+ console.log("getIPLocationByIpaas success: ".concat(JSON.stringify(result)));
17522
+ resolve(result);
17098
17523
  } else {
17099
- console.error('getSpuLocation fail');
17524
+ console.error('getIPLocationByIpaas fail');
17100
17525
  resolve(null);
17101
17526
  }
17527
+ })["catch"](function (err) {
17528
+ console.error(err);
17529
+ console.error('getIPLocationByIpaas fail');
17530
+ resolve(null);
17102
17531
  });
17103
17532
  }));
17104
- case 1:
17533
+ case 2:
17105
17534
  case "end":
17106
17535
  return _context3.stop();
17107
17536
  }
17108
17537
  }, _callee3);
17109
17538
  }));
17110
- return _getSpuLocation.apply(this, arguments);
17111
- }
17112
- function getAmapCityLocation() {
17113
- return _getAmapCityLocation.apply(this, arguments);
17114
- }
17115
- function _getAmapCityLocation() {
17116
- _getAmapCityLocation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4() {
17117
- return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
17118
- while (1) switch (_context4.prev = _context4.next) {
17539
+ return function getIPLocationByIpaas(_x) {
17540
+ return _ref3.apply(this, arguments);
17541
+ };
17542
+ }();
17543
+ // ipaas 逆地址解析
17544
+ var getAddressByIpaas = /*#__PURE__*/function () {
17545
+ var _ref4 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(position) {
17546
+ return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
17547
+ while (1) switch (_context5.prev = _context5.next) {
17119
17548
  case 0:
17120
- _context4.next = 2;
17121
- return init();
17549
+ console.log('getAddressByIpaas start...');
17550
+ // 如果不设置安全秘钥的话 js-api的逆地址查询不成功 返回 INVALID_USER_SCODE 改成用ipaas服务查询
17551
+ return _context5.abrupt("return", new Promise( /*#__PURE__*/function () {
17552
+ var _ref5 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4(resolve, reject) {
17553
+ var _result$data, AMapKey, result, address;
17554
+ return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
17555
+ while (1) switch (_context4.prev = _context4.next) {
17556
+ case 0:
17557
+ if (!position) {
17558
+ _context4.next = 15;
17559
+ break;
17560
+ }
17561
+ _context4.prev = 1;
17562
+ AMapKey = getAMapKey();
17563
+ _context4.next = 5;
17564
+ return normalAxios$1.post('https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001809906', {
17565
+ longitude: position.longitude,
17566
+ latitude: position.latitude,
17567
+ key: AMapKey.key
17568
+ // extensions: 'all'
17569
+ });
17570
+ case 5:
17571
+ result = _context4.sent;
17572
+ // console.log(result)
17573
+ address = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.formatted_address;
17574
+ if (address) {
17575
+ console.log("getAddressByIpaas success: ".concat(address));
17576
+ resolve(address);
17577
+ } else {
17578
+ console.error('getAddressByIpaas fail');
17579
+ resolve('');
17580
+ }
17581
+ _context4.next = 15;
17582
+ break;
17583
+ case 10:
17584
+ _context4.prev = 10;
17585
+ _context4.t0 = _context4["catch"](1);
17586
+ console.error(_context4.t0);
17587
+ console.error('getAddressByIpaas fail');
17588
+ resolve('');
17589
+ case 15:
17590
+ case "end":
17591
+ return _context4.stop();
17592
+ }
17593
+ }, _callee4, null, [[1, 10]]);
17594
+ }));
17595
+ return function (_x3, _x4) {
17596
+ return _ref5.apply(this, arguments);
17597
+ };
17598
+ }()));
17122
17599
  case 2:
17123
- return _context4.abrupt("return", new Promise(function (resolve, reject) {
17124
- geolocation.getCityInfo(function (status, result) {
17600
+ case "end":
17601
+ return _context5.stop();
17602
+ }
17603
+ }, _callee5);
17604
+ }));
17605
+ return function getAddressByIpaas(_x2) {
17606
+ return _ref4.apply(this, arguments);
17607
+ };
17608
+ }();
17609
+ // 高德定位
17610
+ var getLocationByAmap = /*#__PURE__*/function () {
17611
+ var _ref6 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6() {
17612
+ return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
17613
+ while (1) switch (_context6.prev = _context6.next) {
17614
+ case 0:
17615
+ console.log('getLocationByAmap start...');
17616
+ return _context6.abrupt("return", new Promise(function (resolve, reject) {
17617
+ var geolocation = new window.AMap.Geolocation({
17618
+ enableHighAccuracy: true,
17619
+ timeout: 15000
17620
+ });
17621
+ geolocation.getCurrentPosition(function (status, res) {
17622
+ // console.log(status, result)
17623
+ // debugger
17125
17624
  if (status === 'complete') {
17126
- var lng = result.position[0].toString();
17127
- var lat = result.position[1].toString();
17128
- // console.log('getAmapCityLocation success')
17129
- // resolve([lng, lat])
17130
- resolve({
17625
+ var _res$position = res.position,
17626
+ lng = _res$position.lng,
17627
+ lat = _res$position.lat;
17628
+ var result = {
17131
17629
  longitude: lng.toString(),
17132
- latitude: lat.toString(),
17133
- address: ''
17134
- });
17630
+ latitude: lat.toString()
17631
+ };
17632
+ console.log("getLocationByAmap success: ".concat(JSON.stringify(result)));
17633
+ resolve(result);
17135
17634
  } else {
17136
- // reject(new Error('getAmapCityLocation fail'))
17137
- console.error('getAmapCityLocation fail');
17635
+ console.error('getLocationByAmap fail');
17138
17636
  resolve(null);
17139
17637
  }
17140
17638
  });
17141
17639
  }));
17142
- case 3:
17640
+ case 2:
17143
17641
  case "end":
17144
- return _context4.stop();
17642
+ return _context6.stop();
17145
17643
  }
17146
- }, _callee4);
17644
+ }, _callee6);
17147
17645
  }));
17148
- return _getAmapCityLocation.apply(this, arguments);
17149
- }
17150
- function getAddress(_x) {
17151
- return _getAddress.apply(this, arguments);
17152
- } // 定位流程: 缓存 > 判断环境(APP,小程序,企微)基于环境获取定位 > 高德地图高精度定位 > 百度地图定位 > 高德城市定位
17153
- function _getAddress() {
17154
- _getAddress = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(position) {
17155
- return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
17156
- while (1) switch (_context5.prev = _context5.next) {
17646
+ return function getLocationByAmap() {
17647
+ return _ref6.apply(this, arguments);
17648
+ };
17649
+ }();
17650
+ // 高德城市定位
17651
+ var getCityLocationByAmap = /*#__PURE__*/function () {
17652
+ var _ref7 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee7() {
17653
+ return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
17654
+ while (1) switch (_context7.prev = _context7.next) {
17157
17655
  case 0:
17158
- _context5.next = 2;
17159
- return init();
17656
+ console.log('getCityLocationByAmap start...');
17657
+ return _context7.abrupt("return", new Promise(function (resolve, reject) {
17658
+ var geolocation = new window.AMap.Geolocation({
17659
+ enableHighAccuracy: true,
17660
+ timeout: 15000
17661
+ });
17662
+ geolocation.getCityInfo(function (status, res) {
17663
+ // console.log(res)
17664
+ // debugger
17665
+ if (status === 'complete') {
17666
+ var lng = res.position[0].toString();
17667
+ var lat = res.position[1].toString();
17668
+ var result = {
17669
+ longitude: lng.toString(),
17670
+ latitude: lat.toString()
17671
+ };
17672
+ console.log("getCityLocationByAmap success: ".concat(JSON.stringify(result)));
17673
+ resolve(result);
17674
+ } else {
17675
+ console.error('getCityLocationByAmap fail');
17676
+ resolve(null);
17677
+ }
17678
+ });
17679
+ }));
17160
17680
  case 2:
17161
- return _context5.abrupt("return", new Promise(function (resolve, reject) {
17681
+ case "end":
17682
+ return _context7.stop();
17683
+ }
17684
+ }, _callee7);
17685
+ }));
17686
+ return function getCityLocationByAmap() {
17687
+ return _ref7.apply(this, arguments);
17688
+ };
17689
+ }();
17690
+ // 高德逆地址解析
17691
+ var getAddressByAmap = /*#__PURE__*/function () {
17692
+ var _ref8 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee8(position) {
17693
+ var address;
17694
+ return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
17695
+ while (1) switch (_context8.prev = _context8.next) {
17696
+ case 0:
17697
+ console.log('getAddressByAmap start...');
17698
+ console.log('getAddressByAmap changeto getAddressByIpaas');
17699
+ // return new Promise((resolve, reject) => {
17700
+ // if (position) {
17701
+ // new window.AMap.Geocoder({
17702
+ // city: '',
17703
+ // radius: 500
17704
+ // }).getAddress([position.longitude, position.latitude], (status: string, result: any) => {
17705
+ // if (status === 'complete' && result.info === 'OK' && result.regeocode) {
17706
+ // resolve(result?.regeocode?.formattedAddress || '')
17707
+ // } else {
17708
+ // console.error('getAddressByAmap fail')
17709
+ // resolve('')
17710
+ // }
17711
+ // })
17712
+ // }
17713
+ // })
17714
+ // 如果不设置安全秘钥的话 js-api的逆地址查询不成功 返回 INVALID_USER_SCODE 改成用ipaas服务查询
17715
+ _context8.next = 4;
17716
+ return getAddressByIpaas(position);
17717
+ case 4:
17718
+ address = _context8.sent;
17719
+ return _context8.abrupt("return", address);
17720
+ case 6:
17721
+ case "end":
17722
+ return _context8.stop();
17723
+ }
17724
+ }, _callee8);
17725
+ }));
17726
+ return function getAddressByAmap(_x5) {
17727
+ return _ref8.apply(this, arguments);
17728
+ };
17729
+ }();
17730
+ // 腾讯ip定位:通过终端设备IP地址获取其当前所在地理位置,精确到市级,常用于显示当地城市天气预报、初始化用户城市等非精确定位场景。
17731
+ var getIPLocationByTMap = /*#__PURE__*/function () {
17732
+ var _ref9 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee9(ip) {
17733
+ return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
17734
+ while (1) switch (_context9.prev = _context9.next) {
17735
+ case 0:
17736
+ console.log('getIPLocationByTMap start...');
17737
+ return _context9.abrupt("return", new Promise(function (resolve, reject) {
17738
+ var ipLocation = new window.TMap.service.IPLocation();
17739
+ var params = ip ? {
17740
+ ip: ip
17741
+ } : {};
17742
+ ipLocation.locate(params).then(function (res) {
17743
+ var result = {
17744
+ longitude: res.result.location.lng.toString(),
17745
+ latitude: res.result.location.lat.toString()
17746
+ };
17747
+ console.log("getIPLocationByTMap success: ".concat(JSON.stringify(result)));
17748
+ resolve(result);
17749
+ })["catch"](function (err) {
17750
+ console.error(err);
17751
+ console.error("getIPLocationByTMap fail: ".concat(JSON.stringify(err)));
17752
+ resolve(null);
17753
+ });
17754
+ }));
17755
+ case 2:
17756
+ case "end":
17757
+ return _context9.stop();
17758
+ }
17759
+ }, _callee9);
17760
+ }));
17761
+ return function getIPLocationByTMap(_x6) {
17762
+ return _ref9.apply(this, arguments);
17763
+ };
17764
+ }();
17765
+ // 腾讯逆地址解析
17766
+ var getAddressByTMap = /*#__PURE__*/function () {
17767
+ var _ref10 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee10(position) {
17768
+ return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
17769
+ while (1) switch (_context10.prev = _context10.next) {
17770
+ case 0:
17771
+ console.log('getAddressByTMap start...');
17772
+ return _context10.abrupt("return", new Promise(function (resolve, reject) {
17162
17773
  if (position) {
17163
- geocoder.getAddress([position.longitude, position.latitude], function (status, result) {
17164
- if (status === 'complete' && result.regeocode) {
17165
- resolve(result.regeocode.formattedAddress);
17166
- } else {
17167
- // reject(new Error('getAddress fail'))
17168
- console.error('getAddress fail');
17169
- resolve('');
17170
- }
17774
+ var location = new window.TMap.LatLng(position.latitude, position.longitude);
17775
+ // console.log(position)
17776
+ // console.log(location)
17777
+ // debugger
17778
+ new window.TMap.service.Geocoder().getAddress({
17779
+ location: location,
17780
+ getPoi: false
17781
+ }).then(function (res) {
17782
+ var _res$result, _res$result2;
17783
+ // console.log(res)
17784
+ // debugger
17785
+ var address = (res === null || res === void 0 || (_res$result = res.result) === null || _res$result === void 0 || (_res$result = _res$result.formatted_addresses) === null || _res$result === void 0 ? void 0 : _res$result.recommend) || (res === null || res === void 0 || (_res$result2 = res.result) === null || _res$result2 === void 0 ? void 0 : _res$result2.address);
17786
+ console.log("getAddressByTMap success: ".concat(address));
17787
+ resolve(address);
17788
+ })["catch"](function (err) {
17789
+ console.error(err);
17790
+ console.error("getAddressByTMap fail: ".concat(JSON.stringify(err)));
17791
+ resolve('');
17171
17792
  });
17172
17793
  }
17173
17794
  }));
17174
- case 3:
17795
+ case 2:
17175
17796
  case "end":
17176
- return _context5.stop();
17797
+ return _context10.stop();
17177
17798
  }
17178
- }, _callee5);
17799
+ }, _callee10);
17179
17800
  }));
17180
- return _getAddress.apply(this, arguments);
17181
- }
17182
- function getLocationPromise() {
17183
- return _getLocationPromise.apply(this, arguments);
17184
- }
17185
- function _getLocationPromise() {
17186
- _getLocationPromise = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6() {
17801
+ return function getAddressByTMap(_x7) {
17802
+ return _ref10.apply(this, arguments);
17803
+ };
17804
+ }();
17805
+ // 百度浏览器定位
17806
+ var getLocationByBMap = /*#__PURE__*/function () {
17807
+ var _ref11 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee12() {
17808
+ return _regeneratorRuntime$1().wrap(function _callee12$(_context12) {
17809
+ while (1) switch (_context12.prev = _context12.next) {
17810
+ case 0:
17811
+ console.log('getLocationByBMap start...');
17812
+ return _context12.abrupt("return", new Promise(function (resolve, reject) {
17813
+ new window.BMap.Geolocation().getCurrentPosition( /*#__PURE__*/function () {
17814
+ var _ref12 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee11(res) {
17815
+ var lng, lat, result;
17816
+ return _regeneratorRuntime$1().wrap(function _callee11$(_context11) {
17817
+ while (1) switch (_context11.prev = _context11.next) {
17818
+ case 0:
17819
+ if (res) {
17820
+ _context11.next = 4;
17821
+ break;
17822
+ }
17823
+ console.error('getLocationByBMap fail');
17824
+ resolve(null);
17825
+ return _context11.abrupt("return");
17826
+ case 4:
17827
+ // 初始化已经指定 window.BMap.coordType = 'BMAP_COORD_GCJ02' 定位返回的定位信息,外层[latitude,longitude]依然是BD09,然后point里面的是GCJ02
17828
+ // {
17829
+ // "accuracy": 150,
17830
+ // "altitude": null,
17831
+ // "altitudeAccuracy": null,
17832
+ // "heading": null,
17833
+ // "latitude": 39.915018933989,
17834
+ // "longitude": 116.40383261074,
17835
+ // "speed": null,
17836
+ // "timestamp": null,
17837
+ // "point": {
17838
+ // "lng": 116.39745977716758,
17839
+ // "lat": 39.908676092571405
17840
+ // },
17841
+ // "address": {
17842
+ // "country": "",
17843
+ // "city": "北京市",
17844
+ // "city_code": 0,
17845
+ // "district": "东城区",
17846
+ // "province": "北京市",
17847
+ // "street": "东华门大街",
17848
+ // "street_number": "66号"
17849
+ // }
17850
+ // }
17851
+ // 不用转换
17852
+ // const point: any = await BMapTransformBD09ToGCJ02Points([{
17853
+ // lng: res.longitude,
17854
+ // lat: res.latitude
17855
+ // }])
17856
+ // console.log(point)
17857
+ // debugger
17858
+ lng = res.point.lng.toString();
17859
+ lat = res.point.lat.toString();
17860
+ result = {
17861
+ longitude: lng,
17862
+ latitude: lat
17863
+ };
17864
+ console.log("getLocationByBMap success: ".concat(JSON.stringify(result)));
17865
+ resolve(result);
17866
+ case 9:
17867
+ case "end":
17868
+ return _context11.stop();
17869
+ }
17870
+ }, _callee11);
17871
+ }));
17872
+ return function (_x8) {
17873
+ return _ref12.apply(this, arguments);
17874
+ };
17875
+ }(), {
17876
+ enableHighAccuracy: true
17877
+ });
17878
+ }));
17879
+ case 2:
17880
+ case "end":
17881
+ return _context12.stop();
17882
+ }
17883
+ }, _callee12);
17884
+ }));
17885
+ return function getLocationByBMap() {
17886
+ return _ref11.apply(this, arguments);
17887
+ };
17888
+ }();
17889
+ // 百度城市定位
17890
+ var getCityLocationByBMap = /*#__PURE__*/function () {
17891
+ var _ref13 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee14() {
17892
+ return _regeneratorRuntime$1().wrap(function _callee14$(_context14) {
17893
+ while (1) switch (_context14.prev = _context14.next) {
17894
+ case 0:
17895
+ console.log('getCityLocationByBMap start...');
17896
+ return _context14.abrupt("return", new Promise(function (resolve, reject) {
17897
+ new window.BMap.LocalCity().get( /*#__PURE__*/function () {
17898
+ var _ref14 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee13(res) {
17899
+ var lng, lat, point, result;
17900
+ return _regeneratorRuntime$1().wrap(function _callee13$(_context13) {
17901
+ while (1) switch (_context13.prev = _context13.next) {
17902
+ case 0:
17903
+ // console.log(res)
17904
+ // debugger
17905
+ lng = res.center.lng.toString();
17906
+ lat = res.center.lat.toString();
17907
+ if (!(lng && lat)) {
17908
+ _context13.next = 11;
17909
+ break;
17910
+ }
17911
+ _context13.next = 5;
17912
+ return BMapTransformBD09ToGCJ02Points([{
17913
+ lng: lng,
17914
+ lat: lat
17915
+ }]);
17916
+ case 5:
17917
+ point = _context13.sent;
17918
+ // console.log(point)
17919
+ // debugger
17920
+ result = {
17921
+ longitude: point[0].lng,
17922
+ latitude: point[0].lat
17923
+ };
17924
+ console.log("getCityLocationByBMap success: ".concat(JSON.stringify(result)));
17925
+ resolve(result);
17926
+ _context13.next = 13;
17927
+ break;
17928
+ case 11:
17929
+ console.error('getCityLocationByBMap fail');
17930
+ resolve(null);
17931
+ case 13:
17932
+ case "end":
17933
+ return _context13.stop();
17934
+ }
17935
+ }, _callee13);
17936
+ }));
17937
+ return function (_x9) {
17938
+ return _ref14.apply(this, arguments);
17939
+ };
17940
+ }());
17941
+ }));
17942
+ case 2:
17943
+ case "end":
17944
+ return _context14.stop();
17945
+ }
17946
+ }, _callee14);
17947
+ }));
17948
+ return function getCityLocationByBMap() {
17949
+ return _ref13.apply(this, arguments);
17950
+ };
17951
+ }();
17952
+ // 百度逆地址解析
17953
+ var getAddressByBmap = /*#__PURE__*/function () {
17954
+ var _ref15 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee16(position) {
17955
+ return _regeneratorRuntime$1().wrap(function _callee16$(_context16) {
17956
+ while (1) switch (_context16.prev = _context16.next) {
17957
+ case 0:
17958
+ console.log('getAddressByBmap start...');
17959
+ return _context16.abrupt("return", new Promise( /*#__PURE__*/function () {
17960
+ var _ref16 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee15(resolve, reject) {
17961
+ var point;
17962
+ return _regeneratorRuntime$1().wrap(function _callee15$(_context15) {
17963
+ while (1) switch (_context15.prev = _context15.next) {
17964
+ case 0:
17965
+ if (position) {
17966
+ _context15.next = 4;
17967
+ break;
17968
+ }
17969
+ console.error('getAddressByBmap fail');
17970
+ resolve('');
17971
+ return _context15.abrupt("return");
17972
+ case 4:
17973
+ // // 把 GCJ02 转化为百度 BD09 地址
17974
+ // const points: any = await transformGCJ02ToBD09Points([{
17975
+ // lng: position.longitude,
17976
+ // lat: position.latitude
17977
+ // }])
17978
+ // const point = points[0]
17979
+ // 指定了 window.BMap.coordType = 'BMAP_COORD_GCJ02' 不需要转换
17980
+ point = new window.BMap.Point(position.longitude, position.latitude); // console.log(point)
17981
+ // debugger
17982
+ new window.BMap.Geocoder().getLocation(point, function (result) {
17983
+ // console.log(result)
17984
+ var address = result === null || result === void 0 ? void 0 : result.address;
17985
+ if (address) {
17986
+ console.log("getAddressByBmap success: ".concat(address));
17987
+ resolve(address);
17988
+ } else {
17989
+ console.error('getAddressByBmap fail');
17990
+ resolve('');
17991
+ }
17992
+ });
17993
+ case 6:
17994
+ case "end":
17995
+ return _context15.stop();
17996
+ }
17997
+ }, _callee15);
17998
+ }));
17999
+ return function (_x11, _x12) {
18000
+ return _ref16.apply(this, arguments);
18001
+ };
18002
+ }()));
18003
+ case 2:
18004
+ case "end":
18005
+ return _context16.stop();
18006
+ }
18007
+ }, _callee16);
18008
+ }));
18009
+ return function getAddressByBmap(_x10) {
18010
+ return _ref15.apply(this, arguments);
18011
+ };
18012
+ }();
18013
+ // 定位流程: 缓存 > 判断环境(APP,小程序,企微)基于环境获取定位 > 地图商高精度定位 > 地图商城市ip定位
18014
+ var getLocationPromise = /*#__PURE__*/function () {
18015
+ var _ref17 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee17() {
17187
18016
  var _window;
17188
18017
  var location;
17189
- return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
17190
- while (1) switch (_context6.prev = _context6.next) {
18018
+ return _regeneratorRuntime$1().wrap(function _callee17$(_context17) {
18019
+ while (1) switch (_context17.prev = _context17.next) {
17191
18020
  case 0:
17192
18021
  location = null; // 在 SPU 容器里使用 Native-API 的定位
17193
18022
  if (!((_window = window) !== null && _window !== void 0 && (_window = _window.Native) !== null && _window !== void 0 && _window.getLocation)) {
17194
- _context6.next = 5;
18023
+ _context17.next = 5;
17195
18024
  break;
17196
18025
  }
17197
- _context6.next = 4;
17198
- return getSpuLocation();
18026
+ _context17.next = 4;
18027
+ return getLocationByNative();
17199
18028
  case 4:
17200
- location = _context6.sent;
18029
+ location = _context17.sent;
17201
18030
  case 5:
17202
18031
  if (location) {
17203
- _context6.next = 9;
18032
+ _context17.next = 9;
17204
18033
  break;
17205
18034
  }
17206
- _context6.next = 8;
17207
- return getAmapLocation();
18035
+ _context17.next = 8;
18036
+ return getLocationByNavigator();
17208
18037
  case 8:
17209
- location = _context6.sent;
18038
+ location = _context17.sent;
17210
18039
  case 9:
17211
- if (!(!location && urlquery.isvirtuallocation)) {
17212
- _context6.next = 13;
18040
+ if (location) {
18041
+ _context17.next = 34;
17213
18042
  break;
17214
18043
  }
17215
- _context6.next = 12;
17216
- return getAmapCityLocation();
17217
- case 12:
17218
- location = _context6.sent;
18044
+ if (!(mapService.type === 'amap')) {
18045
+ _context17.next = 20;
18046
+ break;
18047
+ }
18048
+ _context17.next = 13;
18049
+ return getLocationByAmap();
17219
18050
  case 13:
17220
- // 测试虚拟定位
18051
+ location = _context17.sent;
18052
+ if (location) {
18053
+ _context17.next = 18;
18054
+ break;
18055
+ }
18056
+ _context17.next = 17;
18057
+ return getCityLocationByAmap();
18058
+ case 17:
18059
+ location = _context17.sent;
18060
+ case 18:
18061
+ _context17.next = 34;
18062
+ break;
18063
+ case 20:
18064
+ if (!(mapService.type === 'tencent')) {
18065
+ _context17.next = 26;
18066
+ break;
18067
+ }
18068
+ _context17.next = 23;
18069
+ return getIPLocationByTMap();
18070
+ case 23:
18071
+ location = _context17.sent;
18072
+ _context17.next = 34;
18073
+ break;
18074
+ case 26:
18075
+ if (!(mapService.type === 'baidu')) {
18076
+ _context17.next = 34;
18077
+ break;
18078
+ }
18079
+ _context17.next = 29;
18080
+ return getLocationByBMap();
18081
+ case 29:
18082
+ location = _context17.sent;
18083
+ if (location) {
18084
+ _context17.next = 34;
18085
+ break;
18086
+ }
18087
+ _context17.next = 33;
18088
+ return getCityLocationByBMap();
18089
+ case 33:
18090
+ location = _context17.sent;
18091
+ case 34:
18092
+ if (location) {
18093
+ _context17.next = 38;
18094
+ break;
18095
+ }
18096
+ _context17.next = 37;
18097
+ return getIPLocationByIpaas();
18098
+ case 37:
18099
+ location = _context17.sent;
18100
+ case 38:
18101
+ // 开发模式下为了方便测试提供虚拟定位
17221
18102
  if (!location && urlquery.isvirtuallocation) {
17222
18103
  location = {
17223
- longitude: '113.34331353081598',
17224
- latitude: '23.105349663628473',
17225
- address: ''
18104
+ longitude: '116.397454',
18105
+ latitude: '39.908671'
17226
18106
  };
17227
18107
  }
17228
18108
  if (!(location && !location.address)) {
17229
- _context6.next = 21;
18109
+ _context17.next = 46;
17230
18110
  break;
17231
18111
  }
17232
- _context6.next = 17;
18112
+ _context17.next = 42;
17233
18113
  return getAddress(location);
17234
- case 17:
17235
- _context6.t0 = _context6.sent;
17236
- if (_context6.t0) {
17237
- _context6.next = 20;
18114
+ case 42:
18115
+ _context17.t0 = _context17.sent;
18116
+ if (_context17.t0) {
18117
+ _context17.next = 45;
17238
18118
  break;
17239
18119
  }
17240
- _context6.t0 = '经纬度获取成功,但地址获取失败。';
17241
- case 20:
17242
- location.address = _context6.t0;
17243
- case 21:
17244
- return _context6.abrupt("return", location);
17245
- case 22:
18120
+ _context17.t0 = '经纬度获取成功,但地址获取失败。';
18121
+ case 45:
18122
+ location.address = _context17.t0;
18123
+ case 46:
18124
+ return _context17.abrupt("return", location);
18125
+ case 47:
17246
18126
  case "end":
17247
- return _context6.stop();
18127
+ return _context17.stop();
17248
18128
  }
17249
- }, _callee6);
18129
+ }, _callee17);
17250
18130
  }));
17251
- return _getLocationPromise.apply(this, arguments);
17252
- }
18131
+ return function getLocationPromise() {
18132
+ return _ref17.apply(this, arguments);
18133
+ };
18134
+ }();
18135
+ // WGS84 GCJ-02 BD-09 坐标系
18136
+ // https://www.jianshu.com/p/559029832a67
17253
18137
  function getLocation() {
17254
18138
  return _getLocation.apply(this, arguments);
17255
- }
18139
+ } // 逆地址解析
17256
18140
  function _getLocation() {
17257
- _getLocation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee7() {
18141
+ _getLocation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee20() {
17258
18142
  var locationRes;
17259
- return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
17260
- while (1) switch (_context7.prev = _context7.next) {
18143
+ return _regeneratorRuntime$1().wrap(function _callee20$(_context20) {
18144
+ while (1) switch (_context20.prev = _context20.next) {
17261
18145
  case 0:
17262
- if (!(datetime && Date.now() - datetime <= 30000 && lastLocation && !runing)) {
17263
- _context7.next = 2;
18146
+ _context20.next = 2;
18147
+ return mapService.init();
18148
+ case 2:
18149
+ if (!(datetime && Date.now() - datetime <= cachetime && lastLocation && !runing)) {
18150
+ _context20.next = 4;
17264
18151
  break;
17265
18152
  }
17266
- return _context7.abrupt("return", cloneDeep$1(lastLocation));
17267
- case 2:
18153
+ return _context20.abrupt("return", cloneDeep$1(lastLocation));
18154
+ case 4:
17268
18155
  if (!(runing && locationPromise)) {
17269
- _context7.next = 4;
18156
+ _context20.next = 6;
17270
18157
  break;
17271
18158
  }
17272
- return _context7.abrupt("return", locationPromise);
17273
- case 4:
18159
+ return _context20.abrupt("return", locationPromise);
18160
+ case 6:
17274
18161
  // console.log('runing')
17275
18162
  runing = true;
17276
18163
  locationPromise = getLocationPromise();
17277
- _context7.next = 8;
18164
+ _context20.next = 10;
17278
18165
  return locationPromise;
17279
- case 8:
17280
- locationRes = _context7.sent;
18166
+ case 10:
18167
+ locationRes = _context20.sent;
17281
18168
  runing = false;
17282
18169
  if (locationRes) {
17283
18170
  datetime = Date.now();
17284
18171
  lastLocation = locationRes;
17285
18172
  }
17286
- return _context7.abrupt("return", locationRes);
17287
- case 12:
18173
+ return _context20.abrupt("return", locationRes);
18174
+ case 14:
17288
18175
  case "end":
17289
- return _context7.stop();
18176
+ return _context20.stop();
17290
18177
  }
17291
- }, _callee7);
18178
+ }, _callee20);
17292
18179
  }));
17293
18180
  return _getLocation.apply(this, arguments);
17294
18181
  }
17295
- function getDistance(_x2, _x3) {
17296
- return _getDistance.apply(this, arguments);
17297
- } // // 两个经纬度距离计算
17298
- // function getDistance (latlng1, latlng2) {
17299
- // console.log(latlng1)
17300
- // console.log(latlng2)
17301
- // const lng1 = Number(latlng1[0])
17302
- // const lat1 = Number(latlng1[1])
17303
- // const lng2 = Number(latlng2[0])
17304
- // const lat2 = Number(latlng2[1])
17305
- // const radLat1 = (lat1 * Math.PI) / 180.0
17306
- // const radLat2 = (lat2 * Math.PI) / 180.0
17307
- // const a = radLat1 - radLat2
17308
- // const b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0
17309
- // let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)))
17310
- // s = s * 6378.137 // EARTH_RADIUS
17311
- // s = Math.round(s * 10000) / 10000
17312
- // return s * 1000
17313
- // }
17314
- function _getDistance() {
17315
- _getDistance = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee8(p1, p2) {
17316
- return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
17317
- while (1) switch (_context8.prev = _context8.next) {
18182
+ var getAddress = /*#__PURE__*/function () {
18183
+ var _ref18 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee18(position) {
18184
+ var address;
18185
+ return _regeneratorRuntime$1().wrap(function _callee18$(_context18) {
18186
+ while (1) switch (_context18.prev = _context18.next) {
17318
18187
  case 0:
17319
- _context8.next = 2;
17320
- return init();
18188
+ _context18.next = 2;
18189
+ return mapService.init();
17321
18190
  case 2:
17322
- return _context8.abrupt("return", AMap.GeometryUtil.distance(p1, p2));
17323
- case 3:
18191
+ address = ''; // 先统一用ipaas解析 因为需要储存一致的地址格式(各地图商逆地址查询的地址格式不统一)
18192
+ // 如果不行再按照各地图商解析
18193
+ _context18.next = 5;
18194
+ return getAddressByIpaas(position);
18195
+ case 5:
18196
+ address = _context18.sent;
18197
+ if (address) {
18198
+ _context18.next = 23;
18199
+ break;
18200
+ }
18201
+ if (!(mapService.type === 'amap')) {
18202
+ _context18.next = 13;
18203
+ break;
18204
+ }
18205
+ _context18.next = 10;
18206
+ return getAddressByAmap(position);
18207
+ case 10:
18208
+ address = _context18.sent;
18209
+ _context18.next = 23;
18210
+ break;
18211
+ case 13:
18212
+ if (!(mapService.type === 'tencent')) {
18213
+ _context18.next = 19;
18214
+ break;
18215
+ }
18216
+ _context18.next = 16;
18217
+ return getAddressByTMap(position);
18218
+ case 16:
18219
+ address = _context18.sent;
18220
+ _context18.next = 23;
18221
+ break;
18222
+ case 19:
18223
+ if (!(mapService.type === 'baidu')) {
18224
+ _context18.next = 23;
18225
+ break;
18226
+ }
18227
+ _context18.next = 22;
18228
+ return getAddressByBmap(position);
18229
+ case 22:
18230
+ address = _context18.sent;
18231
+ case 23:
18232
+ return _context18.abrupt("return", address);
18233
+ case 24:
17324
18234
  case "end":
17325
- return _context8.stop();
18235
+ return _context18.stop();
17326
18236
  }
17327
- }, _callee8);
18237
+ }, _callee18);
17328
18238
  }));
17329
- return _getDistance.apply(this, arguments);
17330
- }
18239
+ return function getAddress(_x13) {
18240
+ return _ref18.apply(this, arguments);
18241
+ };
18242
+ }();
18243
+ // const getDistance = async (p1: [number, number], p2: [number, number]) => {
18244
+ // await mapService.init()
18245
+ // return window.AMap.GeometryUtil.distance(p1, p2)
18246
+ // }
18247
+ // 两个经纬度距离计算
18248
+ var getDistance = /*#__PURE__*/function () {
18249
+ var _ref19 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee19(latlng1, latlng2) {
18250
+ var lng1, lat1, lng2, lat2, radLat1, radLat2, a, b, s;
18251
+ return _regeneratorRuntime$1().wrap(function _callee19$(_context19) {
18252
+ while (1) switch (_context19.prev = _context19.next) {
18253
+ case 0:
18254
+ // console.log(latlng1)
18255
+ // console.log(latlng2)
18256
+ lng1 = Number(latlng1[0]);
18257
+ lat1 = Number(latlng1[1]);
18258
+ lng2 = Number(latlng2[0]);
18259
+ lat2 = Number(latlng2[1]);
18260
+ radLat1 = lat1 * Math.PI / 180.0;
18261
+ radLat2 = lat2 * Math.PI / 180.0;
18262
+ a = radLat1 - radLat2;
18263
+ b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
18264
+ s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
18265
+ s = s * 6378.137; // EARTH_RADIUS
18266
+ s = Math.round(s * 10000) / 10000;
18267
+ return _context19.abrupt("return", s * 1000);
18268
+ case 12:
18269
+ case "end":
18270
+ return _context19.stop();
18271
+ }
18272
+ }, _callee19);
18273
+ }));
18274
+ return function getDistance(_x14, _x15) {
18275
+ return _ref19.apply(this, arguments);
18276
+ };
18277
+ }();
17331
18278
 
17332
18279
  var modulekey = '';
17333
18280
  var SpuConfig = /*#__PURE__*/function () {
@@ -51900,6 +52847,38 @@ var uploadService = {
51900
52847
  upload: upload
51901
52848
  };
51902
52849
 
52850
+ var isinit = false;
52851
+ var load = function load(options) {
52852
+ var _options$AMapUI;
52853
+ var AMapKey = getAMapKey();
52854
+ if (!isinit) {
52855
+ isinit = true;
52856
+ if (AMapKey.securityJsCode) {
52857
+ // 本来想改成取消安全秘钥 但考虑到其他spu有可能用了需要安全秘钥的功能 因此不取消
52858
+ // 如果不设置安全秘钥的话 js-api的逆地址查询不成功 返回 INVALID_USER_SCODE 改成用ipaas服务查询
52859
+ window._AMapSecurityConfig = {
52860
+ securityJsCode: AMapKey.securityJsCode
52861
+ };
52862
+ }
52863
+ }
52864
+ // 不开放地址查询 改用ipaas
52865
+ var plugin = ['AMap.Geolocation'];
52866
+ // plugin.push('AMap.Geocoder') // 不开放地址查询 改用ipaas
52867
+ return AMapLoader$1.load({
52868
+ key: AMapKey.key,
52869
+ version: '2.0',
52870
+ plugins: (options === null || options === void 0 ? void 0 : options.plugins) || plugin,
52871
+ AMapUI: {
52872
+ version: '1.1',
52873
+ plugins: (options === null || options === void 0 || (_options$AMapUI = options.AMapUI) === null || _options$AMapUI === void 0 ? void 0 : _options$AMapUI.plugins) || []
52874
+ }
52875
+ });
52876
+ };
52877
+ var AMapLoader = {
52878
+ AMapKey: AMapKey,
52879
+ load: load
52880
+ };
52881
+
51903
52882
  // import SpuLoadding from './loadding'
51904
52883
  // import SpuExpandexp from './expandexp'
51905
52884
  var index = {
@@ -69036,4 +70015,4 @@ var SPUWebPlugin = {
69036
70015
  version: version
69037
70016
  };
69038
70017
 
69039
- export { AMapLoader, Module, normalAxios$1 as apaasAxios, normalAxios$1 as axios, checkLogin, index as components, SPUWebPlugin as default, downloadService, expandexp, functionCheck, getDistance, getLocation, getRefreshToken, getToken, getTokenExpires, getUniqueid, getUser, v4 as getUuid, globalConfig, globalOptions, isInApp, isdebugger, isvirtuallocation, lsProxy, setTitle, singleLogin, spuAxios, spuConfig, ssProxy, updateToken, uploadService, wxworkSuite };
70018
+ export { AMapLoader, Module, normalAxios$1 as apaasAxios, normalAxios$1 as axios, checkLogin, index as components, SPUWebPlugin as default, downloadService, expandexp, functionCheck, getDistance, getLocation, getRefreshToken, getToken, getTokenExpires, getUniqueid, getUser, v4 as getUuid, globalConfig, globalOptions, isInApp, isdebugger, isvirtuallocation, lsProxy, mapService, setTitle, singleLogin, spuAxios, spuConfig, ssProxy, updateToken, uploadService, wxworkSuite };