Commit 72047841 authored by 郭铭瑶's avatar 郭铭瑶 🤘

接入地图

parent 44ca7df6
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -6,14 +6,16 @@ ...@@ -6,14 +6,16 @@
<link rel="icon" href="./favicon.ico" /> <link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>静安智慧房管</title> <title>静安智慧房管</title>
<script type="module" crossorigin src="./assets/index.b725d4a1.js"></script> <script type="module" crossorigin src="./assets/index.c26d6571.js"></script>
<link rel="modulepreload" href="./assets/vendor.f402338c.js"> <link rel="modulepreload" href="./assets/vendor.8dcd84ff.js">
<link rel="stylesheet" href="./assets/vendor.db35e2cd.css"> <link rel="stylesheet" href="./assets/vendor.db35e2cd.css">
<link rel="stylesheet" href="./assets/index.9a62791e.css"> <link rel="stylesheet" href="./assets/index.ceed81cb.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script src="./shanghaiwuye_gis_map_api_3.2.210421/SMap.min.js"></script>
<script src="./shanghaiwuye_gis_map_api_3.2.210421/Plugins.min.js"></script>
</body> </body>
......
This diff is collapsed.
This diff is collapsed.
new SMap.Network().setNet(网络参数);
网络参数包括以下几个值:
'internet':表示互联网2D;
'affairs':表示政务网2D;
'local3D':表示局域网3D;
'affairs3D':表示政务网3D;
'njdl':表示南京东路政务网3D;
\ No newline at end of file
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
<div class="my-progress"> <div class="my-progress">
<div v-if="msg" class="msg"> <div v-if="msg" class="msg">
<p v-if="msg.name">{{ msg.name }}</p> <p v-if="msg.name">{{ msg.name }}</p>
<p v-if="msg.value" :style="{ color: msg.color }"> <p v-if="msg.value || msg.value === 0" :style="{ color: msg.color }">
<MonitorCount v-if="typeof msg.value === 'number'" :value="msg.value" /> <MonitorCount
v-if="typeof msg.value === 'number'"
:value="msg.value"
:decimal="msg.decimal || 0"
/>
<span v-else>{{ msg.value }}</span> <span v-else>{{ msg.value }}</span>
<span v-if="msg.unit">{{ msg.unit }}</span> <span v-if="msg.unit">{{ msg.unit }}</span>
</p> </p>
...@@ -24,6 +28,7 @@ export interface ProgressProps { ...@@ -24,6 +28,7 @@ export interface ProgressProps {
value?: number value?: number
unit?: string unit?: string
color?: string color?: string
decimal?: number
} }
export default defineComponent({ export default defineComponent({
name: 'MyProgress', name: 'MyProgress',
......
This diff is collapsed.
// import * as vue from 'vue' // import * as vue from 'vue'
// import fetchComponents from 'http://127.0.0.1:8082/component-lib.min.js' // import axios from 'axios'
// const { components, eventBus } = fetchComponents(vue)('http://127.0.0.1:8082') // import qs from 'qs'
// import fetchComponents from 'http://127.0.0.1:8088/component-lib.min.js'
// const { components, eventBus } = fetchComponents(
// vue,
// axios,
// qs,
// )('http://ja-hm.omniview.pro/api/v2')
window._base_url = 'http://ja-hm.omniview.pro/api/v2'
import { components, eventBus } from './component-lib.esm' // 未正式上生产暂时先如此代替 import { components, eventBus } from './component-lib.esm' // 未正式上生产暂时先如此代替
export default components export default components
......
This diff is collapsed.
<template> <template>
<div class="map-btns"> <div class="map-btns" :class="{ isFull: fullScreen }">
<img <img
v-for="btn in btns" v-for="btn in btns"
v-show="!btn.hidden" v-show="!btn.hidden"
...@@ -25,15 +25,19 @@ const props = defineProps({ ...@@ -25,15 +25,19 @@ const props = defineProps({
type: Boolean as PropType<boolean>, type: Boolean as PropType<boolean>,
default: true, default: true,
}, },
fullScreen: {
type: Boolean as PropType<boolean>,
default: false,
},
}) })
const emit = defineEmits(['touch']) const emit = defineEmits(['touch'])
const btns = computed(() => [ const btns = computed(() => [
{ key: 'home', icon: btn7, hidden: props.isDefaultScreen }, { key: 'home', icon: btn7, hidden: props.isDefaultScreen },
{ key: 'btn1', icon: btn1 }, { key: 'btn1', icon: btn1 },
{ key: 'btn2', icon: btn2 }, { key: 'full', icon: btn2 },
{ key: 'btn3', icon: btn3 }, { key: 'in', icon: btn3 },
{ key: 'btn4', icon: btn4 }, { key: 'out', icon: btn4 },
{ key: 'list', icon: btn5 }, { key: 'list', icon: btn5 },
{ key: 'btn6', icon: btn6 }, { key: 'btn6', icon: btn6 },
]) ])
...@@ -48,6 +52,9 @@ const onClick = (key: string) => { ...@@ -48,6 +52,9 @@ const onClick = (key: string) => {
z-index 9999 z-index 9999
right 29% right 29%
bottom .05rem bottom .05rem
transition right .25s ease-in-out
&.isFull
right .05rem
>img >img
width .2rem width .2rem
height @width height @width
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import icon1 from '@/assets/images/search.png' import icon1 from '@/assets/images/search.png'
import { MyMap } from '@/components/my-map' import { MyMap } from '@/components/my-map'
import { nextTick, onMounted } from 'vue' import { nextTick, onMounted } from 'vue'
import jinganPath from '@/utils/jingan-path.js'
let map: MyMap let map: MyMap
let pointsLayer: any let pointsLayer: any
...@@ -13,31 +14,42 @@ let linesLayer: any ...@@ -13,31 +14,42 @@ let linesLayer: any
let polygonLayer: any let polygonLayer: any
let boundary: any let boundary: any
defineExpose({ zoomIn, zoomOut })
onMounted(async () => { onMounted(async () => {
await nextTick() await nextTick()
map = MyMap.useMap('SMap').with({ map = MyMap.useMap('SMap').with({
el: 'container', el: 'container',
center: [0, 0], center: [-1931.2637583608503, 4334.0159596985895],
zoom: 5, zoom: 4,
style: 'smap://styles/dark', style: 'smap://styles/dark',
appKey: 'DTZ49ACE32PBN73GXPF085', appKey: 'DTZ49ACE32PBN73GXPF085',
netType: 'internet', netType: 'internet',
}) })
map map.on('load', onComplete).on('click', (a, b) => console.log(a, b))
.on('load', () => console.log('load')) // .on('zoom', (e) => console.log('zoom: ', e))
.on('click', (a, b) => console.log(a, b)) // .on('move', (e) => console.log('move: ', e))
.on('zoom', (e) => console.log('zoom: ', e)) // .on('blur', (e) => console.log('blur: ', e))
.on('move', (e) => console.log('move: ', e)) // .on('focus', (e) => console.log('focus: ', e))
.on('blur', (e) => console.log('blur: ', e)) // .on('drag', (e) => console.log('drag: ', e))
.on('focus', (e) => console.log('focus: ', e)) // .on('resize', (e) => console.log('resize: ', e))
.on('drag', (e) => console.log('drag: ', e)) // .on('dblclick', (e) => console.log('dblclick: ', e))
.on('resize', (e) => console.log('resize: ', e)) // .on('mousewheel', (e) => console.log('mousewheel: ', e))
.on('dblclick', (e) => console.log('dblclick: ', e))
.on('mousewheel', (e) => console.log('mousewheel: ', e))
}) })
function onComplete() {
polygonLayer = map.add('polygon', {
data: {
path: jinganPath as [number, number][],
},
fillColor: 'transparent',
color: '#ED6F30',
lineWidth: 2,
})
}
function zoomIn() { function zoomIn() {
map.zoomIn() map.zoomIn()
} }
......
...@@ -265,6 +265,8 @@ function saveConfig() { ...@@ -265,6 +265,8 @@ function saveConfig() {
color $blue color $blue
&:hover &:hover
opacity 1 opacity 1
.main
background url('/src/assets/images/map.png') center/100% 100% no-repeat
</style> </style>
<style lang="stylus"> <style lang="stylus">
@import '../components/MyComponent/main.styl' @import '../components/MyComponent/main.styl'
......
...@@ -7,17 +7,30 @@ ...@@ -7,17 +7,30 @@
columns="1fr 1.5fr 1fr" columns="1fr 1.5fr 1fr"
:rows="`${layout.rows}`" :rows="`${layout.rows}`"
> >
<Map /> <Map ref="mapRef" />
<div <div
v-for="(_, index) in new Array(layout.boxNum)" v-for="(_, index) in new Array(layout.boxNum)"
:key="index" :key="index"
class="box" class="box"
:area="`box${index + 1}`" :area="`box${index + 1}`"
>
<m-animate
:enter="
layout.template.some((item) => item.startsWith(`box${index + 1}`))
? 'fadeInLeft'
: 'fadeInRight'
"
:leave="
layout.template.some((item) => item.startsWith(`box${index + 1}`))
? 'fadeOutLeft'
: 'fadeOutRight'
"
> >
<component <component
:is="componentList[components[index]]" :is="componentList[components[index]]"
v-if="!!components[index]" v-if="!!components[index] && !fullScreen"
/> />
</m-animate>
</div> </div>
</m-grid> </m-grid>
<m-modal v-model="showModal" title="选择展示屏"> <m-modal v-model="showModal" title="选择展示屏">
...@@ -32,18 +45,23 @@ ...@@ -32,18 +45,23 @@
</div> </div>
</m-modal> </m-modal>
</div> </div>
<MapBtns :is-default-screen="isDefaultScreen" @touch="handleMapBtnsEvents" /> <MapBtns
:full-screen="fullScreen"
:is-default-screen="isDefaultScreen"
@touch="handleMapBtnsEvents"
/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import useLayout from '@/hooks/useLayout' import useLayout from '@/hooks/useLayout'
import useComponent from '@/hooks/useComponent' import useComponent from '@/hooks/useComponent'
import { onMounted, ref } from 'vue' import { onMounted, ref, shallowRef } from 'vue'
import { ajax, api } from '@/ajax' import { ajax, api } from '@/ajax'
import { NSpace, NButton } from 'naive-ui' import { NSpace, NButton } from 'naive-ui'
import MapBtns from './components/map-btns.vue' import MapBtns from './components/map-btns.vue'
import Map from './components/map.vue' import Map from './components/map.vue'
const mapRef = shallowRef<any>(null)
const { layout } = useLayout() const { layout } = useLayout()
const { components, componentList } = useComponent() const { components, componentList } = useComponent()
const list = ref<any[]>([]) const list = ref<any[]>([])
...@@ -53,7 +71,6 @@ ajax ...@@ -53,7 +71,6 @@ ajax
list.value = res?.data?.content || [] list.value = res?.data?.content || []
}) })
const showModal = ref(false) const showModal = ref(false)
const defaultConfig = { const defaultConfig = {
layout: { layout: {
template: ['box1 . box3', 'box2 . box4', 'box2 . box5'], template: ['box1 . box3', 'box2 . box4', 'box2 . box5'],
...@@ -84,6 +101,7 @@ function check({ configJson }) { ...@@ -84,6 +101,7 @@ function check({ configJson }) {
isDefaultScreen.value = false isDefaultScreen.value = false
} }
const fullScreen = ref(false)
function handleMapBtnsEvents(key: string) { function handleMapBtnsEvents(key: string) {
switch (key) { switch (key) {
case 'list': case 'list':
...@@ -92,6 +110,15 @@ function handleMapBtnsEvents(key: string) { ...@@ -92,6 +110,15 @@ function handleMapBtnsEvents(key: string) {
case 'home': case 'home':
initConfig() initConfig()
break break
case 'full':
fullScreen.value = !fullScreen.value
break
case 'in':
mapRef.value?.zoomIn()
break
case 'out':
mapRef.value?.zoomOut()
break
default: default:
break break
} }
......
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