This commit is contained in:
zk
2023-12-19 12:41:15 +08:00
parent 9b5be1af25
commit 5342774ca5
9 changed files with 50 additions and 39 deletions
+3 -13
View File
@@ -1,18 +1,8 @@
#后台地址
#VITE_GLOB_API_URL=https://api.cqygjk.com
VITE_GLOB_API_URL=https://api.cqygjk.com
#应急求助-websocket
#VITE_GLOB_API_YIN_JI=wss://api.cqygjk.com/health-watch/websocket/watchMonitor
VITE_GLOB_API_YIN_JI=wss://api.cqygjk.com/health-watch/websocket/watchMonitor
#健康监测工具报警-websocket
#VITE_GLOB_API_JIAN_CE=wss://api.cqygjk.com/health-emergency/websocket/emergency
VITE_GLOB_API_JIAN_CE=wss://api.cqygjk.com/health-emergency/websocket/emergency
# 王昊地址
#VITE_GLOB_API_URL=http://192.168.1.3
#开发环境
VITE_GLOB_API_URL=http://cqyt.dev.yg.dt.io
#应急求助-websocket
VITE_GLOB_API_YIN_JI=ws://cqyt.dev.yg.dt.io/health-watch/websocket/watchMonitor
#健康监测工具报警-websocket
VITE_GLOB_API_JIAN_CE=ws://cqyt.dev.yg.dt.io/health-emergency/websocket/emergency
-1
View File
@@ -14,7 +14,6 @@
</script>
<!-- <script type="text/javascript"-->
<!-- src="https://webapi.amap.com/maps?v=2.0&key=4bbcb216b889f2d612cbed05ae6979c8&plugin=AMap.Driving,AMap.ToolBar,AMap.Driving,AMap.GeoJSON,AMap.MarkerCluster"></script>-->
<script type="module" src="./public/amap.js"></script>
</head>
<style>
html, body, #app {
+1
View File
@@ -46,6 +46,7 @@
"less": "^4.2.0",
"typescript": "^5.0.2",
"vite": "^4.4.5",
"vite-plugin-resolve-externals": "^0.2.2",
"vue-tsc": "^1.8.5"
}
}
+23 -12
View File
@@ -1,3 +1,4 @@
import AMapLoader from '@amap/amap-jsapi-loader';
import china from '/@/assets/lngLat/china.ts';
import chinaInner from '/@/assets/lngLat/chinaInner.ts';
import { createCircle, createIcon, typeToIcon } from '/@/assets/mapUtils/commonFun.ts';
@@ -11,6 +12,7 @@ export const defaultOption = {
mapStyle: 'darkblue', //地图样式
};
export const mapPlugin = ['AMap.ToolBar', 'AMap.Driving', 'AMap.GeoJSON', 'AMap.MarkerCluster', 'AMap.PlaceSearch'];
let AMap = null;
export const Map = {
map: null,
overlayGroup: null, // 地图中marker
@@ -25,18 +27,27 @@ export const Map = {
* @param option 地图配置
*/
initMap({ el, option }: InitMap) {
const { zoom, center, mapStyle } = { ...defaultOption, ...option };
//基本地图加载
this.map = new AMap.Map(el, {
resizeEnable: true,
center: center,
zoom: zoom,
mapStyle: 'amap://styles/' + mapStyle,
});
// 异步同时加载多个插件
new AMap.plugin(mapPlugin, () => {
this.drawInnerLine();
this.drawOutLine();
AMapLoader.load({
key: '4bbcb216b889f2d612cbed05ae6979c8', // 申请好的Web端开发者Key,首次调用 load 时必填
// version: '1.4.15', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: mapPlugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等
}).then((res) => {
AMap = res;
const { zoom, center, mapStyle } = { ...defaultOption, ...option };
//基本地图加载
this.map = new AMap.Map(el, {
resizeEnable: true,
center: center,
zoom: zoom,
mapStyle: 'amap://styles/darkblue',
version: '2.0',
});
// 异步同时加载多个插件
new AMap.plugin(mapPlugin, () => {
this.drawInnerLine();
this.drawOutLine();
});
});
} /**
* @desc 中国外层边界线
@@ -61,7 +61,6 @@
const watchDialogRef = ref();
function openWatchList(item) {
console.log('item', item);
if (item.key == 'allotDeviceNum') {
watchDialogRef.value.openModal(item.extData?.deptId);
}
@@ -110,13 +109,13 @@
const { detailLeft, detailRight, setDetail } = useAlarmDetail();
onMounted(() => {
init();
//点击预警定位
$bus.on(earlyWarning, (params) => {
setDetail(params);
drawMarker(params);
setIsShowAlarm(true);
});
// init();
// //点击预警定位
// $bus.on(earlyWarning, (params) => {
// setDetail(params);
// drawMarker(params);
// setIsShowAlarm(true);
// });
});
/**
+2 -3
View File
@@ -1,4 +1,4 @@
import {createApp} from 'vue';
import { createApp } from 'vue';
import App from './App.vue';
import './assets/less/index.less';
import router from './router';
@@ -6,8 +6,7 @@ import router from './router';
import('ant-design-vue/dist/antd.less');
import registerGlobComp from './assets/ts/antd.ts';
import directiveMethods from './assets/ts/directive';
import {setupStore} from './store/index.ts';
import { setupStore } from './store/index.ts';
const app = createApp(App);
// 注册自定义事件
+3
View File
@@ -8,6 +8,9 @@
"DOM",
"DOM.Iterable"
],
"types": [
"vite/client"
],
"skipLibCheck": true,
"baseUrl": ".",
/* */
+4
View File
@@ -0,0 +1,4 @@
declare interface Window {
AMap: any;
initAMap: any;
}
+7 -2
View File
@@ -1,6 +1,8 @@
import {defineConfig} from 'vite';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import {resolve} from 'path';
import { resolve } from 'path';
import resolveExternalsPlugin from 'vite-plugin-resolve-externals';
function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir);
@@ -10,6 +12,9 @@ function pathResolve(dir: string) {
export default defineConfig({
plugins: [
vue(),
resolveExternalsPlugin({
AMap: 'AMap',
}),
],
css: {
preprocessorOptions: {