@smart100/spu-web-plugin 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -0
- package/dist/spu-web-plugin.mjs +118 -80
- package/package.json +1 -1
- package/src/map/MapService.ts +52 -27
- package/src/tenantSetting.ts +5 -7
- package/src/types/index.d.ts +21 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
// import type { App } from 'vue'
|
|
2
2
|
// import type { AxiosInstance } from 'axios'
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
// 高德地图
|
|
6
|
+
AMapLoader: any
|
|
7
|
+
_AMapSecurityConfig: {
|
|
8
|
+
securityJsCode: string
|
|
9
|
+
}
|
|
10
|
+
AMap: any
|
|
11
|
+
AMapUI: any
|
|
12
|
+
// 百度地图
|
|
13
|
+
BMap: any
|
|
14
|
+
BMAP_ANCHOR_TOP_LEFT: any
|
|
15
|
+
BMAP_ANCHOR_TOP_RIGHT: any
|
|
16
|
+
BMAP_ANCHOR_BOTTOM_LEFT: any
|
|
17
|
+
BMAP_ANCHOR_BOTTOM_RIGHT: any
|
|
18
|
+
BMAP_INITIAL_CALLBACK: any
|
|
19
|
+
// 腾讯地图
|
|
20
|
+
TMap: any
|
|
21
|
+
}
|
|
22
|
+
}
|
|
3
23
|
|
|
4
24
|
interface IAMapLoader {
|
|
5
25
|
load: (options?: {
|
|
@@ -16,6 +36,7 @@ interface IMapService {
|
|
|
16
36
|
AMap: any
|
|
17
37
|
BMap: any
|
|
18
38
|
TMap: any
|
|
39
|
+
MapCore: any
|
|
19
40
|
}
|
|
20
41
|
|
|
21
42
|
type StorageType = 'storage' | 'storage-1d' | 'storage-3m' | 'storage-1y'
|
package/dist/spu-web-plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version = "1.0.
|
|
1
|
+
var version = "1.0.11";
|
|
2
2
|
|
|
3
3
|
/** Detect free variable `global` from Node.js. */
|
|
4
4
|
var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -16163,11 +16163,11 @@ var TenantSetting = /*#__PURE__*/function () {
|
|
|
16163
16163
|
// }
|
|
16164
16164
|
// }
|
|
16165
16165
|
// }
|
|
16166
|
-
//
|
|
16167
|
-
//
|
|
16168
|
-
//
|
|
16169
|
-
//
|
|
16170
|
-
//
|
|
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
16171
|
// tenantsetting.lbssetting.setting.type = 'baidu'
|
|
16172
16172
|
// tenantsetting.lbssetting.setting.key.web = '7r3bsPeQqJ74vsxf3EOXg7C1AM4lOWA1'
|
|
16173
16173
|
if (key) {
|
|
@@ -17071,6 +17071,11 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17071
17071
|
function MapService() {
|
|
17072
17072
|
_classCallCheck$1(this, MapService);
|
|
17073
17073
|
_defineProperty$1(this, "isInit", false);
|
|
17074
|
+
_defineProperty$1(this, "initPromise", null);
|
|
17075
|
+
_defineProperty$1(this, "AMap", null);
|
|
17076
|
+
_defineProperty$1(this, "TMap", null);
|
|
17077
|
+
_defineProperty$1(this, "BMap", null);
|
|
17078
|
+
_defineProperty$1(this, "MapCore", null);
|
|
17074
17079
|
}
|
|
17075
17080
|
_createClass$1(MapService, [{
|
|
17076
17081
|
key: "isLbssettingEnable",
|
|
@@ -17114,35 +17119,34 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17114
17119
|
return 'amap';
|
|
17115
17120
|
}
|
|
17116
17121
|
}
|
|
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
17122
|
}, {
|
|
17142
17123
|
key: "init",
|
|
17143
|
-
value:
|
|
17144
|
-
|
|
17145
|
-
|
|
17124
|
+
value: // get AMap() {
|
|
17125
|
+
// if (!this.isInit || this.type !== 'amap') {
|
|
17126
|
+
// return null
|
|
17127
|
+
// }
|
|
17128
|
+
// return window.AMap
|
|
17129
|
+
// }
|
|
17130
|
+
// get TMap() {
|
|
17131
|
+
// if (!this.isInit || this.type !== 'tencent') {
|
|
17132
|
+
// return null
|
|
17133
|
+
// }
|
|
17134
|
+
// return window.TMap
|
|
17135
|
+
// }
|
|
17136
|
+
// get BMap() {
|
|
17137
|
+
// if (!this.isInit || this.type !== 'baidu') {
|
|
17138
|
+
// return null
|
|
17139
|
+
// }
|
|
17140
|
+
// return window.BMap
|
|
17141
|
+
// }
|
|
17142
|
+
// get MapCore() {
|
|
17143
|
+
// if (!this.isInit) {
|
|
17144
|
+
// return null
|
|
17145
|
+
// }
|
|
17146
|
+
// return window.BMap
|
|
17147
|
+
// }
|
|
17148
|
+
function () {
|
|
17149
|
+
var _init2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
17146
17150
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
17147
17151
|
while (1) switch (_context.prev = _context.next) {
|
|
17148
17152
|
case 0:
|
|
@@ -17152,68 +17156,97 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17152
17156
|
}
|
|
17153
17157
|
return _context.abrupt("return");
|
|
17154
17158
|
case 2:
|
|
17155
|
-
this.
|
|
17156
|
-
|
|
17157
|
-
// type = 'baidu'
|
|
17158
|
-
// }
|
|
17159
|
-
if (!(type === 'tencent')) {
|
|
17160
|
-
_context.next = 9;
|
|
17159
|
+
if (!this.initPromise) {
|
|
17160
|
+
_context.next = 4;
|
|
17161
17161
|
break;
|
|
17162
17162
|
}
|
|
17163
|
+
return _context.abrupt("return", this.initPromise);
|
|
17164
|
+
case 4:
|
|
17165
|
+
this.initPromise = this._init();
|
|
17163
17166
|
_context.next = 7;
|
|
17164
|
-
return this.
|
|
17167
|
+
return this.initPromise;
|
|
17165
17168
|
case 7:
|
|
17166
|
-
|
|
17169
|
+
case "end":
|
|
17170
|
+
return _context.stop();
|
|
17171
|
+
}
|
|
17172
|
+
}, _callee, this);
|
|
17173
|
+
}));
|
|
17174
|
+
function init() {
|
|
17175
|
+
return _init2.apply(this, arguments);
|
|
17176
|
+
}
|
|
17177
|
+
return init;
|
|
17178
|
+
}()
|
|
17179
|
+
}, {
|
|
17180
|
+
key: "_init",
|
|
17181
|
+
value: function () {
|
|
17182
|
+
var _init3 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2() {
|
|
17183
|
+
var type;
|
|
17184
|
+
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
17185
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
17186
|
+
case 0:
|
|
17187
|
+
type = this.type;
|
|
17188
|
+
if (!(type === 'tencent')) {
|
|
17189
|
+
_context2.next = 6;
|
|
17190
|
+
break;
|
|
17191
|
+
}
|
|
17192
|
+
_context2.next = 4;
|
|
17193
|
+
return this.initTecent();
|
|
17194
|
+
case 4:
|
|
17195
|
+
_context2.next = 14;
|
|
17167
17196
|
break;
|
|
17168
|
-
case
|
|
17197
|
+
case 6:
|
|
17169
17198
|
if (!(type === 'amap')) {
|
|
17170
|
-
|
|
17199
|
+
_context2.next = 11;
|
|
17171
17200
|
break;
|
|
17172
17201
|
}
|
|
17173
|
-
|
|
17202
|
+
_context2.next = 9;
|
|
17174
17203
|
return this.initAmap();
|
|
17175
|
-
case
|
|
17176
|
-
|
|
17204
|
+
case 9:
|
|
17205
|
+
_context2.next = 14;
|
|
17177
17206
|
break;
|
|
17178
|
-
case
|
|
17207
|
+
case 11:
|
|
17179
17208
|
if (!(type === 'baidu')) {
|
|
17180
|
-
|
|
17209
|
+
_context2.next = 14;
|
|
17181
17210
|
break;
|
|
17182
17211
|
}
|
|
17183
|
-
|
|
17212
|
+
_context2.next = 14;
|
|
17184
17213
|
return this.initBaidu();
|
|
17185
|
-
case
|
|
17214
|
+
case 14:
|
|
17215
|
+
this.isInit = true;
|
|
17216
|
+
case 15:
|
|
17186
17217
|
case "end":
|
|
17187
|
-
return
|
|
17218
|
+
return _context2.stop();
|
|
17188
17219
|
}
|
|
17189
|
-
},
|
|
17220
|
+
}, _callee2, this);
|
|
17190
17221
|
}));
|
|
17191
|
-
function
|
|
17192
|
-
return
|
|
17222
|
+
function _init() {
|
|
17223
|
+
return _init3.apply(this, arguments);
|
|
17193
17224
|
}
|
|
17194
|
-
return
|
|
17225
|
+
return _init;
|
|
17195
17226
|
}() // reset() {
|
|
17196
17227
|
// this.isInit = false
|
|
17197
17228
|
// }
|
|
17198
17229
|
}, {
|
|
17199
17230
|
key: "initTecent",
|
|
17200
17231
|
value: function () {
|
|
17201
|
-
var _initTecent = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function
|
|
17202
|
-
return _regeneratorRuntime$1().wrap(function
|
|
17203
|
-
while (1) switch (
|
|
17232
|
+
var _initTecent = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3() {
|
|
17233
|
+
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
17234
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
17204
17235
|
case 0:
|
|
17205
|
-
|
|
17236
|
+
_context3.next = 2;
|
|
17206
17237
|
return importJS("https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=".concat(this.key),
|
|
17207
17238
|
// `https://map.qq.com/api/gljs?v=1.exp&key=${this.key}`,
|
|
17208
17239
|
'TMap');
|
|
17209
17240
|
case 2:
|
|
17210
|
-
|
|
17241
|
+
this.TMap = window.TMap;
|
|
17242
|
+
this.MapCore = window.TMap;
|
|
17243
|
+
_context3.next = 6;
|
|
17211
17244
|
return delay(300);
|
|
17212
|
-
case
|
|
17245
|
+
case 6:
|
|
17213
17246
|
case "end":
|
|
17214
|
-
return
|
|
17247
|
+
return _context3.stop();
|
|
17215
17248
|
}
|
|
17216
|
-
},
|
|
17249
|
+
}, _callee3, this);
|
|
17217
17250
|
}));
|
|
17218
17251
|
function initTecent() {
|
|
17219
17252
|
return _initTecent.apply(this, arguments);
|
|
@@ -17223,10 +17256,10 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17223
17256
|
}, {
|
|
17224
17257
|
key: "initAmap",
|
|
17225
17258
|
value: function () {
|
|
17226
|
-
var _initAmap = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function
|
|
17259
|
+
var _initAmap = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4() {
|
|
17227
17260
|
var plugin, AMap;
|
|
17228
|
-
return _regeneratorRuntime$1().wrap(function
|
|
17229
|
-
while (1) switch (
|
|
17261
|
+
return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
|
|
17262
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
17230
17263
|
case 0:
|
|
17231
17264
|
// if (this.secretkey) {
|
|
17232
17265
|
// window._AMapSecurityConfig = {
|
|
@@ -17234,7 +17267,7 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17234
17267
|
// }
|
|
17235
17268
|
// }
|
|
17236
17269
|
plugin = ['AMap.Geolocation']; // plugin.push('AMap.Geocoder') // 不开放地址查询 改用ipaas
|
|
17237
|
-
|
|
17270
|
+
_context4.next = 3;
|
|
17238
17271
|
return AMapLoader$1.load({
|
|
17239
17272
|
key: this.key,
|
|
17240
17273
|
version: '2.0',
|
|
@@ -17245,18 +17278,20 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17245
17278
|
}
|
|
17246
17279
|
});
|
|
17247
17280
|
case 3:
|
|
17248
|
-
AMap =
|
|
17281
|
+
AMap = _context4.sent;
|
|
17249
17282
|
window.AMap = AMap;
|
|
17283
|
+
this.AMap = AMap;
|
|
17284
|
+
this.MapCore = window.AMap;
|
|
17250
17285
|
// console.log(window)
|
|
17251
17286
|
// console.log(window.AMap)
|
|
17252
17287
|
// console.log(window.AMapUI)
|
|
17253
17288
|
// console.log(window.AMapLoader)
|
|
17254
17289
|
// console.log(window.AMap === aaaa)
|
|
17255
|
-
case
|
|
17290
|
+
case 7:
|
|
17256
17291
|
case "end":
|
|
17257
|
-
return
|
|
17292
|
+
return _context4.stop();
|
|
17258
17293
|
}
|
|
17259
|
-
},
|
|
17294
|
+
}, _callee4, this);
|
|
17260
17295
|
}));
|
|
17261
17296
|
function initAmap() {
|
|
17262
17297
|
return _initAmap.apply(this, arguments);
|
|
@@ -17266,13 +17301,16 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17266
17301
|
}, {
|
|
17267
17302
|
key: "initBaidu",
|
|
17268
17303
|
value: function () {
|
|
17269
|
-
var _initBaidu = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function
|
|
17304
|
+
var _initBaidu = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5() {
|
|
17270
17305
|
var _this = this;
|
|
17271
|
-
return _regeneratorRuntime$1().wrap(function
|
|
17272
|
-
while (1) switch (
|
|
17306
|
+
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
17307
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
17273
17308
|
case 0:
|
|
17274
|
-
return
|
|
17275
|
-
window.
|
|
17309
|
+
return _context5.abrupt("return", new Promise(function (resolve, reject) {
|
|
17310
|
+
window.BMAP_INITIAL_CALLBACK = function () {
|
|
17311
|
+
_this.BMap = window.BMap;
|
|
17312
|
+
_this.MapCore = window.BMap;
|
|
17313
|
+
// debugger
|
|
17276
17314
|
// 启用google标准坐标体系
|
|
17277
17315
|
// coordsType 指定输入输出的坐标类型,BMAP_COORD_GCJ02为gcj02坐标,BMAP_COORD_BD09为bd0ll坐标,默认为BMAP_COORD_BD09。
|
|
17278
17316
|
window.BMap.coordType = 'BMAP_COORD_GCJ02';
|
|
@@ -17280,8 +17318,8 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17280
17318
|
};
|
|
17281
17319
|
var script = document.createElement('script');
|
|
17282
17320
|
// 使用最新 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=
|
|
17284
|
-
// script.src = `https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=${this.key}&callback=
|
|
17321
|
+
script.src = "https://api.map.baidu.com/api?v=3.0&ak=".concat(_this.key, "&callback=BMAP_INITIAL_CALLBACK");
|
|
17322
|
+
// script.src = `https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=${this.key}&callback=BMAP_INITIAL_CALLBACK`
|
|
17285
17323
|
script.onerror = function (err) {
|
|
17286
17324
|
reject(err);
|
|
17287
17325
|
};
|
|
@@ -17289,9 +17327,9 @@ var MapService = /*#__PURE__*/function () {
|
|
|
17289
17327
|
}));
|
|
17290
17328
|
case 1:
|
|
17291
17329
|
case "end":
|
|
17292
|
-
return
|
|
17330
|
+
return _context5.stop();
|
|
17293
17331
|
}
|
|
17294
|
-
},
|
|
17332
|
+
}, _callee5);
|
|
17295
17333
|
}));
|
|
17296
17334
|
function initBaidu() {
|
|
17297
17335
|
return _initBaidu.apply(this, arguments);
|
package/package.json
CHANGED
package/src/map/MapService.ts
CHANGED
|
@@ -19,7 +19,8 @@ interface ILbsSettingData {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
class MapService {
|
|
22
|
-
isInit = false
|
|
22
|
+
private isInit = false
|
|
23
|
+
private initPromise: any = null
|
|
23
24
|
|
|
24
25
|
get isLbssettingEnable() {
|
|
25
26
|
return tenantSetting.get('lbssetting')?.enable === '1'
|
|
@@ -53,37 +54,53 @@ class MapService {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return window.AMap
|
|
61
|
-
}
|
|
57
|
+
AMap: any = null
|
|
58
|
+
TMap: any = null
|
|
59
|
+
BMap: any = null
|
|
60
|
+
MapCore: any = null
|
|
62
61
|
|
|
63
|
-
get
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
62
|
+
// get AMap() {
|
|
63
|
+
// if (!this.isInit || this.type !== 'amap') {
|
|
64
|
+
// return null
|
|
65
|
+
// }
|
|
66
|
+
// return window.AMap
|
|
67
|
+
// }
|
|
69
68
|
|
|
70
|
-
get
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
69
|
+
// get TMap() {
|
|
70
|
+
// if (!this.isInit || this.type !== 'tencent') {
|
|
71
|
+
// return null
|
|
72
|
+
// }
|
|
73
|
+
// return window.TMap
|
|
74
|
+
// }
|
|
75
|
+
|
|
76
|
+
// get BMap() {
|
|
77
|
+
// if (!this.isInit || this.type !== 'baidu') {
|
|
78
|
+
// return null
|
|
79
|
+
// }
|
|
80
|
+
// return window.BMap
|
|
81
|
+
// }
|
|
82
|
+
|
|
83
|
+
// get MapCore() {
|
|
84
|
+
// if (!this.isInit) {
|
|
85
|
+
// return null
|
|
86
|
+
// }
|
|
87
|
+
// return window.BMap
|
|
88
|
+
// }
|
|
76
89
|
|
|
77
90
|
async init() {
|
|
78
91
|
if (this.isInit) return
|
|
79
92
|
|
|
80
|
-
|
|
93
|
+
// 兼容同时间发起多个
|
|
94
|
+
if (this.initPromise) {
|
|
95
|
+
return this.initPromise
|
|
96
|
+
}
|
|
81
97
|
|
|
82
|
-
|
|
98
|
+
this.initPromise = this._init()
|
|
99
|
+
await this.initPromise
|
|
100
|
+
}
|
|
83
101
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// }
|
|
102
|
+
private async _init() {
|
|
103
|
+
const type = this.type
|
|
87
104
|
if (type === 'tencent') {
|
|
88
105
|
await this.initTecent()
|
|
89
106
|
} else if (type === 'amap') {
|
|
@@ -91,6 +108,7 @@ class MapService {
|
|
|
91
108
|
} else if (type === 'baidu') {
|
|
92
109
|
await this.initBaidu()
|
|
93
110
|
}
|
|
111
|
+
this.isInit = true
|
|
94
112
|
}
|
|
95
113
|
|
|
96
114
|
// reset() {
|
|
@@ -103,6 +121,8 @@ class MapService {
|
|
|
103
121
|
// `https://map.qq.com/api/gljs?v=1.exp&key=${this.key}`,
|
|
104
122
|
'TMap'
|
|
105
123
|
)
|
|
124
|
+
this.TMap = window.TMap
|
|
125
|
+
this.MapCore = window.TMap
|
|
106
126
|
await delay(300)
|
|
107
127
|
}
|
|
108
128
|
|
|
@@ -126,6 +146,8 @@ class MapService {
|
|
|
126
146
|
}
|
|
127
147
|
})
|
|
128
148
|
window.AMap = AMap
|
|
149
|
+
this.AMap = AMap
|
|
150
|
+
this.MapCore = window.AMap
|
|
129
151
|
// console.log(window)
|
|
130
152
|
// console.log(window.AMap)
|
|
131
153
|
// console.log(window.AMapUI)
|
|
@@ -144,7 +166,10 @@ class MapService {
|
|
|
144
166
|
// mp.centerAndZoom(new BMap.Point(121.491, 31.233), 11)
|
|
145
167
|
// }
|
|
146
168
|
return new Promise((resolve, reject) => {
|
|
147
|
-
window.
|
|
169
|
+
window.BMAP_INITIAL_CALLBACK = () => {
|
|
170
|
+
this.BMap = window.BMap
|
|
171
|
+
this.MapCore = window.BMap
|
|
172
|
+
// debugger
|
|
148
173
|
// 启用google标准坐标体系
|
|
149
174
|
// coordsType 指定输入输出的坐标类型,BMAP_COORD_GCJ02为gcj02坐标,BMAP_COORD_BD09为bd0ll坐标,默认为BMAP_COORD_BD09。
|
|
150
175
|
window.BMap.coordType = 'BMAP_COORD_GCJ02'
|
|
@@ -152,8 +177,8 @@ class MapService {
|
|
|
152
177
|
}
|
|
153
178
|
const script = document.createElement('script')
|
|
154
179
|
// 使用最新 3.0 api https://lbsyun.baidu.com/index.php?title=jspopular3.0
|
|
155
|
-
script.src = `https://api.map.baidu.com/api?v=3.0&ak=${this.key}&callback=
|
|
156
|
-
// script.src = `https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=${this.key}&callback=
|
|
180
|
+
script.src = `https://api.map.baidu.com/api?v=3.0&ak=${this.key}&callback=BMAP_INITIAL_CALLBACK`
|
|
181
|
+
// script.src = `https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=${this.key}&callback=BMAP_INITIAL_CALLBACK`
|
|
157
182
|
script.onerror = (err) => {
|
|
158
183
|
reject(err)
|
|
159
184
|
}
|
package/src/tenantSetting.ts
CHANGED
|
@@ -43,7 +43,6 @@ class TenantSetting {
|
|
|
43
43
|
if (tenantsettingStr) {
|
|
44
44
|
const tenantsetting = JSON.parse(tenantsettingStr)
|
|
45
45
|
|
|
46
|
-
|
|
47
46
|
// tenantsetting.lbssetting = {
|
|
48
47
|
// enable: '1',
|
|
49
48
|
// setting: {
|
|
@@ -62,17 +61,16 @@ class TenantSetting {
|
|
|
62
61
|
// }
|
|
63
62
|
// }
|
|
64
63
|
// }
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
64
|
+
// tenantsetting.lbssetting.setting.type = 'amap'
|
|
65
|
+
// tenantsetting.lbssetting.setting.key.web = '1993ac213d2f4675ac1bffb1b03ef1f0'
|
|
66
|
+
// tenantsetting.lbssetting.setting.secretkey.web = '816fe46b7b7bce145940b93c1e4818fa'
|
|
68
67
|
|
|
69
|
-
//
|
|
70
|
-
//
|
|
68
|
+
// tenantsetting.lbssetting.setting.type = 'tencent'
|
|
69
|
+
// tenantsetting.lbssetting.setting.key.web = 'NHBBZ-K5LCQ-LF35M-2CTDP-E4OO7-AIBFT'
|
|
71
70
|
|
|
72
71
|
// tenantsetting.lbssetting.setting.type = 'baidu'
|
|
73
72
|
// tenantsetting.lbssetting.setting.key.web = '7r3bsPeQqJ74vsxf3EOXg7C1AM4lOWA1'
|
|
74
73
|
|
|
75
|
-
|
|
76
74
|
if (key) {
|
|
77
75
|
return tenantsetting[key]
|
|
78
76
|
}
|
package/src/types/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
// import type { App } from 'vue'
|
|
2
2
|
// import type { AxiosInstance } from 'axios'
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
// 高德地图
|
|
6
|
+
AMapLoader: any
|
|
7
|
+
_AMapSecurityConfig: {
|
|
8
|
+
securityJsCode: string
|
|
9
|
+
}
|
|
10
|
+
AMap: any
|
|
11
|
+
AMapUI: any
|
|
12
|
+
// 百度地图
|
|
13
|
+
BMap: any
|
|
14
|
+
BMAP_ANCHOR_TOP_LEFT: any
|
|
15
|
+
BMAP_ANCHOR_TOP_RIGHT: any
|
|
16
|
+
BMAP_ANCHOR_BOTTOM_LEFT: any
|
|
17
|
+
BMAP_ANCHOR_BOTTOM_RIGHT: any
|
|
18
|
+
BMAP_INITIAL_CALLBACK: any
|
|
19
|
+
// 腾讯地图
|
|
20
|
+
TMap: any
|
|
21
|
+
}
|
|
22
|
+
}
|
|
3
23
|
|
|
4
24
|
interface IAMapLoader {
|
|
5
25
|
load: (options?: {
|
|
@@ -16,6 +36,7 @@ interface IMapService {
|
|
|
16
36
|
AMap: any
|
|
17
37
|
BMap: any
|
|
18
38
|
TMap: any
|
|
39
|
+
MapCore: any
|
|
19
40
|
}
|
|
20
41
|
|
|
21
42
|
type StorageType = 'storage' | 'storage-1d' | 'storage-3m' | 'storage-1y'
|