@smart100/spu-web-plugin 1.0.8 → 1.0.9

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.9";
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,1249 @@ 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
+ }
17075
+ _createClass$1(MapService, [{
17076
+ key: "isLbssettingEnable",
17077
+ get: function get() {
17078
+ var _tenantSetting$get;
17079
+ return ((_tenantSetting$get = tenantSetting.get('lbssetting')) === null || _tenantSetting$get === void 0 ? void 0 : _tenantSetting$get.enable) === '1';
17080
+ }
17081
+ }, {
17082
+ key: "setting",
17083
+ get: function get() {
17084
+ var _tenantSetting$get2;
17085
+ return (_tenantSetting$get2 = tenantSetting.get('lbssetting')) === null || _tenantSetting$get2 === void 0 ? void 0 : _tenantSetting$get2.setting;
17086
+ }
17087
+ }, {
17088
+ key: "key",
17089
+ get: function get() {
17090
+ if (this.isLbssettingEnable) {
17091
+ var _this$setting;
17092
+ 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) || '';
17093
+ } else {
17094
+ return AMapKey.production.key;
17095
+ }
17096
+ }
17097
+ }, {
17098
+ key: "secretkey",
17099
+ get: function get() {
17100
+ if (this.isLbssettingEnable) {
17101
+ var _this$setting2;
17102
+ 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) || '';
17103
+ } else {
17104
+ return AMapKey.production.securityJsCode;
17105
+ }
17106
+ }
17107
+ }, {
17108
+ key: "type",
17109
+ get: function get() {
17110
+ if (this.isLbssettingEnable) {
17111
+ var _this$setting3;
17112
+ return ((_this$setting3 = this.setting) === null || _this$setting3 === void 0 ? void 0 : _this$setting3.type) || 'amap';
17113
+ } else {
17114
+ return 'amap';
17115
+ }
17116
+ }
17117
+ }, {
17118
+ key: "AMap",
17119
+ get: function get() {
17120
+ if (!this.isInit || this.type !== 'amap') {
17121
+ return null;
17122
+ }
17123
+ return window.AMap;
17124
+ }
17125
+ }, {
17126
+ key: "TMap",
17127
+ get: function get() {
17128
+ if (!this.isInit || this.type !== 'tencent') {
17129
+ return null;
17130
+ }
17131
+ return window.TMap;
17132
+ }
17133
+ }, {
17134
+ key: "BMap",
17135
+ get: function get() {
17136
+ if (!this.isInit || this.type !== 'baidu') {
17137
+ return null;
17138
+ }
17139
+ return window.BMap;
17140
+ }
17141
+ }, {
17142
+ key: "init",
17143
+ value: function () {
17144
+ var _init = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
17145
+ var type;
17146
+ return _regeneratorRuntime$1().wrap(function _callee$(_context) {
17147
+ while (1) switch (_context.prev = _context.next) {
17148
+ case 0:
17149
+ if (!this.isInit) {
17150
+ _context.next = 2;
17151
+ break;
17152
+ }
17153
+ return _context.abrupt("return");
17154
+ case 2:
17155
+ this.isInit = true;
17156
+ type = this.type; // if (process.env.NODE_ENV === 'development') {
17157
+ // type = 'baidu'
17158
+ // }
17159
+ if (!(type === 'tencent')) {
17160
+ _context.next = 9;
17161
+ break;
17162
+ }
17163
+ _context.next = 7;
17164
+ return this.initTecent();
17165
+ case 7:
17166
+ _context.next = 17;
17167
+ break;
17168
+ case 9:
17169
+ if (!(type === 'amap')) {
17170
+ _context.next = 14;
17171
+ break;
17172
+ }
17173
+ _context.next = 12;
17174
+ return this.initAmap();
17175
+ case 12:
17176
+ _context.next = 17;
17177
+ break;
17178
+ case 14:
17179
+ if (!(type === 'baidu')) {
17180
+ _context.next = 17;
17181
+ break;
17182
+ }
17183
+ _context.next = 17;
17184
+ return this.initBaidu();
17185
+ case 17:
17186
+ case "end":
17187
+ return _context.stop();
17188
+ }
17189
+ }, _callee, this);
17190
+ }));
17191
+ function init() {
17192
+ return _init.apply(this, arguments);
17193
+ }
17194
+ return init;
17195
+ }() // reset() {
17196
+ // this.isInit = false
17197
+ // }
17198
+ }, {
17199
+ key: "initTecent",
17200
+ value: function () {
17201
+ var _initTecent = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2() {
17202
+ return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
17203
+ while (1) switch (_context2.prev = _context2.next) {
17204
+ case 0:
17205
+ _context2.next = 2;
17206
+ return importJS("https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=".concat(this.key),
17207
+ // `https://map.qq.com/api/gljs?v=1.exp&key=${this.key}`,
17208
+ 'TMap');
17209
+ case 2:
17210
+ _context2.next = 4;
17211
+ return delay(300);
17212
+ case 4:
17213
+ case "end":
17214
+ return _context2.stop();
17215
+ }
17216
+ }, _callee2, this);
17217
+ }));
17218
+ function initTecent() {
17219
+ return _initTecent.apply(this, arguments);
17220
+ }
17221
+ return initTecent;
17222
+ }()
17223
+ }, {
17224
+ key: "initAmap",
17225
+ value: function () {
17226
+ var _initAmap = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3() {
17227
+ var plugin, AMap;
17228
+ return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
17229
+ while (1) switch (_context3.prev = _context3.next) {
17230
+ case 0:
17231
+ // if (this.secretkey) {
17232
+ // window._AMapSecurityConfig = {
17233
+ // securityJsCode: this.secretkey
17234
+ // }
17235
+ // }
17236
+ plugin = ['AMap.Geolocation']; // plugin.push('AMap.Geocoder') // 不开放地址查询 改用ipaas
17237
+ _context3.next = 3;
17238
+ return AMapLoader$1.load({
17239
+ key: this.key,
17240
+ version: '2.0',
17241
+ plugins: plugin,
17242
+ AMapUI: {
17243
+ version: '1.1',
17244
+ plugins: []
17245
+ }
17246
+ });
17247
+ case 3:
17248
+ AMap = _context3.sent;
17249
+ window.AMap = AMap;
17250
+ // console.log(window)
17251
+ // console.log(window.AMap)
17252
+ // console.log(window.AMapUI)
17253
+ // console.log(window.AMapLoader)
17254
+ // console.log(window.AMap === aaaa)
17255
+ case 5:
17256
+ case "end":
17257
+ return _context3.stop();
17258
+ }
17259
+ }, _callee3, this);
17260
+ }));
17261
+ function initAmap() {
17262
+ return _initAmap.apply(this, arguments);
17263
+ }
17264
+ return initAmap;
17265
+ }()
17266
+ }, {
17267
+ key: "initBaidu",
17268
+ value: function () {
17269
+ var _initBaidu = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4() {
17270
+ var _this = this;
17271
+ return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
17272
+ while (1) switch (_context4.prev = _context4.next) {
17273
+ case 0:
17274
+ return _context4.abrupt("return", new Promise(function (resolve, reject) {
17275
+ window.__baiduMapInitial = function () {
17276
+ // 启用google标准坐标体系
17277
+ // coordsType 指定输入输出的坐标类型,BMAP_COORD_GCJ02为gcj02坐标,BMAP_COORD_BD09为bd0ll坐标,默认为BMAP_COORD_BD09。
17278
+ window.BMap.coordType = 'BMAP_COORD_GCJ02';
17279
+ resolve(null);
17280
+ };
17281
+ var script = document.createElement('script');
17282
+ // 使用最新 3.0 api https://lbsyun.baidu.com/index.php?title=jspopular3.0
17283
+ script.src = "https://api.map.baidu.com/api?v=3.0&ak=".concat(_this.key, "&callback=__baiduMapInitial");
17284
+ // script.src = `https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=${this.key}&callback=__baiduMapInitial`
17285
+ script.onerror = function (err) {
17286
+ reject(err);
17287
+ };
17288
+ document.body.appendChild(script);
17289
+ }));
17290
+ case 1:
17291
+ case "end":
17292
+ return _context4.stop();
17293
+ }
17294
+ }, _callee4);
17295
+ }));
17296
+ function initBaidu() {
17297
+ return _initBaidu.apply(this, arguments);
17298
+ }
17299
+ return initBaidu;
17300
+ }()
17301
+ }]);
17302
+ return MapService;
17303
+ }();
17304
+ var mapService = new MapService();
17305
+
17306
+ function transformLat(x, y) {
17307
+ 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));
17308
+ ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0;
17309
+ ret += (20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin(y / 3.0 * Math.PI)) * 2.0 / 3.0;
17310
+ ret += (160.0 * Math.sin(y / 12.0 * Math.PI) + 320 * Math.sin(y * Math.PI / 30.0)) * 2.0 / 3.0;
17311
+ return ret;
17312
+ }
17313
+ function transformLon(x, y) {
17314
+ var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
17315
+ ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0;
17316
+ ret += (20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin(x / 3.0 * Math.PI)) * 2.0 / 3.0;
17317
+ ret += (150.0 * Math.sin(x / 12.0 * Math.PI) + 300.0 * Math.sin(x / 30.0 * Math.PI)) * 2.0 / 3.0;
17318
+ return ret;
17319
+ }
17320
+ function outOfChina(lng, lat) {
17321
+ return lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271;
17322
+ }
17323
+ function delta(lng, lat) {
17324
+ var a = 6378245.0; // 地球长半轴
17325
+ var ee = 0.00669342162296594323; // 扁率
17326
+ var dLat = transformLat(lng - 105.0, lat - 35.0);
17327
+ var dLng = transformLon(lng - 105.0, lat - 35.0);
17328
+ var radLat = lat / 180.0 * Math.PI;
17329
+ var magic = Math.sin(radLat);
17330
+ magic = 1 - ee * magic * magic;
17331
+ var sqrtMagic = Math.sqrt(magic);
17332
+ dLat = dLat * 180.0 / (a * (1 - ee) / (magic * sqrtMagic) * Math.PI);
17333
+ dLng = dLng * 180.0 / (a / sqrtMagic * Math.cos(radLat) * Math.PI);
17334
+ return {
17335
+ lat: dLat,
17336
+ lng: dLng
17337
+ };
17338
+ }
17339
+ function wgs84ToGcj02(lng, lat) {
17340
+ if (outOfChina(lng, lat)) {
17341
+ return {
17342
+ lng: lng,
17343
+ lat: lat
17344
+ };
17345
+ }
17346
+ var d = delta(lng, lat);
17347
+ return {
17348
+ lng: lng + d.lng,
17349
+ lat: lat + d.lat
17350
+ };
17351
+ }
17352
+ /**
17353
+ * 坐标常量说明:
17354
+ * COORDINATES_WGS84 = 1, WGS84坐标
17355
+ * COORDINATES_WGS84_MC = 2, WGS84的平面墨卡托坐标
17356
+ * COORDINATES_GCJ02 = 3,GCJ02坐标
17357
+ * COORDINATES_GCJ02_MC = 4, GCJ02的平面墨卡托坐标
17358
+ * COORDINATES_BD09 = 5, 百度bd09经纬度坐标
17359
+ * COORDINATES_BD09_MC = 6,百度bd09墨卡托坐标
17360
+ * COORDINATES_MAPBAR = 7,mapbar地图坐标
17361
+ * COORDINATES_51 = 8,51地图坐标
17362
+ */
17363
+ var BMapTransformBD09ToGCJ02Points = function BMapTransformBD09ToGCJ02Points(points) {
17364
+ return new Promise(function (resolve, reject) {
17365
+ new window.BMap.Convertor().translate(points, 5, 3, function (data) {
17366
+ if (!data.status) {
17367
+ resolve(data.points);
17368
+ } else {
17369
+ console.error(data);
17370
+ // reject(data.status)
17371
+ resolve(points);
17372
+ }
17373
+ });
17374
+ });
17375
+ };
17376
+
17377
+ var cachetime = 30000; // 缓存时间30秒
16993
17378
  var datetime = null;
16994
17379
  var lastLocation = null;
16995
17380
  var runing = false;
16996
17381
  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() {
17382
+ // app端默认坐标为 gcj02
17383
+ var getLocationByNative = /*#__PURE__*/function () {
17384
+ var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
17002
17385
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
17003
17386
  while (1) switch (_context.prev = _context.next) {
17004
17387
  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:
17388
+ console.log('getLocationByNative start...');
17389
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
17390
+ var isload = false;
17391
+ setTimeout(function () {
17392
+ if (!isload) {
17393
+ console.error('getLocationByNative fail: timeout 30000');
17394
+ resolve(null);
17395
+ }
17396
+ }, 30000);
17397
+ window.Native.getLocation(function (res, error, status) {
17398
+ // console.log('getLocation res', res)
17399
+ // console.log('getLocation error', error)
17400
+ // console.log('getLocation status', status)
17401
+ isload = true;
17402
+ if (res && res !== null && res !== void 0 && res.longitude && res !== null && res !== void 0 && res.latitude) {
17403
+ var result = {
17404
+ longitude: res.longitude.toString(),
17405
+ latitude: res.latitude.toString(),
17406
+ address: res.address || ''
17407
+ };
17408
+ console.log("getLocationByNative success: ".concat(JSON.stringify(result)));
17409
+ resolve(result);
17410
+ } else {
17411
+ console.error('getLocationByNative fail');
17412
+ resolve(null);
17413
+ }
17414
+ });
17415
+ }));
17416
+ case 2:
17024
17417
  case "end":
17025
17418
  return _context.stop();
17026
17419
  }
17027
17420
  }, _callee);
17028
17421
  }));
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() {
17422
+ return function getLocationByNative() {
17423
+ return _ref.apply(this, arguments);
17424
+ };
17425
+ }();
17426
+ // 浏览器定位: 需要开启https
17427
+ var getLocationByNavigator = /*#__PURE__*/function () {
17428
+ var _ref2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2() {
17036
17429
  return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
17037
17430
  while (1) switch (_context2.prev = _context2.next) {
17038
17431
  case 0:
17039
- _context2.next = 2;
17040
- return init();
17041
- case 2:
17432
+ console.log('getLocationByNavigator start...');
17042
17433
  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');
17434
+ if ('geolocation' in navigator) {
17435
+ var time = setTimeout(function () {
17436
+ console.error('getLocationByNavigator fail: timeout 5000');
17059
17437
  resolve(null);
17060
- }
17061
- });
17438
+ }, 5000);
17439
+ navigator.geolocation.getCurrentPosition(function (position) {
17440
+ // console.log(position)
17441
+ // debugger
17442
+ clearTimeout(time);
17443
+ if (position.coords) {
17444
+ // 浏览器定位默认返回 WGS84 坐标 需要转化为 GCJ02 坐标
17445
+ var Gcj02 = wgs84ToGcj02(position.coords.longitude, position.coords.latitude);
17446
+ // console.log(Gcj02)
17447
+ // debugger
17448
+ var result = {
17449
+ latitude: Gcj02.lat.toString(),
17450
+ longitude: Gcj02.lng.toString()
17451
+ };
17452
+ console.log("getLocationByNavigator success: ".concat(JSON.stringify(result)));
17453
+ resolve(result);
17454
+ } else {
17455
+ console.error('getLocationByNavigator fail');
17456
+ resolve(null);
17457
+ }
17458
+ }, function () {
17459
+ clearTimeout(time);
17460
+ console.error('getLocationByNavigator fail');
17461
+ resolve(null);
17462
+ });
17463
+ } else {
17464
+ console.error('getLocationByNavigator fail: navigator.geolocation not support');
17465
+ resolve(null);
17466
+ }
17062
17467
  }));
17063
- case 3:
17468
+ case 2:
17064
17469
  case "end":
17065
17470
  return _context2.stop();
17066
17471
  }
17067
17472
  }, _callee2);
17068
17473
  }));
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() {
17474
+ return function getLocationByNavigator() {
17475
+ return _ref2.apply(this, arguments);
17476
+ };
17477
+ }();
17478
+ // ipaas ip 定位
17479
+ var getIPLocationByIpaas = /*#__PURE__*/function () {
17480
+ var _ref3 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3(ip) {
17076
17481
  return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
17077
17482
  while (1) switch (_context3.prev = _context3.next) {
17078
17483
  case 0:
17484
+ console.log('getIPLocationByIpaas start...');
17079
17485
  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 || ''
17486
+ var AMapKey = getAMapKey();
17487
+ normalAxios$1.post('https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001815271', {
17488
+ key: AMapKey.key,
17489
+ ip: ip || ''
17490
+ }).then(function (res) {
17491
+ // console.log(res)
17492
+ // debugger
17493
+ // res.data.rectangle = '113.1017375,22.93212254;113.6770499,23.3809537'
17494
+ if (res.data.rectangle) {
17495
+ var rectangle = res.data.rectangle;
17496
+ var rects = rectangle.split(';').map(function (rect) {
17497
+ var _rect$split = rect.split(','),
17498
+ _rect$split2 = _slicedToArray(_rect$split, 2),
17499
+ longitude = _rect$split2[0],
17500
+ latitude = _rect$split2[1];
17501
+ return {
17502
+ longitude: Number(longitude),
17503
+ latitude: Number(latitude)
17504
+ };
17097
17505
  });
17506
+ var result = {
17507
+ longitude: ((rects[0].longitude + rects[1].longitude) / 2).toString(),
17508
+ latitude: ((rects[0].latitude + rects[1].latitude) / 2).toString()
17509
+ };
17510
+ console.log("getIPLocationByIpaas success: ".concat(JSON.stringify(result)));
17511
+ resolve(result);
17098
17512
  } else {
17099
- console.error('getSpuLocation fail');
17513
+ console.error('getIPLocationByIpaas fail');
17100
17514
  resolve(null);
17101
17515
  }
17516
+ })["catch"](function (err) {
17517
+ console.error(err);
17518
+ console.error('getIPLocationByIpaas fail');
17519
+ resolve(null);
17102
17520
  });
17103
17521
  }));
17104
- case 1:
17522
+ case 2:
17105
17523
  case "end":
17106
17524
  return _context3.stop();
17107
17525
  }
17108
17526
  }, _callee3);
17109
17527
  }));
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) {
17528
+ return function getIPLocationByIpaas(_x) {
17529
+ return _ref3.apply(this, arguments);
17530
+ };
17531
+ }();
17532
+ // ipaas 逆地址解析
17533
+ var getAddressByIpaas = /*#__PURE__*/function () {
17534
+ var _ref4 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(position) {
17535
+ return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
17536
+ while (1) switch (_context5.prev = _context5.next) {
17119
17537
  case 0:
17120
- _context4.next = 2;
17121
- return init();
17538
+ console.log('getAddressByIpaas start...');
17539
+ // 如果不设置安全秘钥的话 js-api的逆地址查询不成功 返回 INVALID_USER_SCODE 改成用ipaas服务查询
17540
+ return _context5.abrupt("return", new Promise( /*#__PURE__*/function () {
17541
+ var _ref5 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4(resolve, reject) {
17542
+ var _result$data, AMapKey, result, address;
17543
+ return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
17544
+ while (1) switch (_context4.prev = _context4.next) {
17545
+ case 0:
17546
+ if (!position) {
17547
+ _context4.next = 15;
17548
+ break;
17549
+ }
17550
+ _context4.prev = 1;
17551
+ AMapKey = getAMapKey();
17552
+ _context4.next = 5;
17553
+ return normalAxios$1.post('https://silkroad.wxchina.com/api/openapi/publishEvent?topic=xw-listener&subtopic=xw-listener&apicaseid=6684389338001809906', {
17554
+ longitude: position.longitude,
17555
+ latitude: position.latitude,
17556
+ key: AMapKey.key
17557
+ // extensions: 'all'
17558
+ });
17559
+ case 5:
17560
+ result = _context4.sent;
17561
+ // console.log(result)
17562
+ address = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.formatted_address;
17563
+ if (address) {
17564
+ console.log("getAddressByIpaas success: ".concat(address));
17565
+ resolve(address);
17566
+ } else {
17567
+ console.error('getAddressByIpaas fail');
17568
+ resolve('');
17569
+ }
17570
+ _context4.next = 15;
17571
+ break;
17572
+ case 10:
17573
+ _context4.prev = 10;
17574
+ _context4.t0 = _context4["catch"](1);
17575
+ console.error(_context4.t0);
17576
+ console.error('getAddressByIpaas fail');
17577
+ resolve('');
17578
+ case 15:
17579
+ case "end":
17580
+ return _context4.stop();
17581
+ }
17582
+ }, _callee4, null, [[1, 10]]);
17583
+ }));
17584
+ return function (_x3, _x4) {
17585
+ return _ref5.apply(this, arguments);
17586
+ };
17587
+ }()));
17122
17588
  case 2:
17123
- return _context4.abrupt("return", new Promise(function (resolve, reject) {
17124
- geolocation.getCityInfo(function (status, result) {
17589
+ case "end":
17590
+ return _context5.stop();
17591
+ }
17592
+ }, _callee5);
17593
+ }));
17594
+ return function getAddressByIpaas(_x2) {
17595
+ return _ref4.apply(this, arguments);
17596
+ };
17597
+ }();
17598
+ // 高德定位
17599
+ var getLocationByAmap = /*#__PURE__*/function () {
17600
+ var _ref6 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6() {
17601
+ return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
17602
+ while (1) switch (_context6.prev = _context6.next) {
17603
+ case 0:
17604
+ console.log('getLocationByAmap start...');
17605
+ return _context6.abrupt("return", new Promise(function (resolve, reject) {
17606
+ var geolocation = new window.AMap.Geolocation({
17607
+ enableHighAccuracy: true,
17608
+ timeout: 15000
17609
+ });
17610
+ geolocation.getCurrentPosition(function (status, res) {
17611
+ // console.log(status, result)
17612
+ // debugger
17125
17613
  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({
17614
+ var _res$position = res.position,
17615
+ lng = _res$position.lng,
17616
+ lat = _res$position.lat;
17617
+ var result = {
17131
17618
  longitude: lng.toString(),
17132
- latitude: lat.toString(),
17133
- address: ''
17134
- });
17619
+ latitude: lat.toString()
17620
+ };
17621
+ console.log("getLocationByAmap success: ".concat(JSON.stringify(result)));
17622
+ resolve(result);
17135
17623
  } else {
17136
- // reject(new Error('getAmapCityLocation fail'))
17137
- console.error('getAmapCityLocation fail');
17624
+ console.error('getLocationByAmap fail');
17138
17625
  resolve(null);
17139
17626
  }
17140
17627
  });
17141
17628
  }));
17142
- case 3:
17629
+ case 2:
17143
17630
  case "end":
17144
- return _context4.stop();
17631
+ return _context6.stop();
17145
17632
  }
17146
- }, _callee4);
17633
+ }, _callee6);
17147
17634
  }));
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) {
17635
+ return function getLocationByAmap() {
17636
+ return _ref6.apply(this, arguments);
17637
+ };
17638
+ }();
17639
+ // 高德城市定位
17640
+ var getCityLocationByAmap = /*#__PURE__*/function () {
17641
+ var _ref7 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee7() {
17642
+ return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
17643
+ while (1) switch (_context7.prev = _context7.next) {
17644
+ case 0:
17645
+ console.log('getCityLocationByAmap start...');
17646
+ return _context7.abrupt("return", new Promise(function (resolve, reject) {
17647
+ var geolocation = new window.AMap.Geolocation({
17648
+ enableHighAccuracy: true,
17649
+ timeout: 15000
17650
+ });
17651
+ geolocation.getCityInfo(function (status, res) {
17652
+ // console.log(res)
17653
+ // debugger
17654
+ if (status === 'complete') {
17655
+ var lng = res.position[0].toString();
17656
+ var lat = res.position[1].toString();
17657
+ var result = {
17658
+ longitude: lng.toString(),
17659
+ latitude: lat.toString()
17660
+ };
17661
+ console.log("getCityLocationByAmap success: ".concat(JSON.stringify(result)));
17662
+ resolve(result);
17663
+ } else {
17664
+ console.error('getCityLocationByAmap fail');
17665
+ resolve(null);
17666
+ }
17667
+ });
17668
+ }));
17669
+ case 2:
17670
+ case "end":
17671
+ return _context7.stop();
17672
+ }
17673
+ }, _callee7);
17674
+ }));
17675
+ return function getCityLocationByAmap() {
17676
+ return _ref7.apply(this, arguments);
17677
+ };
17678
+ }();
17679
+ // 高德逆地址解析
17680
+ var getAddressByAmap = /*#__PURE__*/function () {
17681
+ var _ref8 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee8(position) {
17682
+ var address;
17683
+ return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
17684
+ while (1) switch (_context8.prev = _context8.next) {
17685
+ case 0:
17686
+ console.log('getAddressByAmap start...');
17687
+ console.log('getAddressByAmap changeto getAddressByIpaas');
17688
+ // return new Promise((resolve, reject) => {
17689
+ // if (position) {
17690
+ // new window.AMap.Geocoder({
17691
+ // city: '',
17692
+ // radius: 500
17693
+ // }).getAddress([position.longitude, position.latitude], (status: string, result: any) => {
17694
+ // if (status === 'complete' && result.info === 'OK' && result.regeocode) {
17695
+ // resolve(result?.regeocode?.formattedAddress || '')
17696
+ // } else {
17697
+ // console.error('getAddressByAmap fail')
17698
+ // resolve('')
17699
+ // }
17700
+ // })
17701
+ // }
17702
+ // })
17703
+ // 如果不设置安全秘钥的话 js-api的逆地址查询不成功 返回 INVALID_USER_SCODE 改成用ipaas服务查询
17704
+ _context8.next = 4;
17705
+ return getAddressByIpaas(position);
17706
+ case 4:
17707
+ address = _context8.sent;
17708
+ return _context8.abrupt("return", address);
17709
+ case 6:
17710
+ case "end":
17711
+ return _context8.stop();
17712
+ }
17713
+ }, _callee8);
17714
+ }));
17715
+ return function getAddressByAmap(_x5) {
17716
+ return _ref8.apply(this, arguments);
17717
+ };
17718
+ }();
17719
+ // 腾讯ip定位:通过终端设备IP地址获取其当前所在地理位置,精确到市级,常用于显示当地城市天气预报、初始化用户城市等非精确定位场景。
17720
+ var getIPLocationByTMap = /*#__PURE__*/function () {
17721
+ var _ref9 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee9(ip) {
17722
+ return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
17723
+ while (1) switch (_context9.prev = _context9.next) {
17157
17724
  case 0:
17158
- _context5.next = 2;
17159
- return init();
17725
+ console.log('getIPLocationByTMap start...');
17726
+ return _context9.abrupt("return", new Promise(function (resolve, reject) {
17727
+ var ipLocation = new window.TMap.service.IPLocation();
17728
+ var params = ip ? {
17729
+ ip: ip
17730
+ } : {};
17731
+ ipLocation.locate(params).then(function (res) {
17732
+ var result = {
17733
+ longitude: res.result.location.lng.toString(),
17734
+ latitude: res.result.location.lat.toString()
17735
+ };
17736
+ console.log("getIPLocationByTMap success: ".concat(JSON.stringify(result)));
17737
+ resolve(result);
17738
+ })["catch"](function (err) {
17739
+ console.error(err);
17740
+ console.error("getIPLocationByTMap fail: ".concat(JSON.stringify(err)));
17741
+ resolve(null);
17742
+ });
17743
+ }));
17160
17744
  case 2:
17161
- return _context5.abrupt("return", new Promise(function (resolve, reject) {
17745
+ case "end":
17746
+ return _context9.stop();
17747
+ }
17748
+ }, _callee9);
17749
+ }));
17750
+ return function getIPLocationByTMap(_x6) {
17751
+ return _ref9.apply(this, arguments);
17752
+ };
17753
+ }();
17754
+ // 腾讯逆地址解析
17755
+ var getAddressByTMap = /*#__PURE__*/function () {
17756
+ var _ref10 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee10(position) {
17757
+ return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
17758
+ while (1) switch (_context10.prev = _context10.next) {
17759
+ case 0:
17760
+ console.log('getAddressByTMap start...');
17761
+ return _context10.abrupt("return", new Promise(function (resolve, reject) {
17162
17762
  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
- }
17763
+ var location = new window.TMap.LatLng(position.latitude, position.longitude);
17764
+ // console.log(position)
17765
+ // console.log(location)
17766
+ // debugger
17767
+ new window.TMap.service.Geocoder().getAddress({
17768
+ location: location,
17769
+ getPoi: false
17770
+ }).then(function (res) {
17771
+ var _res$result, _res$result2;
17772
+ // console.log(res)
17773
+ // debugger
17774
+ 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);
17775
+ console.log("getAddressByTMap success: ".concat(address));
17776
+ resolve(address);
17777
+ })["catch"](function (err) {
17778
+ console.error(err);
17779
+ console.error("getAddressByTMap fail: ".concat(JSON.stringify(err)));
17780
+ resolve('');
17171
17781
  });
17172
17782
  }
17173
17783
  }));
17174
- case 3:
17784
+ case 2:
17175
17785
  case "end":
17176
- return _context5.stop();
17786
+ return _context10.stop();
17177
17787
  }
17178
- }, _callee5);
17788
+ }, _callee10);
17179
17789
  }));
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() {
17790
+ return function getAddressByTMap(_x7) {
17791
+ return _ref10.apply(this, arguments);
17792
+ };
17793
+ }();
17794
+ // 百度浏览器定位
17795
+ var getLocationByBMap = /*#__PURE__*/function () {
17796
+ var _ref11 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee12() {
17797
+ return _regeneratorRuntime$1().wrap(function _callee12$(_context12) {
17798
+ while (1) switch (_context12.prev = _context12.next) {
17799
+ case 0:
17800
+ console.log('getLocationByBMap start...');
17801
+ return _context12.abrupt("return", new Promise(function (resolve, reject) {
17802
+ new window.BMap.Geolocation().getCurrentPosition( /*#__PURE__*/function () {
17803
+ var _ref12 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee11(res) {
17804
+ var lng, lat, result;
17805
+ return _regeneratorRuntime$1().wrap(function _callee11$(_context11) {
17806
+ while (1) switch (_context11.prev = _context11.next) {
17807
+ case 0:
17808
+ if (res) {
17809
+ _context11.next = 4;
17810
+ break;
17811
+ }
17812
+ console.error('getLocationByBMap fail');
17813
+ resolve(null);
17814
+ return _context11.abrupt("return");
17815
+ case 4:
17816
+ // 初始化已经指定 window.BMap.coordType = 'BMAP_COORD_GCJ02' 定位返回的定位信息,外层[latitude,longitude]依然是BD09,然后point里面的是GCJ02
17817
+ // {
17818
+ // "accuracy": 150,
17819
+ // "altitude": null,
17820
+ // "altitudeAccuracy": null,
17821
+ // "heading": null,
17822
+ // "latitude": 39.915018933989,
17823
+ // "longitude": 116.40383261074,
17824
+ // "speed": null,
17825
+ // "timestamp": null,
17826
+ // "point": {
17827
+ // "lng": 116.39745977716758,
17828
+ // "lat": 39.908676092571405
17829
+ // },
17830
+ // "address": {
17831
+ // "country": "",
17832
+ // "city": "北京市",
17833
+ // "city_code": 0,
17834
+ // "district": "东城区",
17835
+ // "province": "北京市",
17836
+ // "street": "东华门大街",
17837
+ // "street_number": "66号"
17838
+ // }
17839
+ // }
17840
+ // 不用转换
17841
+ // const point: any = await BMapTransformBD09ToGCJ02Points([{
17842
+ // lng: res.longitude,
17843
+ // lat: res.latitude
17844
+ // }])
17845
+ // console.log(point)
17846
+ // debugger
17847
+ lng = res.point.lng.toString();
17848
+ lat = res.point.lat.toString();
17849
+ result = {
17850
+ longitude: lng,
17851
+ latitude: lat
17852
+ };
17853
+ console.log("getLocationByBMap success: ".concat(JSON.stringify(result)));
17854
+ resolve(result);
17855
+ case 9:
17856
+ case "end":
17857
+ return _context11.stop();
17858
+ }
17859
+ }, _callee11);
17860
+ }));
17861
+ return function (_x8) {
17862
+ return _ref12.apply(this, arguments);
17863
+ };
17864
+ }(), {
17865
+ enableHighAccuracy: true
17866
+ });
17867
+ }));
17868
+ case 2:
17869
+ case "end":
17870
+ return _context12.stop();
17871
+ }
17872
+ }, _callee12);
17873
+ }));
17874
+ return function getLocationByBMap() {
17875
+ return _ref11.apply(this, arguments);
17876
+ };
17877
+ }();
17878
+ // 百度城市定位
17879
+ var getCityLocationByBMap = /*#__PURE__*/function () {
17880
+ var _ref13 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee14() {
17881
+ return _regeneratorRuntime$1().wrap(function _callee14$(_context14) {
17882
+ while (1) switch (_context14.prev = _context14.next) {
17883
+ case 0:
17884
+ console.log('getCityLocationByBMap start...');
17885
+ return _context14.abrupt("return", new Promise(function (resolve, reject) {
17886
+ new window.BMap.LocalCity().get( /*#__PURE__*/function () {
17887
+ var _ref14 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee13(res) {
17888
+ var lng, lat, point, result;
17889
+ return _regeneratorRuntime$1().wrap(function _callee13$(_context13) {
17890
+ while (1) switch (_context13.prev = _context13.next) {
17891
+ case 0:
17892
+ // console.log(res)
17893
+ // debugger
17894
+ lng = res.center.lng.toString();
17895
+ lat = res.center.lat.toString();
17896
+ if (!(lng && lat)) {
17897
+ _context13.next = 11;
17898
+ break;
17899
+ }
17900
+ _context13.next = 5;
17901
+ return BMapTransformBD09ToGCJ02Points([{
17902
+ lng: lng,
17903
+ lat: lat
17904
+ }]);
17905
+ case 5:
17906
+ point = _context13.sent;
17907
+ // console.log(point)
17908
+ // debugger
17909
+ result = {
17910
+ longitude: point[0].lng,
17911
+ latitude: point[0].lat
17912
+ };
17913
+ console.log("getCityLocationByBMap success: ".concat(JSON.stringify(result)));
17914
+ resolve(result);
17915
+ _context13.next = 13;
17916
+ break;
17917
+ case 11:
17918
+ console.error('getCityLocationByBMap fail');
17919
+ resolve(null);
17920
+ case 13:
17921
+ case "end":
17922
+ return _context13.stop();
17923
+ }
17924
+ }, _callee13);
17925
+ }));
17926
+ return function (_x9) {
17927
+ return _ref14.apply(this, arguments);
17928
+ };
17929
+ }());
17930
+ }));
17931
+ case 2:
17932
+ case "end":
17933
+ return _context14.stop();
17934
+ }
17935
+ }, _callee14);
17936
+ }));
17937
+ return function getCityLocationByBMap() {
17938
+ return _ref13.apply(this, arguments);
17939
+ };
17940
+ }();
17941
+ // 百度逆地址解析
17942
+ var getAddressByBmap = /*#__PURE__*/function () {
17943
+ var _ref15 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee16(position) {
17944
+ return _regeneratorRuntime$1().wrap(function _callee16$(_context16) {
17945
+ while (1) switch (_context16.prev = _context16.next) {
17946
+ case 0:
17947
+ console.log('getAddressByBmap start...');
17948
+ return _context16.abrupt("return", new Promise( /*#__PURE__*/function () {
17949
+ var _ref16 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee15(resolve, reject) {
17950
+ var point;
17951
+ return _regeneratorRuntime$1().wrap(function _callee15$(_context15) {
17952
+ while (1) switch (_context15.prev = _context15.next) {
17953
+ case 0:
17954
+ if (position) {
17955
+ _context15.next = 4;
17956
+ break;
17957
+ }
17958
+ console.error('getAddressByBmap fail');
17959
+ resolve('');
17960
+ return _context15.abrupt("return");
17961
+ case 4:
17962
+ // // 把 GCJ02 转化为百度 BD09 地址
17963
+ // const points: any = await transformGCJ02ToBD09Points([{
17964
+ // lng: position.longitude,
17965
+ // lat: position.latitude
17966
+ // }])
17967
+ // const point = points[0]
17968
+ // 指定了 window.BMap.coordType = 'BMAP_COORD_GCJ02' 不需要转换
17969
+ point = new window.BMap.Point(position.longitude, position.latitude); // console.log(point)
17970
+ // debugger
17971
+ new window.BMap.Geocoder().getLocation(point, function (result) {
17972
+ // console.log(result)
17973
+ var address = result === null || result === void 0 ? void 0 : result.address;
17974
+ if (address) {
17975
+ console.log("getAddressByBmap success: ".concat(address));
17976
+ resolve(address);
17977
+ } else {
17978
+ console.error('getAddressByBmap fail');
17979
+ resolve('');
17980
+ }
17981
+ });
17982
+ case 6:
17983
+ case "end":
17984
+ return _context15.stop();
17985
+ }
17986
+ }, _callee15);
17987
+ }));
17988
+ return function (_x11, _x12) {
17989
+ return _ref16.apply(this, arguments);
17990
+ };
17991
+ }()));
17992
+ case 2:
17993
+ case "end":
17994
+ return _context16.stop();
17995
+ }
17996
+ }, _callee16);
17997
+ }));
17998
+ return function getAddressByBmap(_x10) {
17999
+ return _ref15.apply(this, arguments);
18000
+ };
18001
+ }();
18002
+ // 定位流程: 缓存 > 判断环境(APP,小程序,企微)基于环境获取定位 > 地图商高精度定位 > 地图商城市ip定位
18003
+ var getLocationPromise = /*#__PURE__*/function () {
18004
+ var _ref17 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee17() {
17187
18005
  var _window;
17188
18006
  var location;
17189
- return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
17190
- while (1) switch (_context6.prev = _context6.next) {
18007
+ return _regeneratorRuntime$1().wrap(function _callee17$(_context17) {
18008
+ while (1) switch (_context17.prev = _context17.next) {
17191
18009
  case 0:
17192
18010
  location = null; // 在 SPU 容器里使用 Native-API 的定位
17193
18011
  if (!((_window = window) !== null && _window !== void 0 && (_window = _window.Native) !== null && _window !== void 0 && _window.getLocation)) {
17194
- _context6.next = 5;
18012
+ _context17.next = 5;
17195
18013
  break;
17196
18014
  }
17197
- _context6.next = 4;
17198
- return getSpuLocation();
18015
+ _context17.next = 4;
18016
+ return getLocationByNative();
17199
18017
  case 4:
17200
- location = _context6.sent;
18018
+ location = _context17.sent;
17201
18019
  case 5:
17202
18020
  if (location) {
17203
- _context6.next = 9;
18021
+ _context17.next = 9;
17204
18022
  break;
17205
18023
  }
17206
- _context6.next = 8;
17207
- return getAmapLocation();
18024
+ _context17.next = 8;
18025
+ return getLocationByNavigator();
17208
18026
  case 8:
17209
- location = _context6.sent;
18027
+ location = _context17.sent;
17210
18028
  case 9:
17211
- if (!(!location && urlquery.isvirtuallocation)) {
17212
- _context6.next = 13;
18029
+ if (location) {
18030
+ _context17.next = 34;
17213
18031
  break;
17214
18032
  }
17215
- _context6.next = 12;
17216
- return getAmapCityLocation();
17217
- case 12:
17218
- location = _context6.sent;
18033
+ if (!(mapService.type === 'amap')) {
18034
+ _context17.next = 20;
18035
+ break;
18036
+ }
18037
+ _context17.next = 13;
18038
+ return getLocationByAmap();
17219
18039
  case 13:
17220
- // 测试虚拟定位
18040
+ location = _context17.sent;
18041
+ if (location) {
18042
+ _context17.next = 18;
18043
+ break;
18044
+ }
18045
+ _context17.next = 17;
18046
+ return getCityLocationByAmap();
18047
+ case 17:
18048
+ location = _context17.sent;
18049
+ case 18:
18050
+ _context17.next = 34;
18051
+ break;
18052
+ case 20:
18053
+ if (!(mapService.type === 'tencent')) {
18054
+ _context17.next = 26;
18055
+ break;
18056
+ }
18057
+ _context17.next = 23;
18058
+ return getIPLocationByTMap();
18059
+ case 23:
18060
+ location = _context17.sent;
18061
+ _context17.next = 34;
18062
+ break;
18063
+ case 26:
18064
+ if (!(mapService.type === 'baidu')) {
18065
+ _context17.next = 34;
18066
+ break;
18067
+ }
18068
+ _context17.next = 29;
18069
+ return getLocationByBMap();
18070
+ case 29:
18071
+ location = _context17.sent;
18072
+ if (location) {
18073
+ _context17.next = 34;
18074
+ break;
18075
+ }
18076
+ _context17.next = 33;
18077
+ return getCityLocationByBMap();
18078
+ case 33:
18079
+ location = _context17.sent;
18080
+ case 34:
18081
+ if (location) {
18082
+ _context17.next = 38;
18083
+ break;
18084
+ }
18085
+ _context17.next = 37;
18086
+ return getIPLocationByIpaas();
18087
+ case 37:
18088
+ location = _context17.sent;
18089
+ case 38:
18090
+ // 开发模式下为了方便测试提供虚拟定位
17221
18091
  if (!location && urlquery.isvirtuallocation) {
17222
18092
  location = {
17223
- longitude: '113.34331353081598',
17224
- latitude: '23.105349663628473',
17225
- address: ''
18093
+ longitude: '116.397454',
18094
+ latitude: '39.908671'
17226
18095
  };
17227
18096
  }
17228
18097
  if (!(location && !location.address)) {
17229
- _context6.next = 21;
18098
+ _context17.next = 46;
17230
18099
  break;
17231
18100
  }
17232
- _context6.next = 17;
18101
+ _context17.next = 42;
17233
18102
  return getAddress(location);
17234
- case 17:
17235
- _context6.t0 = _context6.sent;
17236
- if (_context6.t0) {
17237
- _context6.next = 20;
18103
+ case 42:
18104
+ _context17.t0 = _context17.sent;
18105
+ if (_context17.t0) {
18106
+ _context17.next = 45;
17238
18107
  break;
17239
18108
  }
17240
- _context6.t0 = '经纬度获取成功,但地址获取失败。';
17241
- case 20:
17242
- location.address = _context6.t0;
17243
- case 21:
17244
- return _context6.abrupt("return", location);
17245
- case 22:
18109
+ _context17.t0 = '经纬度获取成功,但地址获取失败。';
18110
+ case 45:
18111
+ location.address = _context17.t0;
18112
+ case 46:
18113
+ return _context17.abrupt("return", location);
18114
+ case 47:
17246
18115
  case "end":
17247
- return _context6.stop();
18116
+ return _context17.stop();
17248
18117
  }
17249
- }, _callee6);
18118
+ }, _callee17);
17250
18119
  }));
