hookehuyr

✨ feat(地图主体部分): 修改地图密钥引入方式

<!--
* @Date: 2023-05-31 16:10:33
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-07-27 11:08:28
* @LastEditTime: 2025-03-06 10:16:37
* @FilePath: /map-demo/index.html
* @Description: 文件描述
-->
......@@ -26,6 +26,6 @@
// serviceHost: 'https://oa-dev.onwall.cn/_AMapService',
// }
</script>
<script src="https://webapi.amap.com/maps?v=2.0&key=381c6763e1fefd810fbab697f470149c&plugin=AMap.ElasticMarker,AMap.ImageLayer,AMap.ToolBar,AMap.IndoorMap"></script>
<!-- <script src="https://webapi.amap.com/maps?v=2.0&key=381c6763e1fefd810fbab697f470149c&plugin=AMap.ElasticMarker,AMap.ImageLayer,AMap.ToolBar,AMap.IndoorMap,AMap.Walking,AMap.Geolocation,AMap.ToolBar"></script> -->
</body>
</html>
......
......@@ -176,6 +176,7 @@ import Floor from '@/components/Floor'
import { useRect } from '@vant/use';
import { mapAPI } from '@/api/map.js'
import wx from 'weixin-js-sdk'
import AMapLoader from '@amap/amap-jsapi-loader'
const GPS = {
PI: 3.14159265358979324,
......@@ -232,7 +233,10 @@ const GPS = {
return ret;
}
};
// 关键安全配置
window._AMapSecurityConfig = {
securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥
}
export default {
components: { InfoWindow, InfoWindowLite, InfoWindowWarn, InfoWindowYard, Floor },
data() {
......@@ -324,6 +328,11 @@ export default {
}
},
async mounted() {
const AMap = await AMapLoader.load({
key: '381c6763e1fefd810fbab697f470149c', // 控制台获取
version: '2.0', // 指定API版本
plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
})
const code = this.$route.query.id;
const { data } = await mapAPI({i: code});
// data.list = data.list.concat(map_yard);
......
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-02-10 17:45:25
* @LastEditTime: 2025-03-06 10:28:52
* @FilePath: /map-demo/src/views/bieyuan/map.vue
* @Description: 公众地图主体页面
-->
......@@ -96,6 +96,7 @@ import audioBackground1 from '@/components/audioBackground1.vue'
import { mapState, mapActions } from 'pinia'
import { mainStore } from '@/store'
import { parseQueryString } from '@/utils/tools'
import AMapLoader from '@amap/amap-jsapi-loader'
const GPS = {
PI: 3.14159265358979324,
......@@ -152,7 +153,10 @@ const GPS = {
return ret;
}
};
// 关键安全配置
window._AMapSecurityConfig = {
securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥
}
export default {
components: { pageInfo, audioBackground1 },
data() {
......@@ -268,6 +272,11 @@ export default {
}
},
async mounted() {
const AMap = await AMapLoader.load({
key: '381c6763e1fefd810fbab697f470149c', // 控制台获取
version: '2.0', // 指定API版本
plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
})
const code = this.$route.query.id;
const { data } = await mapAPI({ i: code });
this.navBarList = data.list; // 底部导航条
......
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-02-25 16:51:14
* @LastEditTime: 2025-03-06 10:29:04
* @FilePath: /map-demo/src/views/index.vue
* @Description: 公众地图主体页面
-->
......@@ -124,6 +124,7 @@ import wx from 'weixin-js-sdk'
import InfoPopup from '@/components/InfoPopup'
import InfoPopupLite from '@/components/InfoPopupLite'
import InfoPopupWarn from '@/components/InfoPopupWarn'
import AMapLoader from '@amap/amap-jsapi-loader'
const GPS = {
PI: 3.14159265358979324,
......@@ -180,7 +181,10 @@ const GPS = {
return ret;
}
};
// 关键安全配置
window._AMapSecurityConfig = {
securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥
}
export default {
components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground, InfoPopup, InfoPopupLite, InfoPopupWarn },
data() {
......@@ -264,6 +268,11 @@ export default {
}
},
async mounted() {
const AMap = await AMapLoader.load({
key: '381c6763e1fefd810fbab697f470149c', // 控制台获取
version: '2.0', // 指定API版本
plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
})
const code = this.$route.query.id;
const { data } = await mapAPI({ i: code });
// TAG:预警显示
......
......@@ -143,6 +143,7 @@ import Floor from '@/components/Floor'
import { useRect } from '@vant/use';
import { mapAPI } from '@/api/map.js'
import wx from 'weixin-js-sdk'
import AMapLoader from '@amap/amap-jsapi-loader'
const GPS = {
PI: 3.14159265358979324,
......@@ -199,7 +200,10 @@ const GPS = {
return ret;
}
};
// 关键安全配置
window._AMapSecurityConfig = {
securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥
}
export default {
components: { InfoWindow, InfoWindowLite, InfoWindowWarn, InfoWindowYard, Floor },
data() {
......@@ -281,6 +285,11 @@ export default {
}
},
async mounted() {
const AMap = await AMapLoader.load({
key: '381c6763e1fefd810fbab697f470149c', // 控制台获取
version: '2.0', // 指定API版本
plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
})
const code = this.$route.query.id;
const { data } = await mapAPI({i: code});
data.list = data.list.concat(map_yard);
......
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-02-27 09:32:49
* @LastEditTime: 2025-03-06 10:29:14
* @FilePath: /map-demo/src/views/tools.vue
* @Description: 公众地图主体页面
-->
......@@ -126,6 +126,7 @@ import { useRect } from '@vant/use';
import { mapAPI } from '@/api/map.js'
import wx from 'weixin-js-sdk'
import { showToast } from 'vant';
import AMapLoader from '@amap/amap-jsapi-loader'
const GPS = {
PI: 3.14159265358979324,
......@@ -182,7 +183,10 @@ const GPS = {
return ret;
}
};
// 关键安全配置
window._AMapSecurityConfig = {
securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥
}
export default {
components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground },
data() {
......@@ -265,6 +269,11 @@ export default {
}
},
async mounted() {
const AMap = await AMapLoader.load({
key: '381c6763e1fefd810fbab697f470149c', // 控制台获取
version: '2.0', // 指定API版本
plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
})
const code = this.$route.query.id;
const { data } = await mapAPI({ i: code });
data.list = data.list.concat(map_alert);
......
......@@ -124,6 +124,7 @@ import wx from 'weixin-js-sdk'
import InfoPopup from '@/components/InfoPopup'
import InfoPopupLite from '@/components/InfoPopupLite'
import InfoPopupWarn from '@/components/InfoPopupWarn'
import AMapLoader from '@amap/amap-jsapi-loader'
const GPS = {
PI: 3.14159265358979324,
......@@ -180,7 +181,10 @@ const GPS = {
return ret;
}
};
// 关键安全配置
window._AMapSecurityConfig = {
securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥
}
export default {
components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground, InfoPopup, InfoPopupLite, InfoPopupWarn },
data() {
......@@ -265,6 +269,11 @@ export default {
}
},
async mounted() {
const AMap = await AMapLoader.load({
key: '381c6763e1fefd810fbab697f470149c', // 控制台获取
version: '2.0', // 指定API版本
plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
})
const code = this.$route.query.id;
const { data } = await mapAPI({ i: code });
// TAG:预警显示
......