gis-common 1.0.17 → 1.0.18
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/resource.min.js +78 -63
- package/package.json +1 -1
package/dist/resource.min.js
CHANGED
|
@@ -316,7 +316,7 @@ __webpack_require__.d(__webpack_exports__, "WebStorage", function() { return /*
|
|
|
316
316
|
* @param {*} json
|
|
317
317
|
* @returns {*}
|
|
318
318
|
*/
|
|
319
|
-
|
|
319
|
+
json2Query: function json2Query(json) {
|
|
320
320
|
var tempArr = [];
|
|
321
321
|
for (var i in json) {
|
|
322
322
|
var key = i;
|
|
@@ -1494,26 +1494,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
|
|
1494
1494
|
});
|
|
1495
1495
|
// CONCATENATED MODULE: ./src/utils/StringUtils.js
|
|
1496
1496
|
|
|
1497
|
-
/**
|
|
1498
|
-
* 获取字节长度
|
|
1499
|
-
*/
|
|
1500
|
-
String.prototype.bLength = function () {
|
|
1501
|
-
return this.replace(/[\u0391-\uFFE5]/g, 'aa').length;
|
|
1502
|
-
};
|
|
1503
|
-
String.prototype.subStringByte = function (n) {
|
|
1504
|
-
var r = /[^\x00-\xff]/g;
|
|
1505
|
-
if (this.replace(r, 'mm').length <= n) {
|
|
1506
|
-
return this;
|
|
1507
|
-
}
|
|
1508
|
-
var m = Math.floor(n / 2);
|
|
1509
|
-
for (var i = m; i < this.length; i++) {
|
|
1510
|
-
var sub = this.substring(0, i);
|
|
1511
|
-
if (sub.replace(r, 'mm').length >= n) {
|
|
1512
|
-
return sub;
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
return this;
|
|
1516
|
-
};
|
|
1517
1497
|
/* harmony default export */ var StringUtils = ({
|
|
1518
1498
|
/**
|
|
1519
1499
|
* 常用正则验证
|
|
@@ -1631,6 +1611,14 @@ String.prototype.subStringByte = function (n) {
|
|
|
1631
1611
|
return str;
|
|
1632
1612
|
}
|
|
1633
1613
|
},
|
|
1614
|
+
|
|
1615
|
+
/**
|
|
1616
|
+
* 处理字符串模板
|
|
1617
|
+
* eg: tag`${abc}`
|
|
1618
|
+
* @param {*} strArray
|
|
1619
|
+
* @param {*} args
|
|
1620
|
+
* @returns {*}
|
|
1621
|
+
*/
|
|
1634
1622
|
tag: function tag(strArray) {
|
|
1635
1623
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1636
1624
|
args[_key - 1] = arguments[_key];
|
|
@@ -1649,6 +1637,36 @@ String.prototype.subStringByte = function (n) {
|
|
|
1649
1637
|
return strArray.reduce(function (prev, next, index) {
|
|
1650
1638
|
return '' + prev + args[index - 1] + next;
|
|
1651
1639
|
});
|
|
1640
|
+
},
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* 获取字符串字节长度
|
|
1644
|
+
* @param {*} str
|
|
1645
|
+
* @returns {*}
|
|
1646
|
+
*/
|
|
1647
|
+
getByteLength: function getByteLength(str) {
|
|
1648
|
+
return str.replace(/[\u0391-\uFFE5]/g, 'aa').length;
|
|
1649
|
+
},
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* 根据字节长度截取字符串
|
|
1653
|
+
* @param {*} str
|
|
1654
|
+
* @param {*} n
|
|
1655
|
+
* @returns {*}
|
|
1656
|
+
*/
|
|
1657
|
+
subStringByte: function subStringByte(str, n) {
|
|
1658
|
+
var r = /[^\x00-\xff]/g;
|
|
1659
|
+
if (str.replace(r, 'mm').length <= n) {
|
|
1660
|
+
return str;
|
|
1661
|
+
}
|
|
1662
|
+
var m = Math.floor(n / 2);
|
|
1663
|
+
for (var i = m; i < str.length; i++) {
|
|
1664
|
+
var sub = str.substring(0, i);
|
|
1665
|
+
if (sub.replace(r, 'mm').length >= n) {
|
|
1666
|
+
return sub;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
return str;
|
|
1652
1670
|
}
|
|
1653
1671
|
});
|
|
1654
1672
|
// CONCATENATED MODULE: ./src/utils/index.js
|
|
@@ -2247,7 +2265,7 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2247
2265
|
WebSocketClient_inherits(WebSocketClient, _EventDispatcher);
|
|
2248
2266
|
|
|
2249
2267
|
function WebSocketClient() {
|
|
2250
|
-
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
2268
|
+
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'ws://127.0.0.1:10088';
|
|
2251
2269
|
|
|
2252
2270
|
WebSocketClient_classCallCheck(this, WebSocketClient);
|
|
2253
2271
|
|
|
@@ -2265,7 +2283,7 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2265
2283
|
}
|
|
2266
2284
|
|
|
2267
2285
|
WebSocketClient_createClass(WebSocketClient, [{
|
|
2268
|
-
key:
|
|
2286
|
+
key: 'connect',
|
|
2269
2287
|
value: function connect() {
|
|
2270
2288
|
var _this2 = this;
|
|
2271
2289
|
|
|
@@ -2273,49 +2291,46 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2273
2291
|
this.disconnect();
|
|
2274
2292
|
if (this.url) {
|
|
2275
2293
|
try {
|
|
2276
|
-
console.info(
|
|
2294
|
+
console.info('创建ws连接' + this.url);
|
|
2277
2295
|
this.client = new WebSocket(this.url);
|
|
2278
2296
|
if (this.client) {
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
});
|
|
2305
|
-
};
|
|
2306
|
-
}
|
|
2297
|
+
this.client.onopen = function (message) {
|
|
2298
|
+
_this2.dispatchEvent({
|
|
2299
|
+
type: EventTypeConstant.WEB_SOCKET_CONNECT,
|
|
2300
|
+
message: message
|
|
2301
|
+
});
|
|
2302
|
+
};
|
|
2303
|
+
this.client.onmessage = function (message) {
|
|
2304
|
+
_this2.connectStatus = true;
|
|
2305
|
+
_this2.dispatchEvent({
|
|
2306
|
+
type: EventTypeConstant.WEB_SOCKET_MESSAGE,
|
|
2307
|
+
message: message
|
|
2308
|
+
});
|
|
2309
|
+
};
|
|
2310
|
+
this.client.onclose = function (message) {
|
|
2311
|
+
_this2.dispatchEvent({
|
|
2312
|
+
type: EventTypeConstant.WEB_SOCKET_CLOSE,
|
|
2313
|
+
message: message
|
|
2314
|
+
});
|
|
2315
|
+
};
|
|
2316
|
+
this.client.onerror = function (message) {
|
|
2317
|
+
_this2.dispatchEvent({
|
|
2318
|
+
type: EventTypeConstant.WEB_SOCKET_ERROR,
|
|
2319
|
+
message: message
|
|
2320
|
+
});
|
|
2321
|
+
};
|
|
2307
2322
|
}
|
|
2308
2323
|
} catch (ex) {
|
|
2309
|
-
console.error(
|
|
2324
|
+
console.error('创建ws连接失败' + this.url + ':' + ex);
|
|
2310
2325
|
}
|
|
2311
2326
|
}
|
|
2312
2327
|
}
|
|
2313
2328
|
}, {
|
|
2314
|
-
key:
|
|
2329
|
+
key: 'disconnect',
|
|
2315
2330
|
value: function disconnect() {
|
|
2316
2331
|
if (this.client) {
|
|
2317
2332
|
try {
|
|
2318
|
-
console.log(
|
|
2333
|
+
console.log('ws断开连接' + this.url);
|
|
2319
2334
|
this.client.close();
|
|
2320
2335
|
this.client = null;
|
|
2321
2336
|
} catch (ex) {
|
|
@@ -2324,7 +2339,7 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2324
2339
|
}
|
|
2325
2340
|
}
|
|
2326
2341
|
}, {
|
|
2327
|
-
key:
|
|
2342
|
+
key: 'connCheckStatus',
|
|
2328
2343
|
value: function connCheckStatus(times) {
|
|
2329
2344
|
var _this3 = this;
|
|
2330
2345
|
|
|
@@ -2337,30 +2352,30 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2337
2352
|
}, 2000);
|
|
2338
2353
|
}
|
|
2339
2354
|
}, {
|
|
2340
|
-
key:
|
|
2355
|
+
key: 'send',
|
|
2341
2356
|
value: function send(message) {
|
|
2342
2357
|
if (this.client && this.client.readyState === 1) {
|
|
2343
2358
|
this.client.send(message);
|
|
2344
2359
|
return true;
|
|
2345
2360
|
}
|
|
2346
|
-
console.error(this.url +
|
|
2361
|
+
console.error(this.url + '消息发送失败:' + message);
|
|
2347
2362
|
return false;
|
|
2348
2363
|
}
|
|
2349
2364
|
}, {
|
|
2350
|
-
key:
|
|
2365
|
+
key: 'heartbeat',
|
|
2351
2366
|
value: function heartbeat() {
|
|
2352
2367
|
var _this4 = this;
|
|
2353
2368
|
|
|
2354
2369
|
setTimeout(function () {
|
|
2355
2370
|
if (_this4.client && _this4.client.readyState === 1) {
|
|
2356
|
-
_this4.send(
|
|
2371
|
+
_this4.send('HeartBeat');
|
|
2357
2372
|
}
|
|
2358
|
-
console.log(
|
|
2373
|
+
console.log('HeartBeat,' + _this4.url);
|
|
2359
2374
|
setTimeout(_this4.heartbeat, 30000);
|
|
2360
2375
|
}, 1000);
|
|
2361
2376
|
}
|
|
2362
2377
|
}], [{
|
|
2363
|
-
key:
|
|
2378
|
+
key: 'getInstance',
|
|
2364
2379
|
value: function getInstance() {
|
|
2365
2380
|
if (WebSocketClient.instance) {
|
|
2366
2381
|
return WebSocketClient.instance;
|
|
@@ -2369,7 +2384,7 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2369
2384
|
}
|
|
2370
2385
|
}
|
|
2371
2386
|
}, {
|
|
2372
|
-
key:
|
|
2387
|
+
key: '_instance',
|
|
2373
2388
|
get: function get() {
|
|
2374
2389
|
return this.getInstance();
|
|
2375
2390
|
}
|