Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
1ff75e0b
Commit
1ff75e0b
authored
Dec 10, 2020
by
邹绪超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复资源路径
parent
c8ca64c9
Pipeline
#20374
passed with stages
in 2 minutes 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
24 deletions
+50
-24
index.js
packages/map/src/index.js
+50
-24
No files found.
packages/map/src/index.js
View file @
1ff75e0b
...
@@ -2,15 +2,11 @@ import React from 'react';
...
@@ -2,15 +2,11 @@ import React from 'react';
import
PropTypes
from
'prop-types'
;
import
PropTypes
from
'prop-types'
;
import
esriLoader
from
'esri-loader'
;
import
esriLoader
from
'esri-loader'
;
console
.
log
(
esriLoader
);
console
.
log
(
React
);
console
.
log
(
PropTypes
);
export
class
CreateMap
extends
React
.
Component
{
export
class
CreateMap
extends
React
.
Component
{
static
defaultProps
=
{
static
defaultProps
=
{
id
:
'#jsmap'
,
id
:
'#jsmap'
,
width
:
'100%'
,
width
:
'100%'
,
height
:
'
100%
'
,
height
:
'
350px
'
,
};
};
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -19,13 +15,44 @@ export class CreateMap extends React.Component {
...
@@ -19,13 +15,44 @@ export class CreateMap extends React.Component {
view
:
null
,
view
:
null
,
};
};
this
.
mapRef
=
React
.
createRef
();
this
.
mapRef
=
React
.
createRef
();
window
.
_config
=
{
userInfo
:
{
site
:
''
,
},
};
}
}
componentDidMount
()
{
componentDidMount
()
{
let
modules
=
[
'gis/Map'
,
'gis/views/MapView'
,
'dojo/domReady!'
];
let
modules
=
[
'gis/Map'
,
'gis/views/MapView'
,
'dojo/domReady!'
];
loadModules
(
modules
).
then
(
loadModules
(
modules
).
then
(
function
(
results
)
{
function
(
results
)
{
console
.
log
(
results
);
let
Map
=
results
[
0
];
let
MapView
=
results
[
1
];
const
map
=
new
Map
({
basemap
:
'satellite'
,
});
// Create a MapView instance (for 2D viewing) and reference the map instance
const
view
=
new
MapView
({
center
:
[
120.2
,
32.1
],
map
:
map
,
container
:
this
.
mapRef
.
current
,
zoom
:
5
,
});
view
.
when
(
function
()
{
console
.
log
(
'resolved'
);
// This function will execute once the promise is resolved
},
function
(
error
)
{
console
.
log
(
error
);
// This function will execute if the promise is rejected due to an error
},
);
window
.
viewLocal
=
view
;
console
.
log
(
window
.
viewLocal
);
}.
bind
(
this
),
}.
bind
(
this
),
);
);
}
}
...
@@ -56,10 +83,8 @@ export function loadModules(modules = [], mapSettings = {}) {
...
@@ -56,10 +83,8 @@ export function loadModules(modules = [], mapSettings = {}) {
let
mergeMapSettings
=
Object
.
assign
(
getMapSettings
(),
mapSettings
);
let
mergeMapSettings
=
Object
.
assign
(
getMapSettings
(),
mapSettings
);
return
new
Promise
(
return
new
Promise
(
function
(
resolve
,
reject
)
{
function
(
resolve
,
reject
)
{
console
.
log
(
esriLoader
);
esriLoader
.
loadModules
(
modules
,
mergeMapSettings
).
then
(
esriLoader
.
loadModules
(
modules
,
mergeMapSettings
).
then
(
function
(
array
)
{
function
(
array
)
{
console
.
log
(
array
);
resolve
(
array
);
resolve
(
array
);
}.
bind
(
this
),
}.
bind
(
this
),
);
);
...
@@ -68,9 +93,10 @@ export function loadModules(modules = [], mapSettings = {}) {
...
@@ -68,9 +93,10 @@ export function loadModules(modules = [], mapSettings = {}) {
}
}
export
function
getMapSettings
()
{
export
function
getMapSettings
()
{
let
origin
=
location
.
origin
;
return
{
return
{
url
:
'
gis/4.9/init.js'
,
url
:
origin
+
'/
gis/4.9/init.js'
,
css
:
'
gis/4.9/gis/css/main.css'
,
css
:
origin
+
'/
gis/4.9/gis/css/main.css'
,
dojoConfig
:
{
dojoConfig
:
{
has
:
{
has
:
{
'gis-featurelayer-webgl'
:
1
,
'gis-featurelayer-webgl'
:
1
,
...
@@ -101,67 +127,67 @@ export function getMapSettings() {
...
@@ -101,67 +127,67 @@ export function getMapSettings() {
baseUrl
:
'./'
,
baseUrl
:
'./'
,
packages
:
[
packages
:
[
{
{
location
:
'gis/4.9/dojo'
,
location
:
origin
+
'/'
+
'gis/4.9/dojo'
,
name
:
'dojo'
,
name
:
'dojo'
,
},
},
{
{
location
:
'gis/4.9/dijit'
,
location
:
origin
+
'/'
+
'gis/4.9/dijit'
,
name
:
'dijit'
,
name
:
'dijit'
,
},
},
{
{
location
:
'gis/4.9/dojox'
,
location
:
origin
+
'/'
+
'gis/4.9/dojox'
,
name
:
'dojox'
,
name
:
'dojox'
,
},
},
{
{
location
:
'gis/4.9/dgrid'
,
location
:
origin
+
'/'
+
'gis/4.9/dgrid'
,
main
:
'OnDemandGrid'
,
main
:
'OnDemandGrid'
,
name
:
'dgrid'
,
name
:
'dgrid'
,
},
},
{
{
location
:
'gis/4.9/dstore'
,
location
:
origin
+
'/'
+
'gis/4.9/dstore'
,
main
:
'Store'
,
main
:
'Store'
,
name
:
'dstore'
,
name
:
'dstore'
,
},
},
{
{
location
:
'gis/4.9/gis'
,
location
:
origin
+
'/'
+
'gis/4.9/gis'
,
name
:
'gis'
,
name
:
'gis'
,
},
},
{
{
location
:
'gis/4.9/moment'
,
location
:
origin
+
'/'
+
'gis/4.9/moment'
,
main
:
'moment'
,
main
:
'moment'
,
name
:
'moment'
,
name
:
'moment'
,
},
},
{
{
location
:
'gis/4.9/@dojo'
,
location
:
origin
+
'/'
+
'gis/4.9/@dojo'
,
name
:
'@dojo'
,
name
:
'@dojo'
,
},
},
{
{
location
:
'gis/4.9/cldrjs'
,
location
:
origin
+
'/'
+
'gis/4.9/cldrjs'
,
main
:
'dist/cldr'
,
main
:
'dist/cldr'
,
name
:
'cldrjs'
,
name
:
'cldrjs'
,
},
},
{
{
location
:
'gis/4.9/globalize'
,
location
:
origin
+
'/'
+
'gis/4.9/globalize'
,
main
:
'dist/globalize'
,
main
:
'dist/globalize'
,
name
:
'globalize'
,
name
:
'globalize'
,
},
},
{
{
location
:
'gis/4.9/maquette'
,
location
:
origin
+
'/'
+
'gis/4.9/maquette'
,
main
:
'dist/maquette.umd'
,
main
:
'dist/maquette.umd'
,
name
:
'maquette'
,
name
:
'maquette'
,
},
},
{
{
location
:
'gis/4.9/maquette-css-transitions'
,
location
:
origin
+
'/'
+
'gis/4.9/maquette-css-transitions'
,
main
:
'dist/maquette-css-transitions.umd'
,
main
:
'dist/maquette-css-transitions.umd'
,
name
:
'maquette-css-transitions'
,
name
:
'maquette-css-transitions'
,
},
},
{
{
location
:
'gis/4.9/maquette-jsx'
,
location
:
origin
+
'/'
+
'gis/4.9/maquette-jsx'
,
main
:
'dist/maquette-jsx.umd'
,
main
:
'dist/maquette-jsx.umd'
,
name
:
'maquette-jsx'
,
name
:
'maquette-jsx'
,
},
},
{
{
location
:
'gis/4.9/tslib'
,
location
:
origin
+
'/'
+
'gis/4.9/tslib'
,
main
:
'tslib'
,
main
:
'tslib'
,
name
:
'tslib'
,
name
:
'tslib'
,
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment