44import { SuperMap } from '../SuperMap' ;
55import { Util } from '../commontypes/Util' ;
66import { 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 */
1716export 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
0 commit comments