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 @@
<link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>静安智慧房管</title>
<script type="module" crossorigin src="./assets/index.b725d4a1.js"></script>
<link rel="modulepreload" href="./assets/vendor.f402338c.js">
<script type="module" crossorigin src="./assets/index.c26d6571.js"></script>
<link rel="modulepreload" href="./assets/vendor.8dcd84ff.js">
<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>
<body>
<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>
......
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 @@
<div class="my-progress">
<div v-if="msg" class="msg">
<p v-if="msg.name">{{ msg.name }}</p>
<p v-if="msg.value" :style="{ color: msg.color }">
<MonitorCount v-if="typeof msg.value === 'number'" :value="msg.value" />
<p v-if="msg.value || msg.value === 0" :style="{ color: msg.color }">
<MonitorCount
v-if="typeof msg.value === 'number'"
:value="msg.value"
:decimal="msg.decimal || 0"
/>
<span v-else>{{ msg.value }}</span>
<span v-if="msg.unit">{{ msg.unit }}</span>
</p>
......@@ -24,6 +28,7 @@ export interface ProgressProps {
value?: number
unit?: string
color?: string
decimal?: number
}
export default defineComponent({
name: 'MyProgress',
......
This diff is collapsed.
// import * as vue from 'vue'
// import fetchComponents from 'http://127.0.0.1:8082/component-lib.min.js'
// const { components, eventBus } = fetchComponents(vue)('http://127.0.0.1:8082')
// import axios from 'axios'
// 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' // 未正式上生产暂时先如此代替
export default components
......
This diff is collapsed.
<template>
<div class="map-btns">
<div class="map-btns" :class="{ isFull: fullScreen }">
<img
v-for="btn in btns"
v-show="!btn.hidden"
......@@ -25,15 +25,19 @@ const props = defineProps({
type: Boolean as PropType<boolean>,
default: true,
},
fullScreen: {
type: Boolean as PropType<boolean>,
default: false,
},
})
const emit = defineEmits(['touch'])
const btns = computed(() => [
{ key: 'home', icon: btn7, hidden: props.isDefaultScreen },
{ key: 'btn1', icon: btn1 },
{ key: 'btn2', icon: btn2 },
{ key: 'btn3', icon: btn3 },
{ key: 'btn4', icon: btn4 },
{ key: 'full', icon: btn2 },
{ key: 'in', icon: btn3 },
{ key: 'out', icon: btn4 },
{ key: 'list', icon: btn5 },
{ key: 'btn6', icon: btn6 },
])
......@@ -48,6 +52,9 @@ const onClick = (key: string) => {
z-index 9999
right 29%
bottom .05rem
transition right .25s ease-in-out
&.isFull
right .05rem
>img
width .2rem
height @width
......
......@@ -6,6 +6,7 @@
import icon1 from '@/assets/images/search.png'
import { MyMap } from '@/components/my-map'
import { nextTick, onMounted } from 'vue'
import jinganPath from '@/utils/jingan-path.js'
let map: MyMap
let pointsLayer: any
......@@ -13,31 +14,42 @@ let linesLayer: any
let polygonLayer: any
let boundary: any
defineExpose({ zoomIn, zoomOut })
onMounted(async () => {
await nextTick()
map = MyMap.useMap('SMap').with({
el: 'container',
center: [0, 0],
zoom: 5,
center: [-1931.2637583608503, 4334.0159596985895],
zoom: 4,
style: 'smap://styles/dark',
appKey: 'DTZ49ACE32PBN73GXPF085',
netType: 'internet',
})
map
.on('load', () => console.log('load'))
.on('click', (a, b) => console.log(a, b))
.on('zoom', (e) => console.log('zoom: ', e))
.on('move', (e) => console.log('move: ', e))
.on('blur', (e) => console.log('blur: ', e))
.on('focus', (e) => console.log('focus: ', e))
.on('drag', (e) => console.log('drag: ', e))
.on('resize', (e) => console.log('resize: ', e))
.on('dblclick', (e) => console.log('dblclick: ', e))
.on('mousewheel', (e) => console.log('mousewheel: ', e))
map.on('load', onComplete).on('click', (a, b) => console.log(a, b))
// .on('zoom', (e) => console.log('zoom: ', e))
// .on('move', (e) => console.log('move: ', e))
// .on('blur', (e) => console.log('blur: ', e))
// .on('focus', (e) => console.log('focus: ', e))
// .on('drag', (e) => console.log('drag: ', e))
// .on('resize', (e) => console.log('resize: ', 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() {
map.zoomIn()
}
......
......@@ -265,6 +265,8 @@ function saveConfig() {
color $blue
&:hover
opacity 1
.main
background url('/src/assets/images/map.png') center/100% 100% no-repeat
</style>
<style lang="stylus">
@import '../components/MyComponent/main.styl'
......
......@@ -7,17 +7,30 @@
columns="1fr 1.5fr 1fr"
:rows="`${layout.rows}`"
>
<Map />
<Map ref="mapRef" />
<div
v-for="(_, index) in new Array(layout.boxNum)"
:key="index"
class="box"
: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
:is="componentList[components[index]]"
v-if="!!components[index]"
v-if="!!components[index] && !fullScreen"
/>
</m-animate>
</div>
</m-grid>
<m-modal v-model="showModal" title="选择展示屏">
......@@ -32,18 +45,23 @@
</div>
</m-modal>
</div>
<MapBtns :is-default-screen="isDefaultScreen" @touch="handleMapBtnsEvents" />
<MapBtns
:full-screen="fullScreen"
:is-default-screen="isDefaultScreen"
@touch="handleMapBtnsEvents"
/>
</template>
<script lang="ts" setup>
import useLayout from '@/hooks/useLayout'
import useComponent from '@/hooks/useComponent'
import { onMounted, ref } from 'vue'
import { onMounted, ref, shallowRef } from 'vue'
import { ajax, api } from '@/ajax'
import { NSpace, NButton } from 'naive-ui'
import MapBtns from './components/map-btns.vue'
import Map from './components/map.vue'
const mapRef = shallowRef<any>(null)
const { layout } = useLayout()
const { components, componentList } = useComponent()
const list = ref<any[]>([])
......@@ -53,7 +71,6 @@ ajax
list.value = res?.data?.content || []
})
const showModal = ref(false)
const defaultConfig = {
layout: {
template: ['box1 . box3', 'box2 . box4', 'box2 . box5'],
......@@ -84,6 +101,7 @@ function check({ configJson }) {
isDefaultScreen.value = false
}
const fullScreen = ref(false)
function handleMapBtnsEvents(key: string) {
switch (key) {
case 'list':
......@@ -92,6 +110,15 @@ function handleMapBtnsEvents(key: string) {
case 'home':
initConfig()
break
case 'full':
fullScreen.value = !fullScreen.value
break
case 'in':
mapRef.value?.zoomIn()
break
case 'out':
mapRef.value?.zoomOut()
break
default:
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