From 6f73119ee091ac93600e0f4df70b3526d343bbde Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Fri, 20 May 2022 14:53:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=88=20=E7=BC=96=E5=86=99=E9=AB=98?= =?UTF-8?q?=E5=BE=B7=E5=9C=B0=E5=9B=BE=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kicc-ui/src/assets/images/hospital.svg | 2 ++ kicc-ui/src/components/AMap/src/Amap.vue | 20 +++++++++------- kicc-ui/src/components/AMap/src/data.ts | 30 +++++++++++------------- kicc-ui/src/router/constant.ts | 2 +- 4 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 kicc-ui/src/assets/images/hospital.svg diff --git a/kicc-ui/src/assets/images/hospital.svg b/kicc-ui/src/assets/images/hospital.svg new file mode 100644 index 00000000..2d97b41a --- /dev/null +++ b/kicc-ui/src/assets/images/hospital.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/kicc-ui/src/components/AMap/src/Amap.vue b/kicc-ui/src/components/AMap/src/Amap.vue index d7cd205e..275d1190 100644 --- a/kicc-ui/src/components/AMap/src/Amap.vue +++ b/kicc-ui/src/components/AMap/src/Amap.vue @@ -5,7 +5,7 @@ import AMapLoader from '@amap/amap-jsapi-loader'; import { reactive, getCurrentInstance, onBeforeMount, onUnmounted } from 'vue'; import { mapList } from './data'; -import car from '/@/assets/car.png'; +import hospital from '/@/assets/images/hospital.svg'; export interface MapConfigureInter { on: Fn; @@ -41,7 +41,14 @@ const complete = (): void => { onBeforeMount(() => { if (!instance) return; - let { MapConfigure } = instance.appContext.config.globalProperties.$config; + const MapConfigure = { + amapKey: '97b3248d1553172e81f168cf94ea667e', + options: { + resizeEnable: true, + center: [113.6401, 34.72468], + zoom: 12 + } + }; let { options } = MapConfigure; AMapLoader.load({ @@ -70,10 +77,8 @@ onBeforeMount(() => { renderMarker(ctx) { let { marker, data } = ctx; if (Array.isArray(data) && data[0]) { - var { driver, plateNumber, orientation } = data[0]; - var content = ``; + const { driver, plateNumber, orientation } = data[0]; + const content = ``; marker.setContent(content); marker.setLabel({ direction: 'bottom', @@ -90,9 +95,8 @@ onBeforeMount(() => { } } }); - // 获取模拟车辆信息 - const points = mapList().map((v: any) => ({ + const points = mapList.map((v: any) => ({ lnglat: [v.lng, v.lat], ...v })); diff --git a/kicc-ui/src/components/AMap/src/data.ts b/kicc-ui/src/components/AMap/src/data.ts index 281518cf..589c3d0f 100644 --- a/kicc-ui/src/components/AMap/src/data.ts +++ b/kicc-ui/src/components/AMap/src/data.ts @@ -2,21 +2,19 @@ type mapType = { plateNumber: string; driver: string; - 'orientation|1-360': number; - 'lng|113-114.1-10': number; - 'lat|34-35.1-10': number; + orientation: number; + lng: number; + lat: number; + 'orientation|1-360'?: number; + 'lng|113-114.1-10'?: number; + 'lat|34-35.1-10'?: number; }; -export const mapList = (): mapType[] => { - const result: mapType[] = []; - for (let index = 0; index < 200; index++) { - result.push({ - plateNumber: '豫A@natural(11111, 99999)@character(\'upper\')', - driver: '@cname()', - 'orientation|1-360': 100, - 'lng|113-114.1-10': 1, - 'lat|34-35.1-10': 1 - }); - } - return result; -}; +export const mapList: mapType[] = [ + {plateNumber: '豫A36523R', driver: '郑霞', orientation: 0, lng: 114.893657, lat: 35.289}, + {plateNumber: '豫A76788W', driver: '苏娜', orientation: 0, lng: 114.71, lat: 34.5394614}, + {plateNumber: '豫A90026H', driver: '马洋', orientation: 0, lng: 114.72888, lat: 35.4585}, + {plateNumber: '豫A20644R', driver: '孙洋', orientation: 0, lng: 114.1722778, lat: 35.340310104}, + {plateNumber: '豫A97973Y', driver: '朱丽', orientation: 0, lng: 113.72223, lat: 35.68455}, + {plateNumber: '豫A76379B', driver: '蒋强', orientation: 0, lng: 114.379, lat: 34.36825} +]; diff --git a/kicc-ui/src/router/constant.ts b/kicc-ui/src/router/constant.ts index 379b6dda..d0e9d71b 100644 --- a/kicc-ui/src/router/constant.ts +++ b/kicc-ui/src/router/constant.ts @@ -16,5 +16,5 @@ export const EXCEPTION_COMPONENT = () => import('../views/core/exception/Excepti /** 默认布局 */ export const LAYOUT = () => import('/@/layouts/default/index.vue'); -/** 定义一个空组件什么都没有只有一个组件名称充当父布局,不让没有组件的时候报找不到组件的错误 */ +/** 多级菜单父布局定义,定义一个空组件什么都没有只有一个组件名称充当父布局,不让没有组件的时候报找不到组件的错误 */ export const getParentLayout = (_name?: string) => () => new Promise((resolve) => resolve({ name: PARENT_LAYOUT_NAME }));