Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
e-shield-h5
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 21553f3d
authored
Jul 29, 2022
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
找车搜索bug 车辆浮窗宽度修改
1 parent
6d1c6cdf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
100 deletions
src/utils/map.js
src/views/index.vue
src/utils/map.js
deleted
100644 → 0
View file @
6d1c6cd
let
map
=
null
;
function
MapService
()
{
map
=
null
;
}
MapService
.
prototype
=
{
init
:
(
id
)
=>
{
map
=
new
window
.
AMap
.
Map
(
id
);
return
map
;
},
// 卫星地图切换
satelEvent
:
(
satelActive
)
=>
{
let
layers
=
map
.
getLayers
();
let
satelLayer
=
[
new
window
.
AMap
.
TileLayer
.
Satellite
()];
let
flag
=
true
;
layers
.
filter
((
val
)
=>
{
if
(
val
.
CLASS_NAME
===
"AMap.TileLayer.Satellite"
)
{
satelActive
.
value
=
false
;
flag
=
false
;
map
.
remove
(
satelLayer
);
}
});
if
(
flag
)
{
satelActive
.
value
=
true
;
map
.
add
(
satelLayer
);
}
},
// 获取定位
getLocationEvent
:
(
currMarker
)
=>
{
map
.
plugin
(
"AMap.Geolocation"
,
function
()
{
var
geolocation
=
new
window
.
AMap
.
Geolocation
({
enableHighAccuracy
:
true
,
timeout
:
10000
,
buttonOffset
:
new
window
.
AMap
.
Pixel
(
10
,
20
),
zoomToAccuracy
:
true
,
buttonPosition
:
"RB"
,
});
geolocation
.
getCurrentPosition
();
window
.
AMap
.
event
.
addListener
(
geolocation
,
"complete"
,
(
data
)
=>
{
if
(
currMarker
)
{
currMarker
.
setMap
(
null
);
}
currMarker
=
new
window
.
AMap
.
Marker
({
position
:
data
.
position
,
content
:
'<span class="curr-marker"></span>'
,
map
:
map
,
offset
:
new
window
.
AMap
.
Pixel
(
-
12
,
-
12
),
});
map
.
setFitView
();
});
window
.
AMap
.
event
.
addListener
(
geolocation
,
"error"
,
()
=>
{});
});
},
// 切换路况
roadStatusEvent
:
(
roadActive
)
=>
{
let
layers
=
map
.
getLayers
();
let
roadLayer
=
[
new
window
.
AMap
.
TileLayer
.
Traffic
()];
let
flag
=
true
;
layers
.
filter
((
val
)
=>
{
if
(
val
.
CLASS_NAME
===
"AMap.TileLayer.Traffic"
)
{
roadActive
.
value
=
false
;
flag
=
false
;
map
.
remove
(
roadLayer
);
}
});
if
(
flag
)
{
roadActive
.
value
=
true
;
map
.
add
(
roadLayer
);
}
},
// 地图放大
mapPlusEvent
:
()
=>
{
map
.
zoomIn
();
},
// 地图缩小
mapMinusEvent
:
()
=>
{
map
.
zoomOut
();
},
// 刷新
refresheEvent
:
(
context
)
=>
{
context
.
emit
(
"refreshCb"
,
map
);
},
};
const
mapService
=
new
MapService
();
export
default
mapService
;
src/views/index.vue
View file @
21553f3
<
template
>
<div>
<div
@
click=
"isShowList = false"
>
<mapContent
@
refreshCb=
"refreshCb"
@
isUploaded=
"isUploaded"
...
...
@@ -24,6 +24,7 @@
<div
class=
"search-box"
:class=
"isSharePage && showNotice ? 'search-box-top' : ''"
@
click
.
stop
>
<div
class=
"search-header"
>
<div
...
...
@@ -31,11 +32,13 @@
:class=
"carItem ? 'text' : ''"
@
click=
"isShowList = !isShowList"
>
<span>
{{
carItem
? (carItem.ownerName || "--") + " | " + (carItem.vin || "--")
: "请选择"
}}
</span>
<span>
<span
v-if=
"!carItem"
>
请选择
</span>
<span
v-if=
"carItem"
>
{{ carItem.ownerName || "--" }}
</span>
<span
v-if=
"carItem && carItem.licensePlate"
>
{{
" | " + (carItem.licensePlate || "--")
}}
</span>
</span>
<span
class=
"arrow-icon"
><van-icon
name=
"arrow-down"
/></span>
</div>
</div>
...
...
@@ -63,7 +66,7 @@
<van-cell
v-for=
"item in list"
@
click=
"getCarInfo(item)"
:key=
"item"
>
<div
class=
"list-item"
:class=
"(carItem && carItem.
id) == item.id
? 'active' : ''"
:class=
"(carItem && carItem.
vin) == item.vin
? 'active' : ''"
>
<div
class=
"item-text"
>
<div
class=
"item-title"
>
...
...
@@ -266,6 +269,8 @@ export default defineComponent({
:
routeQuery
.
value
.
ownerName
,
vin
:
routeQuery
.
value
.
vin
==
"null"
?
"--"
:
routeQuery
.
value
.
vin
,
};
getCarInfo
(
carItem
.
value
);
getCarList
();
}
}
getCarList
();
...
...
@@ -371,7 +376,9 @@ export default defineComponent({
}
markers
.
push
(
drawMarker
(
item
,
map
,
locates
));
});
if
(
locates
.
length
<=
0
)
return
;
if
(
locates
.
length
<=
0
)
{
return
Toast
(
"暂无有效定位点信息"
);
}
MAPGEO
.
transferAddressByGroup
(
{
data
:
locates
,
timeoutIds
:
[]
},
()
=>
{
...
...
@@ -419,7 +426,9 @@ export default defineComponent({
item
.
source
==
1
?
"有线设备"
:
"无线设备"
}
<
/span><span>${item.sn}</
span
><
/p>`
;
if
(
item
.
status
&&
item
.
status
==
2
)
{
carInfoWindowTpl
+=
`<p class="offline-info"><i class="icon icon-offline-time"></i><span class="label">离线时长</span><span>
${
item
.
statusTime
}
</span></p>`
;
carInfoWindowTpl
+=
`<p class="offline-info"><i class="icon icon-offline-time"></i><span class="label">离线时长</span><span>
${
item
.
statusTime
||
"--"
}
<
/span></
p
>
`;
}
carInfoWindowTpl += `
<
p
class
=
"time-info"
><
i
class
=
"icon icon-online-time"
><
/i><span class="label">在线时间</
span
><
span
data
-
onlineTime
><
/span></
p
>
<
p
class
=
"locate-info"
><
i
class
=
"icon icon-locate-sm"
><
/i><span class="label">详细地址</
span
><
span
data
-
tranferAddress
><
/span></
p
>
`;
...
...
@@ -458,13 +467,13 @@ export default defineComponent({
autoMove
:
false
,
position
:
lnglat
,
content
:
infoDiv
,
offset
:
new
window
.
AMap
.
Pixel
(
0
,
-
20
),
offset
:
new
window
.
AMap
.
Pixel
(
24
,
-
20
),
});
const
move
=
(
newLnglat
)
=>
{
marker
.
setPosition
(
newLnglat
);
infoWindow
.
setPosition
(
newLnglat
);
map
.
setCenter
(
newLnglat
);
map
.
panBy
(
0
,
6
0
);
map
.
panBy
(
0
,
7
0
);
};
//信息窗体内容更新
let
GPSBtn
=
infoDiv
.
querySelector
(
"[data-GPS]"
);
...
...
@@ -649,7 +658,7 @@ export default defineComponent({
//点击车辆打开信息窗体
marker
.
on
(
"click"
,
()
=>
{
map
.
setCenter
(
infoWindow
.
getPosition
());
map
.
panBy
(
0
,
6
0
);
map
.
panBy
(
0
,
7
0
);
if
(
infoWindow
.
getIsOpen
())
{
infoWindow
.
close
();
}
else
{
...
...
@@ -676,6 +685,7 @@ export default defineComponent({
if
(
isShareDead
.
value
)
return
;
if
(
flag
)
{
pageNumber
.
value
=
0
;
finished
.
value
=
false
;
list
.
value
=
[];
}
if
(
keyWord
.
value
&&
keyWord
.
value
.
length
<
2
)
{
...
...
@@ -779,6 +789,11 @@ export default defineComponent({
line-height
:
44px
;
display
:
flex
;
justify-content
:
space-between
;
.selectedText
{
overflow
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
}
.arrow-icon
{
color
:
#9ca4ad
;
}
...
...
@@ -895,8 +910,14 @@ export default defineComponent({
}
</
style
>
<
style
lang=
"scss"
>
.amap-overlays
{
width
:
100%
;
}
.amap-info
{
width
:
100%
;
}
.car-info-window
{
width
:
280px
;
width
:
calc
(
100%
-
48px
)
;
background-color
:
#fff
;
border-radius
:
10px
;
border
:
1px
solid
#ececec
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment