Skip to content

Commit c661b24

Browse files
author
xujiaming
committed
1.portal.js新增获取资源列表接口,用于资源中心展示; 新增iPortalQueryParam(资源请求参数)、iPortalResource(资源详情类)、iPortalQueryResult(资源结果封装类)
1 parent f0f9eba commit c661b24

File tree

9 files changed

+100
-82
lines changed

9 files changed

+100
-82
lines changed

src/common/iPortal/iPortal.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,20 @@ export class IPortal extends IPortalServiceBase {
5252
if (!(queryParams instanceof IPortalQueryParam)) {
5353
return null;
5454
}
55-
//http://rdc.ispeco.com/gateway/catalog/resource/search.json?aggregationTypes=%5B%22TYPE%22%5D&t=1574736505796&pageSize=12&currentPage=1&orderBy=UPDATETIME&orderType=DESC&tags=%5B%5D&dirIds=%5B%5D&searchType=PUBLIC&resourceSubTypes=%5B%5D
55+
var me = this;
5656
var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
57+
queryParams.t = new Date().getTime();
5758
return this.request("GET", resourceUrl, queryParams).then(function(result) {
5859
var content = [];
5960
result.content.forEach(function(item) {
60-
content.push(new IPortalResource(resourceUrl, item));
61+
content.push(new IPortalResource(me.iportalUrl, item));
6162
});
6263
let queryResult = new IPortalQueryResult();
6364
queryResult.content = content;
6465
queryResult.total = result.total;
65-
66+
queryResult.currentPage = result.currentPage;
67+
queryResult.pageSize = result.pageSize;
68+
queryResult.aggregations = result.aggregations;
6669
return queryResult;
6770
});
6871
}

src/common/iPortal/iPortalQueryParam.js

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
44
import {SuperMap} from '../SuperMap';
55
import {Util} from '../commontypes/Util';
6-
6+
77
/**
8-
* @class SuperMap.IPortalQueryParam
8+
* @class SuperMap.iPortalQueryParam
99
* @classdesc iPortal 资源查询参数。
1010
* @category iPortal/Online
1111
* @param {Object} params - iPortal 资源查询具体参数。
@@ -15,26 +15,22 @@ export class IPortalQueryParam {
1515

1616
constructor(params) {
1717
params = params || {};
18-
this.userNames = null;
19-
this.tags = null;
20-
this.suggest = false;
21-
this.sourceTypes = null;
22-
this.keywords = null;
23-
this.epsgCode = null;
24-
this.orderBy = null;
25-
this.currentPage = null;
26-
this.pageSize = null;
27-
this.dirIds = null;
28-
this.isNotInDir = false;
29-
this.updateStart = null;
30-
this.updateEnd = null;
31-
this.visitStart = null;
32-
this.visitEnd = null;
33-
this.filterFields = null;
18+
this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
19+
this.pageSize = 12; // 每页多少条
20+
this.currentPage = 1; // 第几页
21+
this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
22+
this.orderType = "DESC"; // DESC ASC
23+
this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
24+
this.tags = []; // 标签
25+
this.dirIds = []; // 类别
26+
this.resourceSubTypes = []; // 类型
27+
this.aggregationTypes = []; // TAG TYPE SUBTYPE
28+
this.text = ""; // 搜索字段
29+
this.groupIds = []; // 群组Id过滤
30+
this.departmentIds = []; // 部门Id过滤
3431
Util.extend(this, params);
3532
}
36-
3733
}
38-
3934
SuperMap.iPortalQueryParam = IPortalQueryParam;
40-
35+
36+

src/common/iPortal/iPortalQueryResult.js

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,14 @@ import {Util} from '../commontypes/Util';
1313
*
1414
*/
1515
export class IPortalQueryResult {
16-
constructor(mapUrl, params) {
16+
constructor(params) {
1717
params = params || {};
18-
this.authorizeSetting = [];
19-
this.center = "";
20-
this.controls = null;
21-
this.checkStatus = "";
22-
this.createTime = 0;
23-
this.description = "";
24-
this.epsgCode = 0;
25-
this.extent = "";
26-
this.id = 0;
27-
this.isDefaultBottomMap = false;
28-
this.layers = [];
29-
this.level = null;
30-
this.nickname = "";
31-
this.sourceType = "";
32-
this.status = null;
33-
this.tags = [];
34-
this.thumbnail = "";
35-
this.title = "";
36-
this.units = null;
37-
this.updateTime = 0;
38-
this.userName = "";
39-
this.visitCount = 0;
18+
this.content = [];
19+
this.total = 0;
20+
this.currentPage = 1;
21+
this.pageSize = 12;
22+
this.aggregations = null;
4023
Util.extend(this, params);
41-
this.mapUrl = mapUrl;
4224
}
4325

4426
}

src/common/iPortal/iPortalResource.js

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,74 +4,74 @@
44
import {SuperMap} from '../SuperMap';
55
import {Util} from '../commontypes/Util';
66
import {IPortalServiceBase} from './iPortalServiceBase';
7-
87
/**
98
* @class SuperMap.IPortalResource
109
* @classdesc iPortal 资源详情类。
1110
* @category iPortal/Online
12-
* @param {string} resourceUrl - 资源地址。
11+
* @param {string} portalUrl - 资源地址。
1312
* @param {Object} [resourceInfo] - 资源详情参数。
1413
* @extends {SuperMap.iPortalServiceBase}
1514
*
1615
*/
1716
export class IPortalResource extends IPortalServiceBase {
18-
constructor(mapUrl, resourceInfo) {
19-
super(mapUrl);
17+
constructor(portalUrl, resourceInfo) {
18+
super(portalUrl);
2019
resourceInfo = resourceInfo || {};
2120
this.authorizeSetting = [];
22-
this.center = "";
23-
this.controls = null;
21+
this.bounds = "";
22+
this.bounds4326 = "";
2423
this.checkStatus = "";
2524
this.createTime = 0;
26-
this.description = "";
25+
this.description = null;
26+
this.dirId = null;
2727
this.epsgCode = 0;
28-
this.extent = "";
28+
this.heatLevel = 0;
2929
this.id = 0;
30-
this.isDefaultBottomMap = false;
31-
this.layers = [];
32-
this.level = null;
33-
this.nickname = "";
34-
this.sourceType = "";
35-
this.status = null;
36-
this.tags = [];
37-
this.thumbnail = "";
38-
this.title = "";
39-
this.units = null;
30+
this.name = "";
31+
this.personalDirId = null;
32+
this.resourceId = 0;
33+
this.resourceSubType = null;
34+
this.resourceType = null;
35+
this.serviceRootUrlId = null;
36+
this.tags = null;
37+
this.thumbnail = null;
4038
this.updateTime = 0;
4139
this.userName = "";
42-
this.visitCount = 0;
43-
Util.extend(this, resourceInfo);
44-
this.mapUrl = mapUrl;
40+
Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
41+
this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
42+
if (this.withCredentials) {
43+
this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
44+
}
4545
// if (this.id) {
4646
// this.mapUrl = mapUrl + "/" + this.id;
4747
// }
4848
}
4949

5050
/**
51-
* @function SuperMap.iPortalMap.prototype.load
52-
* @description 加载地图信息
51+
* @function SuperMap.IPortalResource.prototype.load
52+
* @description 加载资源信息
5353
* @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
5454
*/
5555
load() {
5656
var me = this;
57-
return me.request("GET", me.mapUrl + ".json")
58-
.then(function (mapInfo) {
59-
if (mapInfo.error) {
60-
return mapInfo;
57+
return me.request("GET", me.resourceUrl + ".json")
58+
.then(function (resourceInfo) {
59+
if (resourceInfo.error) {
60+
return resourceInfo;
6161
}
62-
for (var key in mapInfo) {
63-
me[key] = mapInfo[key];
62+
for (var key in resourceInfo) {
63+
me[key] = resourceInfo[key];
6464
}
6565
});
6666
}
6767

6868
/**
69-
* @function SuperMap.iPortalMap.prototype.update
69+
* @function SuperMap.IPortalResource.prototype.update
7070
* @description 更新地图参数。
7171
* @returns {Promise} 返回包含更新操作状态的 Promise 对象。
7272
*/
7373
update() {
74-
var mapUpdateParam = {
74+
var resourceUpdateParam = {
7575
units: this.units,
7676
level: this.level,
7777
center: this.center,
@@ -90,10 +90,10 @@ export class IPortalResource extends IPortalServiceBase {
9090
var options = {
9191
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
9292
};
93-
return this.request("PUT", this.mapUrl, JSON.stringify(mapUpdateParam), options);
93+
return this.request("PUT", this.resourceUrl, JSON.stringify(resourceUpdateParam), options);
9494
}
9595

9696
}
9797

98-
SuperMap.iPortalMap = IPortalResource;
98+
SuperMap.iPortalResource = IPortalResource;
9999

src/common/iPortal/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
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.*/
44
import {IPortal} from './iPortal';
5+
import {IPortalQueryParam} from './iPortalQueryParam';
6+
import {IPortalResource} from './iPortalResource';
7+
import {IPortalQueryResult} from './iPortalQueryResult';
58
import {IPortalMap} from './iPortalMap'
69
import {IPortalMapsQueryParam} from './iPortalMapsQueryParam';
710
import {IPortalService} from './iPortalService';
@@ -15,6 +18,9 @@ import {IPortalScene} from './iPortalScene'
1518
import {IPortalScenesQueryParam} from './iPortalScenesQueryParam';
1619

1720
export {IPortal} ;
21+
export {IPortalQueryParam};
22+
export {IPortalResource};
23+
export {IPortalQueryResult};
1824
export {IPortalMap};
1925
export {IPortalMapsQueryParam} ;
2026
export {IPortalService} ;

src/common/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ import { TimeControlBase, TimeFlowControl } from './control';
9797
import { IManager, IManagerCreateNodeParam, IManagerServiceBase } from './iManager';
9898
import {
9999
IPortal,
100+
IPortalQueryParam,
101+
IPortalResource,
102+
IPortalQueryResult,
100103
IPortalMap,
101104
IPortalMapsQueryParam,
102105
IPortalInsight,
@@ -552,7 +555,23 @@ export { TimeControlBase, TimeFlowControl };
552555
export { Format, GeoJSON, JSONFormat, WKT };
553556
export { setCORS, isCORS, setRequestTimeout, getRequestTimeout, FetchRequest, ColorsPickerUtil, ArrayStatistic };
554557
export { IManager, IManagerCreateNodeParam, IManagerServiceBase };
555-
export { IPortal, IPortalMap, IPortalMapsQueryParam, IPortalInsight, IPortalInsightsQueryParam, IPortalScene, IPortalScenesQueryParam,IPortalService, IPortalServiceBase, IPortalServicesQueryParam, IPortalMapdashboard, IPortalMapdashboardsQueryParam };
558+
export {
559+
IPortal,
560+
IPortalQueryParam,
561+
IPortalResource,
562+
IPortalQueryResult,
563+
IPortalMap,
564+
IPortalMapsQueryParam,
565+
IPortalInsight,
566+
IPortalInsightsQueryParam,
567+
IPortalScene,
568+
IPortalScenesQueryParam,
569+
IPortalService,
570+
IPortalServiceBase,
571+
IPortalServicesQueryParam,
572+
IPortalMapdashboard,
573+
IPortalMapdashboardsQueryParam
574+
};
556575
export {
557576
AddressMatchService,
558577
AggregationParameter,

src/leaflet/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ import {
6868
IManagerCreateNodeParam,
6969
//iPortal
7070
IPortal,
71+
IPortalQueryParam,
72+
IPortalResource,
73+
IPortalQueryResult,
7174
IPortalMap,
7275
IPortalMapsQueryParam,
7376
IPortalInsight,
@@ -527,6 +530,9 @@ export {
527530
IManagerCreateNodeParam,
528531
//iPortal
529532
IPortal,
533+
IPortalQueryParam,
534+
IPortalResource,
535+
IPortalQueryResult,
530536
IPortalMap,
531537
IPortalMapsQueryParam,
532538
IPortalInsight,

src/mapboxgl/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ export {
6868
IManagerCreateNodeParam,
6969
//iPortal
7070
IPortal,
71+
IPortalQueryParam,
72+
IPortalResource,
73+
IPortalQueryResult,
7174
IPortalMap,
7275
IPortalMapsQueryParam,
7376
IPortalInsight,

src/openlayers/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ export {
6868
IManagerCreateNodeParam,
6969
//iPortal
7070
IPortal,
71+
IPortalQueryParam,
72+
IPortalResource,
73+
IPortalQueryResult,
7174
IPortalMap,
7275
IPortalMapsQueryParam,
7376
IPortalService,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy