cd-mapgis 1.1.14 → 1.1.15
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/package.json +1 -1
- package/src/OM.js +11 -1
package/package.json
CHANGED
package/src/OM.js
CHANGED
|
@@ -35,12 +35,22 @@ export default class OM {
|
|
|
35
35
|
let res = await HttpUtil.post(params.geoServer + url, data, headers);
|
|
36
36
|
return JSON.parse(res);
|
|
37
37
|
}
|
|
38
|
+
// 获取url地址的ip地址
|
|
39
|
+
static getIp(text) {
|
|
40
|
+
const ipv4Regex = /\b(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/;
|
|
41
|
+
const ipv4Matches = text.match(ipv4Regex) || [];
|
|
42
|
+
if(ipv4Matches.length > 0){
|
|
43
|
+
return ipv4Matches[0];
|
|
44
|
+
}else{
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
38
48
|
/**
|
|
39
49
|
* 获取字典
|
|
40
50
|
* @param {*} key
|
|
41
51
|
*/
|
|
42
52
|
static getDic(key) {
|
|
43
|
-
const hostname = window.location.
|
|
53
|
+
const hostname = OM.getIp(window.location.href);
|
|
44
54
|
return OM.post("/map/getDic", { dicKey: key, clientIp: hostname });
|
|
45
55
|
}
|
|
46
56
|
/**
|