Commit 3d4121f3 authored by 郭铭瑶's avatar 郭铭瑶 🤘

更新

parent 484cb8a0
...@@ -50,7 +50,7 @@ html, body ...@@ -50,7 +50,7 @@ html, body
overflow hidden overflow hidden
font-size .1rem font-size .1rem
// background url('@/assets/images/background.jpg') center/cover no-repeat // background url('@/assets/images/background.jpg') center/cover no-repeat
background #000 background #001220
color #fff color #fff
/* 设置滚动条的样式 */ /* 设置滚动条的样式 */
......
...@@ -43,7 +43,7 @@ export default defineComponent({ ...@@ -43,7 +43,7 @@ export default defineComponent({
viewMode: '3D', viewMode: '3D',
center: [1019.614669, 54.167243], center: [1019.614669, 54.167243],
// center: [-135.98002789627407, -722.1597065437004], // center: [-135.98002789627407, -722.1597065437004],
zooms: [8, 12], zooms: [7, 12],
zoom: 8, zoom: 8,
pitch: 45, pitch: 45,
mapStyle: 'smap://styles/dark', mapStyle: 'smap://styles/dark',
...@@ -129,19 +129,22 @@ export default defineComponent({ ...@@ -129,19 +129,22 @@ export default defineComponent({
// 添加边界 // 添加边界
function addBoundary({ function addBoundary({
name = '', name = '',
type = 'jd_boundary',
weight = 10, weight = 10,
count = 10, count = 10,
color = 'rgba(51,145,255,.6)', color = 'rgba(51,145,255,.6)',
maskColor = [0, 17, 33, 0.9], maskColor = [0, 17, 33, 0.9],
}) { }) {
const boundary = { const boundary = {
boundaryType: 'jd_boundary', boundaryType: type,
boundaryDefinition: `name like '%${name}%'`, boundaryDefinition: `name like '%${name}%'`,
boundarydistance: weight, boundarydistance: weight,
bounarycount: count, bounarycount: count,
boundaryColor: color, boundaryColor: color,
maskColor: maskColor, maskColor: maskColor,
} }
console.log('=====', boundary)
const Boundary = new Plugins.MaskBoundary(map.view) const Boundary = new Plugins.MaskBoundary(map.view)
Boundary.add(boundary) Boundary.add(boundary)
return Boundary return Boundary
......
...@@ -234,6 +234,9 @@ export default defineComponent({ ...@@ -234,6 +234,9 @@ export default defineComponent({
if (e.classification === '微更新') { if (e.classification === '微更新') {
drawerInfo.value = e drawerInfo.value = e
showDrawer.value = true showDrawer.value = true
} else {
drawerInfo.value = null
showDrawer.value = false
} }
} }
const isCommunityPointsShowNow = ref(false) const isCommunityPointsShowNow = ref(false)
...@@ -260,6 +263,13 @@ export default defineComponent({ ...@@ -260,6 +263,13 @@ export default defineComponent({
focusCenterAndAddLayer().layer() focusCenterAndAddLayer().layer()
loading.value = false loading.value = false
// setTimeout(() => {
// map.value.cameraTo({ heading: 180 })
// setTimeout(() => {
// map.value.cameraTo({ heading: 360 })
// }, 500)
// }, 6000)
// setTimeout(() => { // setTimeout(() => {
// loading.value = false // loading.value = false
// setTimeout(() => { // setTimeout(() => {
...@@ -310,6 +320,8 @@ export default defineComponent({ ...@@ -310,6 +320,8 @@ export default defineComponent({
const curBtn = ref<string | null>(null) const curBtn = ref<string | null>(null)
const handleClick = async (key: string) => { const handleClick = async (key: string) => {
map.value.remove(points.value) map.value.remove(points.value)
drawerInfo.value = null
showDrawer.value = false
if (curBtn.value === key) { if (curBtn.value === key) {
curBtn.value = null curBtn.value = null
return return
...@@ -403,6 +415,8 @@ export default defineComponent({ ...@@ -403,6 +415,8 @@ export default defineComponent({
margin-bottom .05rem margin-bottom .05rem
cursor pointer cursor pointer
transition transform .3s ease transition transform .3s ease
$blur()
background rgba(0,0,0,.6)
&:hover &:hover
transform-origin right top transform-origin right top
transform scale(1.2) transform scale(1.2)
......
...@@ -38,7 +38,7 @@ export default defineComponent({ ...@@ -38,7 +38,7 @@ export default defineComponent({
if (store.state.curView.id) { if (store.state.curView.id) {
store.dispatch('initStationData', store.state.curView.id) store.dispatch('initStationData', store.state.curView.id)
} }
if (isNaN(Number(type))) { if (isNaN(+type)) {
// 小区以外的屏 // 小区以外的屏
router.push({ router.push({
name: 'main', name: 'main',
......
<template> <template>
<div class="map-btns" :class="{ full: fullScreen }"> <div class="map-btns" :class="{ full: fullScreen }">
<!-- <a-checkbox-group :option="options" @change="handleChange" /> -->
<template v-for="btn in btns"> <template v-for="btn in btns">
<a-tooltip v-if="btn.key === 'polyline'" :key="btn.key" placement="right"> <a-tooltip v-if="btn.key === 'polyline'" :key="btn.key" placement="right">
<img :key="btn.key" :src="btn.icon" draggable="false" /> <img :key="btn.key" :src="btn.icon" draggable="false" />
...@@ -310,6 +309,8 @@ $bg = rgba(6,34,67,.4) ...@@ -310,6 +309,8 @@ $bg = rgba(6,34,67,.4)
margin-top .05rem margin-top .05rem
cursor pointer cursor pointer
transition .3s ease transition .3s ease
background rgba(0,0,0,.6)
$blur()
&:hover &:hover
transform scale(1.2) transform scale(1.2)
</style> </style>
...@@ -22,14 +22,14 @@ export default function useSwitchMap(map: any) { ...@@ -22,14 +22,14 @@ export default function useSwitchMap(map: any) {
watch( watch(
() => store.state.showCommunityPoints, () => store.state.showCommunityPoints,
(val) => { (val) => {
val ? setPoints(curViewType.value) : map.value.hideCommunity() val ? setPointsAndBoundary(curViewType.value) : map.value.hideCommunity()
} }
) )
watch( watch(
() => curViewType.value, () => curViewType.value,
(type) => { (type) => {
store.commit('SET_SHOW_COMMUNITY_POINTS', false) store.commit('SET_SHOW_COMMUNITY_POINTS', false)
setPoints(type) setPointsAndBoundary(type)
if (areaLines.value && areaLines.value.length > 0) { if (areaLines.value && areaLines.value.length > 0) {
map.value.remove(areaLines.value) map.value.remove(areaLines.value)
} }
...@@ -37,29 +37,45 @@ export default function useSwitchMap(map: any) { ...@@ -37,29 +37,45 @@ export default function useSwitchMap(map: any) {
store.commit('SET_MAP_TYPE', '2D') store.commit('SET_MAP_TYPE', '2D')
} }
) )
const boundary = ref<any>(null)
// 根据条件显示小区点 // 根据条件显示小区点和添加边界
function setPoints(type: string) { function setPointsAndBoundary(type: string) {
boundary.value && map.value.remove(boundary.value)
const show = store.state.showCommunityPoints const show = store.state.showCommunityPoints
switch (type) { switch (type) {
case 'work1': case 'work1':
show && showPoints({ gridId: store.state.workArea1.id }) show && showPoints({ gridId: store.state.workArea1.id })
map.value.addBoundary({ name: '第一工作站', color: 'rgba(0,0,0,0)' }) boundary.value = map.value.addBoundary({
type: 'njdljd_boundary',
name: '第一工作站',
color: 'rgba(0,0,0,0)',
})
map.value.focus(...store.state.workArea1.center, 8) map.value.focus(...store.state.workArea1.center, 8)
break break
case 'work2': case 'work2':
show && showPoints({ gridId: store.state.workArea2.id }) show && showPoints({ gridId: store.state.workArea2.id })
map.value.addBoundary({ name: '第二工作站', color: 'rgba(0,0,0,0)' }) boundary.value = map.value.addBoundary({
type: 'njdljd_boundary',
name: '第二工作站',
color: 'rgba(0,0,0,0)',
})
map.value.focus(...store.state.workArea2.center, 8) map.value.focus(...store.state.workArea2.center, 8)
break break
case 'work3': case 'work3':
show && showPoints({ gridId: store.state.workArea3.id }) show && showPoints({ gridId: store.state.workArea3.id })
map.value.addBoundary({ name: '第三工作站', color: 'rgba(0,0,0,0)' }) boundary.value = map.value.addBoundary({
type: 'njdljd_boundary',
name: '第三工作站',
color: 'rgba(0,0,0,0)',
})
map.value.focus(...store.state.workArea3.center, 8) map.value.focus(...store.state.workArea3.center, 8)
break break
case 'street': case 'street':
show && showPoints() show && showPoints()
map.value.addBoundary({ name: '南京东路街道', color: 'rgba(0,0,0,0)' }) boundary.value = map.value.addBoundary({
name: '南京东路街道',
color: 'rgba(0,0,0,0)',
})
map.value.focus(207.9006154792994, 71.67111885454233, 8) map.value.focus(207.9006154792994, 71.67111885454233, 8)
break break
default: default:
...@@ -75,7 +91,7 @@ export default function useSwitchMap(map: any) { ...@@ -75,7 +91,7 @@ export default function useSwitchMap(map: any) {
} }
const handleMapComplete = async () => { const handleMapComplete = async () => {
setPoints(curViewType.value) setPointsAndBoundary(curViewType.value)
if (curMapType.value === '3D') { if (curMapType.value === '3D') {
if (curViewType.value === 'work1') { if (curViewType.value === 'work1') {
map.value.layer('model_white_zw').visible = false map.value.layer('model_white_zw').visible = false
......
...@@ -103,6 +103,12 @@ export default defineComponent({ ...@@ -103,6 +103,12 @@ export default defineComponent({
onMounted(async () => { onMounted(async () => {
await nextTick() await nextTick()
map.value.initMap({ viewMode: '2D' }) map.value.initMap({ viewMode: '2D' })
if (!isNaN(+store.state.curView.type)) {
store.commit('SET_CURRENT_VIEW', {
name: '南京东路街道',
type: 'street',
})
}
}) })
const { handleMapComplete, selectArea, handleZoom } = useSwitchMap(map) const { handleMapComplete, selectArea, handleZoom } = useSwitchMap(map)
return { return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment