Skip to content

Commit f898d9f

Browse files
committed
【fix】 fix iportal 类 queryMaps 报错问题 review by songym
1 parent a7947fe commit f898d9f

File tree

5 files changed

+60
-58
lines changed

5 files changed

+60
-58
lines changed

dist/mapboxgl/iclient9-mapboxgl-es6.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13181,9 +13181,8 @@ SuperMap.iPortalMap = iPortalMap_IPortalMap;
1318113181
* @param {string} iportalUrl - 地址。
1318213182
*/
1318313183
class iPortal_IPortal extends iPortalServiceBase_IPortalServiceBase {
13184-
1318513184
constructor(iportalUrl, options) {
13186-
super(iportalUrl,options);
13185+
super(iportalUrl, options);
1318713186
this.iportalUrl = iportalUrl;
1318813187
options = options || {};
1318913188
this.withCredentials = options.withCredentials || false;
@@ -13195,7 +13194,7 @@ class iPortal_IPortal extends iPortalServiceBase_IPortalServiceBase {
1319513194
* @returns {Promise} 返回包含 iportal web 资源信息的 Promise 对象。
1319613195
*/
1319713196
load() {
13198-
return FetchRequest_FetchRequest.get(this.iportalUrl + '/web');
13197+
return FetchRequest_FetchRequest.get(this.iportalUrl + "/web");
1319913198
}
1320013199

1320113200
/**
@@ -13209,9 +13208,9 @@ class iPortal_IPortal extends iPortalServiceBase_IPortalServiceBase {
1320913208
return null;
1321013209
}
1321113210
var serviceUrl = this.iportalUrl + "/web/services";
13212-
return this.request("GET", serviceUrl, queryParams).then(function (result) {
13211+
return this.request("GET", serviceUrl, queryParams).then(function(result) {
1321313212
var services = [];
13214-
result.content.map(function (serviceJsonObj) {
13213+
result.content.map(function(serviceJsonObj) {
1321513214
services.push(new iPortalService_IPortalService(serviceUrl, serviceJsonObj));
1321613215
return serviceJsonObj;
1321713216
});
@@ -13246,26 +13245,27 @@ class iPortal_IPortal extends iPortalServiceBase_IPortalServiceBase {
1324613245
} else {
1324713246
mapsUrl = this.iportalUrl + "/web/maps";
1324813247
}
13249-
return this.request("GET", mapsUrl, queryParams).then(function (result) {
13248+
return this.request("GET", mapsUrl, queryParams).then(function(result) {
1325013249
var mapRetult = {};
1325113250
var maps = [];
13252-
result.content.map(function (mapJsonObj) {
13253-
maps.push(new iPortalMap_IPortalMap(mapsUrl + "/" + mapJsonObj.id, mapJsonObj));
13254-
return mapJsonObj;
13255-
});
13256-
mapRetult.content = maps;
13257-
mapRetult.currentPage = result.currentPage;
13258-
mapRetult.pageSize = result.pageSize;
13259-
mapRetult.total = result.total;
13260-
mapRetult.totalPage = result.totalPage;
13261-
return mapRetult;
13251+
if (result.content && result.content.length > 0) {
13252+
result.content.map(function(mapJsonObj) {
13253+
maps.push(new iPortalMap_IPortalMap(mapsUrl + "/" + mapJsonObj.id, mapJsonObj));
13254+
return mapJsonObj;
13255+
});
13256+
mapRetult.content = maps;
13257+
mapRetult.currentPage = result.currentPage;
13258+
mapRetult.pageSize = result.pageSize;
13259+
mapRetult.total = result.total;
13260+
mapRetult.totalPage = result.totalPage;
13261+
return mapRetult;
13262+
}
1326213263
});
1326313264
}
1326413265
}
1326513266

1326613267
SuperMap.iPortal = iPortal_IPortal;
1326713268

13268-
1326913269
// CONCATENATED MODULE: ./src/common/iPortal/index.js
1327013270
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
1327113271
* This program are made available under the terms of the Apache License, Version 2.0

dist/mapboxgl/iclient9-mapboxgl-es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mapboxgl/iclient9-mapboxgl.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92158,9 +92158,9 @@ var IPortal = exports.IPortal = function (_IPortalServiceBase) {
9215892158

9215992159

9216092160
_createClass(IPortal, [{
92161-
key: 'load',
92161+
key: "load",
9216292162
value: function load() {
92163-
return _FetchRequest.FetchRequest.get(this.iportalUrl + '/web');
92163+
return _FetchRequest.FetchRequest.get(this.iportalUrl + "/web");
9216492164
}
9216592165

9216692166
/**
@@ -92171,7 +92171,7 @@ var IPortal = exports.IPortal = function (_IPortalServiceBase) {
9217192171
*/
9217292172

9217392173
}, {
92174-
key: 'queryServices',
92174+
key: "queryServices",
9217592175
value: function queryServices(queryParams) {
9217692176
if (!(queryParams instanceof _iPortalServicesQueryParam.IPortalServicesQueryParam)) {
9217792177
return null;
@@ -92195,7 +92195,7 @@ var IPortal = exports.IPortal = function (_IPortalServiceBase) {
9219592195
*/
9219692196

9219792197
}, {
92198-
key: 'deleteServices',
92198+
key: "deleteServices",
9219992199
value: function deleteServices(ids) {
9220092200
var serviceUrl = this.iportalUrl + "/web/services";
9220192201
return this.request("DELETE", serviceUrl, { ids: ids });
@@ -92209,7 +92209,7 @@ var IPortal = exports.IPortal = function (_IPortalServiceBase) {
9220992209
*/
9221092210

9221192211
}, {
92212-
key: 'queryMaps',
92212+
key: "queryMaps",
9221392213
value: function queryMaps(queryParams) {
9221492214
if (!(queryParams instanceof _iPortalMapsQueryParam.IPortalMapsQueryParam)) {
9221592215
return null;
@@ -92223,16 +92223,18 @@ var IPortal = exports.IPortal = function (_IPortalServiceBase) {
9222392223
return this.request("GET", mapsUrl, queryParams).then(function (result) {
9222492224
var mapRetult = {};
9222592225
var maps = [];
92226-
result.content.map(function (mapJsonObj) {
92227-
maps.push(new _iPortalMap.IPortalMap(mapsUrl + "/" + mapJsonObj.id, mapJsonObj));
92228-
return mapJsonObj;
92229-
});
92230-
mapRetult.content = maps;
92231-
mapRetult.currentPage = result.currentPage;
92232-
mapRetult.pageSize = result.pageSize;
92233-
mapRetult.total = result.total;
92234-
mapRetult.totalPage = result.totalPage;
92235-
return mapRetult;
92226+
if (result.content && result.content.length > 0) {
92227+
result.content.map(function (mapJsonObj) {
92228+
maps.push(new _iPortalMap.IPortalMap(mapsUrl + "/" + mapJsonObj.id, mapJsonObj));
92229+
return mapJsonObj;
92230+
});
92231+
mapRetult.content = maps;
92232+
mapRetult.currentPage = result.currentPage;
92233+
mapRetult.pageSize = result.pageSize;
92234+
mapRetult.total = result.total;
92235+
mapRetult.totalPage = result.totalPage;
92236+
return mapRetult;
92237+
}
9223692238
});
9223792239
}
9223892240
}]);

dist/mapboxgl/iclient9-mapboxgl.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/iPortal/iPortal.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
22
* This program are made available under the terms of the Apache License, Version 2.0
33
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4-
import { SuperMap } from '../SuperMap';
5-
import { IPortalServicesQueryParam } from './iPortalServicesQueryParam';
6-
import { IPortalMapsQueryParam } from './iPortalMapsQueryParam';
7-
import { FetchRequest } from '../util/FetchRequest';
8-
import { IPortalService } from './iPortalService';
9-
import { IPortalMap } from './iPortalMap';
10-
import { IPortalServiceBase } from './iPortalServiceBase';
4+
import { SuperMap } from "../SuperMap";
5+
import { IPortalServicesQueryParam } from "./iPortalServicesQueryParam";
6+
import { IPortalMapsQueryParam } from "./iPortalMapsQueryParam";
7+
import { FetchRequest } from "../util/FetchRequest";
8+
import { IPortalService } from "./iPortalService";
9+
import { IPortalMap } from "./iPortalMap";
10+
import { IPortalServiceBase } from "./iPortalServiceBase";
1111

1212
/**
1313
* @class SuperMap.iPortal
@@ -17,9 +17,8 @@ import { IPortalServiceBase } from './iPortalServiceBase';
1717
* @param {string} iportalUrl - 地址。
1818
*/
1919
export class IPortal extends IPortalServiceBase {
20-
2120
constructor(iportalUrl, options) {
22-
super(iportalUrl,options);
21+
super(iportalUrl, options);
2322
this.iportalUrl = iportalUrl;
2423
options = options || {};
2524
this.withCredentials = options.withCredentials || false;
@@ -31,7 +30,7 @@ export class IPortal extends IPortalServiceBase {
3130
* @returns {Promise} 返回包含 iportal web 资源信息的 Promise 对象。
3231
*/
3332
load() {
34-
return FetchRequest.get(this.iportalUrl + '/web');
33+
return FetchRequest.get(this.iportalUrl + "/web");
3534
}
3635

3736
/**
@@ -45,9 +44,9 @@ export class IPortal extends IPortalServiceBase {
4544
return null;
4645
}
4746
var serviceUrl = this.iportalUrl + "/web/services";
48-
return this.request("GET", serviceUrl, queryParams).then(function (result) {
47+
return this.request("GET", serviceUrl, queryParams).then(function(result) {
4948
var services = [];
50-
result.content.map(function (serviceJsonObj) {
49+
result.content.map(function(serviceJsonObj) {
5150
services.push(new IPortalService(serviceUrl, serviceJsonObj));
5251
return serviceJsonObj;
5352
});
@@ -82,22 +81,23 @@ export class IPortal extends IPortalServiceBase {
8281
} else {
8382
mapsUrl = this.iportalUrl + "/web/maps";
8483
}
85-
return this.request("GET", mapsUrl, queryParams).then(function (result) {
84+
return this.request("GET", mapsUrl, queryParams).then(function(result) {
8685
var mapRetult = {};
8786
var maps = [];
88-
result.content.map(function (mapJsonObj) {
89-
maps.push(new IPortalMap(mapsUrl + "/" + mapJsonObj.id, mapJsonObj));
90-
return mapJsonObj;
91-
});
92-
mapRetult.content = maps;
93-
mapRetult.currentPage = result.currentPage;
94-
mapRetult.pageSize = result.pageSize;
95-
mapRetult.total = result.total;
96-
mapRetult.totalPage = result.totalPage;
97-
return mapRetult;
87+
if (result.content && result.content.length > 0) {
88+
result.content.map(function(mapJsonObj) {
89+
maps.push(new IPortalMap(mapsUrl + "/" + mapJsonObj.id, mapJsonObj));
90+
return mapJsonObj;
91+
});
92+
mapRetult.content = maps;
93+
mapRetult.currentPage = result.currentPage;
94+
mapRetult.pageSize = result.pageSize;
95+
mapRetult.total = result.total;
96+
mapRetult.totalPage = result.totalPage;
97+
return mapRetult;
98+
}
9899
});
99100
}
100101
}
101102

102103
SuperMap.iPortal = IPortal;
103-

0 commit comments

Comments
 (0)