17251
- return _getLocationPromise.apply(this, arguments);
17252
- }
18120
+ return function getLocationPromise() {
18121
+ return _ref17.apply(this, arguments);
18122
+ };
18123
+ }();
18124
+ // WGS84 GCJ-02 BD-09 坐标系
18125
+ // https://www.jianshu.com/p/559029832a67
17253
18126
  function getLocation() {
17254
18127
  return _getLocation.apply(this, arguments);
17255
- }
18128
+ } // 逆地址解析
17256
18129
  function _getLocation() {
17257
- _getLocation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee7() {
18130
+ _getLocation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee20() {
17258
18131
  var locationRes;
17259
- return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
17260
- while (1) switch (_context7.prev = _context7.next) {
18132
+ return _regeneratorRuntime$1().wrap(function _callee20$(_context20) {
18133
+ while (1) switch (_context20.prev = _context20.next) {
17261
18134
  case 0:
17262
- if (!(datetime && Date.now() - datetime <= 30000 && lastLocation && !runing)) {
17263
- _context7.next = 2;
18135
+ _context20.next = 2;
18136
+ return mapService.init();
18137
+ case 2:
18138
+ if (!(datetime && Date.now() - datetime <= cachetime && lastLocation && !runing)) {
18139
+ _context20.next = 4;
17264
18140
  break;
17265
18141
  }
17266
- return _context7.abrupt("return", cloneDeep$1(lastLocation));
17267
- case 2:
18142
+ return _context20.abrupt("return", cloneDeep$1(lastLocation));
18143
+ case 4:
17268
18144
  if (!(runing && locationPromise)) {
17269
- _context7.next = 4;
18145
+ _context20.next = 6;
17270
18146
  break;
17271
18147
  }
17272
- return _context7.abrupt("return", locationPromise);
17273
- case 4:
18148
+ return _context20.abrupt("return", locationPromise);
18149
+ case 6:
17274
18150
  // console.log('runing')
17275
18151
  runing = true;
17276
18152
  locationPromise = getLocationPromise();
17277
- _context7.next = 8;
18153
+ _context20.next = 10;
17278
18154
  return locationPromise;
17279
- case 8:
17280
- locationRes = _context7.sent;
18155
+ case 10:
18156
+ locationRes = _context20.sent;
17281
18157
  runing = false;
17282
18158
  if (locationRes) {
17283
18159
  datetime = Date.now();
17284
18160
  lastLocation = locationRes;
17285
18161
  }
17286
- return _context7.abrupt("return", locationRes);
17287
- case 12:
18162
+ return _context20.abrupt("return", locationRes);
18163
+ case 14:
17288
18164
  case "end":
17289
- return _context7.stop();
18165
+ return _context20.stop();
17290
18166
  }
17291
- }, _callee7);
18167
+ }, _callee20);
17292
18168
  }));
17293
18169
  return _getLocation.apply(this, arguments);
17294
18170
  }
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) {
18171
+ var getAddress = /*#__PURE__*/function () {
18172
+ var _ref18 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee18(position) {
18173
+ var address;
18174
+ return _regeneratorRuntime$1().wrap(function _callee18$(_context18) {
18175
+ while (1) switch (_context18.prev = _context18.next) {
17318
18176
  case 0:
17319
- _context8.next = 2;
17320
- return init();
18177
+ _context18.next = 2;
18178
+ return mapService.init();
17321
18179
  case 2:
17322
- return _context8.abrupt("return", AMap.GeometryUtil.distance(p1, p2));
17323
- case 3:
18180
+ address = ''; // 先统一用ipaas解析 因为需要储存一致的地址格式(各地图商逆地址查询的地址格式不统一)
18181
+ // 如果不行再按照各地图商解析
18182
+ _context18.next = 5;
18183
+ return getAddressByIpaas(position);
18184
+ case 5:
18185
+ address = _context18.sent;
18186
+ if (address) {
18187
+ _context18.next = 23;
18188
+ break;
18189
+ }
18190
+ if (!(mapService.type === 'amap')) {
18191
+ _context18.next = 13;
18192
+ break;
18193
+ }
18194
+ _context18.next = 10;
18195
+ return getAddressByAmap(position);
18196
+ case 10:
18197
+ address = _context18.sent;
18198
+ _context18.next = 23;
18199
+ break;
18200
+ case 13:
18201
+ if (!(mapService.type === 'tencent')) {
18202
+ _context18.next = 19;
18203
+ break;
18204
+ }
18205
+ _context18.next = 16;
18206
+ return getAddressByTMap(position);
18207
+ case 16:
18208
+ address = _context18.sent;
18209
+ _context18.next = 23;
18210
+ break;
18211
+ case 19:
18212
+ if (!(mapService.type === 'baidu')) {
18213
+ _context18.next = 23;
18214
+ break;
18215
+ }
18216
+ _context18.next = 22;
18217
+ return getAddressByBmap(position);
18218
+ case 22:
18219
+ address = _context18.sent;
18220
+ case 23:
18221
+ return _context18.abrupt("return", address);
18222
+ case 24:
17324
18223
  case "end":
17325
- return _context8.stop();
18224
+ return _context18.stop();
17326
18225
  }
17327
- }, _callee8);
18226
+ }, _callee18);
17328
18227
  }));
17329
- return _getDistance.apply(this, arguments);
17330
- }
18228
+ return function getAddress(_x13) {
18229
+ return _ref18.apply(this, arguments);
18230
+ };
18231
+ }();
18232
+ // const getDistance = async (p1: [number, number], p2: [number, number]) => {
18233
+ // await mapService.init()
18234
+ // return window.AMap.GeometryUtil.distance(p1, p2)
18235
+ // }
18236
+ // 两个经纬度距离计算
18237
+ var getDistance = /*#__PURE__*/function () {
18238
+ var _ref19 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee19(latlng1, latlng2) {
18239
+ var lng1, lat1, lng2, lat2, radLat1, radLat2, a, b, s;
18240
+ return _regeneratorRuntime$1().wrap(function _callee19$(_context19) {
18241
+ while (1) switch (_context19.prev = _context19.next) {
18242
+ case 0:
18243
+ // console.log(latlng1)
18244
+ // console.log(latlng2)
18245
+ lng1 = Number(latlng1[0]);
18246
+ lat1 = Number(latlng1[1]);
18247
+ lng2 = Number(latlng2[0]);
18248
+ lat2 = Number(latlng2[1]);
18249
+ radLat1 = lat1 * Math.PI / 180.0;
18250
+ radLat2 = lat2 * Math.PI / 180.0;
18251
+ a = radLat1 - radLat2;
18252
+ b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
18253
+ 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)));
18254
+ s = s * 6378.137; // EARTH_RADIUS
18255
+ s = Math.round(s * 10000) / 10000;
18256
+ return _context19.abrupt("return", s * 1000);
18257
+ case 12:
18258
+ case "end":
18259
+ return _context19.stop();
18260
+ }
18261
+ }, _callee19);
18262
+ }));
18263
+ return function getDistance(_x14, _x15) {
18264
+ return _ref19.apply(this, arguments);
18265
+ };
18266
+ }();
17331
18267
 
17332
18268
  var modulekey = '';
17333
18269
  var SpuConfig = /*#__PURE__*/function () {
@@ -51900,6 +52836,38 @@ var uploadService = {
51900
52836
  upload: upload
51901
52837
  };
51902
52838
 
52839
+ var isinit = false;
52840
+ var load = function load(options) {
52841
+ var _options$AMapUI;
52842
+ var AMapKey = getAMapKey();
52843
+ if (!isinit) {
52844
+ isinit = true;
52845
+ if (AMapKey.securityJsCode) {
52846
+ // 本来想改成取消安全秘钥 但考虑到其他spu有可能用了需要安全秘钥的功能 因此不取消
52847
+ // 如果不设置安全秘钥的话 js-api的逆地址查询不成功 返回 INVALID_USER_SCODE 改成用ipaas服务查询
52848
+ window._AMapSecurityConfig = {
52849
+ securityJsCode: AMapKey.securityJsCode
52850
+ };
52851
+ }
52852
+ }
52853
+ // 不开放地址查询 改用ipaas
52854
+ var plugin = ['AMap.Geolocation'];
52855
+ // plugin.push('AMap.Geocoder') // 不开放地址查询 改用ipaas
52856
+ return AMapLoader$1.load({
52857
+ key: AMapKey.key,
52858
+ version: '2.0',
52859
+ plugins: (options === null || options === void 0 ? void 0 : options.plugins) || plugin,
52860
+ AMapUI: {
52861
+ version: '1.1',
52862
+ plugins: (options === null || options === void 0 || (_options$AMapUI = options.AMapUI) === null || _options$AMapUI === void 0 ? void 0 : _options$AMapUI.plugins) || []
52863
+ }
52864
+ });
52865
+ };
52866
+ var AMapLoader = {
52867
+ AMapKey: AMapKey,
52868
+ load: load
52869
+ };
52870
+
51903
52871
  // import SpuLoadding from './loadding'
51904
52872
  // import SpuExpandexp from './expandexp'
51905
52873
  var index = {
@@ -69036,4 +70004,4 @@ var SPUWebPlugin = {
69036
70004
  version: version
69037
70005
  };
69038
70006
 
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 };
70007
+ 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 };