Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
biz.qingxiao.com
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
wangxuelai
biz.qingxiao.com
Commits
cb9d5a48
Commit
cb9d5a48
authored
Oct 18, 2019
by
baixian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图优化1
parent
da6b0e01
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
schooladd.js
src/models/schooladd.js
+3
-3
SelectPlace.js
src/pages/schooledit/SelectPlace.js
+18
-10
No files found.
src/models/schooladd.js
View file @
cb9d5a48
...
...
@@ -86,7 +86,7 @@ export default {
longitude
:
Number
(
schoolDetailData
.
data
.
longitude
),
latitude
:
Number
(
schoolDetailData
.
data
.
latitude
),
locationAddress
:
schoolDetailData
.
data
.
location_address
,
address
:
''
,
address
:
schoolDetailData
.
data
.
address
,
mobile
:
mobile
||
[
''
],
province
:
schoolDetailData
.
data
.
province
,
city
:
schoolDetailData
.
data
.
city
,
...
...
@@ -194,7 +194,7 @@ export default {
title
,
longitude
,
latitude
,
location_address
:
locationAddress
,
location_address
:
province
+
city
+
district
+
locationAddress
,
address
:
locationAddress
,
logo
:
''
,
category
:
selectcategorys
.
join
(
','
),
...
...
@@ -228,7 +228,7 @@ export default {
title
,
longitude
,
latitude
,
location_address
:
locationAddress
,
location_address
:
province
+
city
+
district
+
locationAddress
,
address
:
locationAddress
,
logo
:
''
,
category
:
selectcategorys
.
join
(
','
),
...
...
src/pages/schooledit/SelectPlace.js
View file @
cb9d5a48
...
...
@@ -11,7 +11,6 @@ class SelectPlaceMap extends React.Component {
super
(
props
);
this
.
state
=
{
location
:
[],
address
:
''
,
locationList
:
[],
locationIndex
:
-
1
,
};
...
...
@@ -60,13 +59,13 @@ class SelectPlaceMap extends React.Component {
const
info
=
new
qq
.
maps
.
InfoWindow
({
map
:
that
.
map
,
position
:
that
.
map
.
center
,
content
:
locationAddress
,
content
:
`<div>地址:
${
address
}
<div>`
,
zIndex
:
99
,
visible
:
true
,
});
qq
.
maps
.
event
.
addListener
(
pointMarker
,
'click'
,
()
=>
{
info
.
open
();
info
.
setContent
(
locationA
ddress
);
info
.
setContent
(
a
ddress
);
info
.
setPosition
(
showLatlng
);
});
that
.
pointArray
.
push
(
pointMarker
);
...
...
@@ -87,7 +86,7 @@ class SelectPlaceMap extends React.Component {
showLatlng
=
new
qq
.
maps
.
LatLng
(
res
.
result
.
location
.
lat
,
res
.
result
.
location
.
lng
);
let
title
=
''
;
if
(
res
.
result
.
address_component
.
province
)
{
title
=
res
.
result
.
address_component
.
province
+
res
.
result
.
address_component
.
city
+
res
.
result
.
formatted_addresses
.
rough
;
title
=
res
.
result
.
formatted_addresses
.
rough
;
dispatch
({
type
:
'schooladd/updateState'
,
payload
:
{
...
...
@@ -97,6 +96,7 @@ class SelectPlaceMap extends React.Component {
province
:
res
.
result
.
address_component
.
province
,
city
:
res
.
result
.
address_component
.
city
,
district
:
res
.
result
.
address_component
.
district
,
address
:
title
,
},
});
}
...
...
@@ -108,7 +108,7 @@ class SelectPlaceMap extends React.Component {
if
(
title
!=
''
)
{
const
info
=
new
qq
.
maps
.
InfoWindow
({
map
:
that
.
map
,
content
:
title
||
''
,
content
:
`<div>地址:
${
title
}
<div>`
,
position
:
showLatlng
,
zIndex
:
99
,
visible
:
true
,
...
...
@@ -222,6 +222,7 @@ class SelectPlaceMap extends React.Component {
province
:
this
.
state
.
locationList
[
index
].
ad_info
.
province
,
city
:
this
.
state
.
locationList
[
index
].
ad_info
.
city
,
district
:
this
.
state
.
locationList
[
index
].
ad_info
.
district
,
address
:
`
${
this
.
state
.
locationList
[
index
].
title
}
`
,
},
});
// message.success('已将该地址导入为机构地址,不要忘记保存哦', 2);
...
...
@@ -243,6 +244,7 @@ class SelectPlaceMap extends React.Component {
province
:
this
.
state
.
locationList
[
index
].
ad_info
.
province
,
city
:
this
.
state
.
locationList
[
index
].
ad_info
.
city
,
district
:
this
.
state
.
locationList
[
index
].
ad_info
.
district
,
address
:
`
${
this
.
state
.
locationList
[
index
].
title
}
`
,
},
});
// message.success('已将该地址导入为机构地址,不要忘记保存哦', 2);
...
...
@@ -255,7 +257,9 @@ class SelectPlaceMap extends React.Component {
this
.
markerArray
[
index
].
setZIndex
(
this
.
markerArray
.
length
);
}
searchAddress
=
()
=>
{
const
{
dispatch
,
locationAddress
,
city
}
=
this
.
props
;
const
{
dispatch
,
locationAddress
,
city
,
address
,
}
=
this
.
props
;
this
.
pointArray
.
forEach
((
ele
)
=>
{
ele
.
setMap
(
null
);
});
...
...
@@ -321,9 +325,10 @@ class SelectPlaceMap extends React.Component {
province
:
this
.
state
.
locationList
[
index
].
ad_info
.
province
,
city
:
this
.
state
.
locationList
[
index
].
ad_info
.
city
,
district
:
this
.
state
.
locationList
[
index
].
ad_info
.
district
,
address
:
`
${
this
.
state
.
locationList
[
index
].
title
}
`
,
},
});
message
.
success
(
'已将该地址导入为机构地址,不要忘记保存哦'
,
2
);
//
message.success('已将该地址导入为机构地址,不要忘记保存哦', 2);
});
this
.
listener_arr
.
push
(
listener3
);
this
.
map
.
fitBounds
(
this
.
latlngBounds
);
...
...
@@ -331,11 +336,12 @@ class SelectPlaceMap extends React.Component {
});
}
searchinput
=
(
e
)
=>
{
const
{
dispatch
,
locationAddress
}
=
this
.
props
;
const
{
dispatch
,
locationAddress
,
address
}
=
this
.
props
;
dispatch
({
type
:
'schooladd/updateState'
,
payload
:
{
locationAddress
:
e
.
target
.
value
,
address
:
e
.
target
.
value
,
},
});
}
...
...
@@ -350,10 +356,10 @@ class SelectPlaceMap extends React.Component {
city
,
district
,
locationAddress
,
address
,
}
=
this
.
props
;
const
{
location
,
address
,
locationList
,
locationIndex
,
}
=
this
.
state
;
...
...
@@ -391,7 +397,7 @@ class SelectPlaceMap extends React.Component {
className
=
"loginrow"
>
<
span
className
=
{
pageStyles
.
formitenname
}
>
详细地址:
<
/span
>
<
Input
placeholder
=
"请输入详细地址"
className
=
{
pageStyles
.
addressinput
}
value
=
{
locationA
ddress
}
onChange
=
{
e
=>
this
.
searchinput
(
e
)}
/
>
<
Input
placeholder
=
"请输入详细地址"
className
=
{
pageStyles
.
addressinput
}
value
=
{
a
ddress
}
onChange
=
{
e
=>
this
.
searchinput
(
e
)}
/
>
<
Button
type
=
"primary"
className
=
{
pageStyles
.
searchbtn
}
onClick
=
{
this
.
searchAddress
}
>
搜索地图
<
/Button
>
<
/FormItem
>
<
/Col
>
...
...
@@ -443,6 +449,7 @@ function mapStateToProps(state) {
province
,
city
,
district
,
address
,
}
=
state
.
schooladd
;
return
{
categorys
,
...
...
@@ -456,6 +463,7 @@ function mapStateToProps(state) {
province
,
city
,
district
,
address
,
};
}
export
default
connect
(
mapStateToProps
)(
SelectPlace
);
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