hookehuyr

api联调

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 VITE_PORT = 8006 2 VITE_PORT = 8006
3 3
4 # 反向代理服务器地址 4 # 反向代理服务器地址
5 -VITE_PROXY_TARGET = http://voice.onwall.cn 5 +VITE_PROXY_TARGET = https://oa-dev.onwall.cn
6 6
7 # API请求前缀 7 # API请求前缀
8 VITE_PROXY_PREFIX = /srv/ 8 VITE_PROXY_PREFIX = /srv/
......
1 /* 1 /*
2 + * @Date: 2023-05-29 11:10:19
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2023-07-07 10:51:28
5 + * @FilePath: /map-demo/src/api/common.js
6 + * @Description: 文件描述
7 + */
8 +/*
2 * @Date: 2022-06-17 14:54:29 9 * @Date: 2022-06-17 14:54:29
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 10 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 * @LastEditTime: 2022-06-18 22:18:46 11 * @LastEditTime: 2022-06-18 22:18:46
......
1 +import { fn, fetch } from '@/api/fn';
2 +
3 +const Api = {
4 + MAP: '/srv/?a=map',
5 +};
6 +
7 +export const mapAPI = (params) => fn(fetch.get(Api.MAP, params));
1 /* 1 /*
2 * @Date: 2023-06-30 16:48:58 2 * @Date: 2023-06-30 16:48:58
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-07-05 10:52:36 4 + * @LastEditTime: 2023-07-07 07:50:10
5 * @FilePath: /map-demo/src/common/max.js 5 * @FilePath: /map-demo/src/common/max.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-28 10:17:40 3 * @Date: 2022-05-28 10:17:40
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-30 01:30:26 5 + * @LastEditTime: 2023-07-07 11:09:02
6 - * @FilePath: /tswj/src/utils/axios.js 6 + * @FilePath: /map-demo/src/utils/axios.js
7 * @Description: 7 * @Description:
8 */ 8 */
9 import axios from 'axios'; 9 import axios from 'axios';
...@@ -13,7 +13,7 @@ import { strExist } from '@/utils/tools' ...@@ -13,7 +13,7 @@ import { strExist } from '@/utils/tools'
13 // import { parseQueryString } from '@/utils/tools' 13 // import { parseQueryString } from '@/utils/tools'
14 14
15 axios.defaults.params = { 15 axios.defaults.params = {
16 - f: 'voice', 16 + f: 'tools',
17 }; 17 };
18 18
19 /** 19 /**
......
1 +<!--
2 + * @Date: 2023-05-29 11:10:19
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2023-07-07 11:05:35
5 + * @FilePath: /map-demo/src/views/auth.vue
6 + * @Description: 文件描述
7 +-->
1 <template> 8 <template>
2 <div /> 9 <div />
3 </template> 10 </template>
...@@ -17,7 +24,7 @@ onMounted(() => { ...@@ -17,7 +24,7 @@ onMounted(() => {
17 */ 24 */
18 let raw_url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址 25 let raw_url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址
19 // TAG: 开发环境测试数据 26 // TAG: 开发环境测试数据
20 - const short_url = `/srv/?f=voice&a=openid_${$route.query.prefixAPI}&res=${raw_url}`; 27 + const short_url = `/srv/?f=tools&a=openid_${$route.query.prefixAPI}&res=${raw_url}`;
21 location.href = import.meta.env.DEV 28 location.href = import.meta.env.DEV
22 ? `${short_url}&input_openid=${import.meta.env.VITE_OPENID}` 29 ? `${short_url}&input_openid=${import.meta.env.VITE_OPENID}`
23 : `${short_url}`; 30 : `${short_url}`;
......
1 <!-- 1 <!--
2 * @Date: 2023-05-19 14:54:27 2 * @Date: 2023-05-19 14:54:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-07-05 17:05:08 4 + * @LastEditTime: 2023-07-07 13:25:46
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 地图主体页面 6 * @Description: 地图主体页面
7 --> 7 -->
...@@ -101,6 +101,8 @@ import InfoWindowWarn from '@/components/InfoWindowWarn' ...@@ -101,6 +101,8 @@ import InfoWindowWarn from '@/components/InfoWindowWarn'
101 import audioBackground from '@/components/audioBackground' 101 import audioBackground from '@/components/audioBackground'
102 import { useRect } from '@vant/use'; 102 import { useRect } from '@vant/use';
103 103
104 +import { mapAPI } from '@/api/map.js'
105 +
104 const GPS = { 106 const GPS = {
105 PI: 3.14159265358979324, 107 PI: 3.14159265358979324,
106 x_pi: 3.14159265358979324 * 3000.0 / 180.0, 108 x_pi: 3.14159265358979324 * 3000.0 / 180.0,
...@@ -222,14 +224,67 @@ export default { ...@@ -222,14 +224,67 @@ export default {
222 } 224 }
223 }, 225 },
224 defaultZoom: 18, 226 defaultZoom: 18,
225 - defaultCenter: [120.587382, 31.313900] 227 + defaultCenter: [120.587382, 31.313900],
228 + mapTiles: []
226 } 229 }
227 }, 230 },
228 - mounted() { 231 + async mounted() {
229 - // console.log(this.$route.query); 232 + const code = this.$route.query.id;
230 - this.navBarList = map_max; // 底部导航条 233 + // const code = '362800';
231 - this.navKey = map_max[0]['key']; // 默认选中 第一个 key 234 + const { data } = await mapAPI({i: code});
232 - this.navList = map_max.filter(item => item.key === this.navKey)[0]['entity_info']; // 返回默认选中项的实体信息 235 + const temp = {
236 + id: 'warn',
237 + name: '预警',
238 + icon: [
239 + 'https://cdn.ipadbiz.cn/xys/map/%E7%BA%BF%E8%B7%AF@2x.png',
240 + 'https://cdn.ipadbiz.cn/xys/map/%E7%BA%BF%E8%B7%AF@2x.png',
241 + ],
242 + list: [
243 + {
244 + name: '预警演示1',
245 + position: [120.58704, 31.313773],
246 + icon: 'https://cdn.ipadbiz.cn/xys/map/%E5%BC%82%E5%B8%B802@2x.png',
247 + details: [
248 + {
249 + name: '预警演示',
250 + code: 'Y0218',
251 + note: '烟感异常',
252 + status: '异常',
253 + datetime: '2021-12-22 16:39:42',
254 + cctv_url: '', // 监控链接
255 + case_url: '1', // 预案链接
256 + notice_url: '1', // 通知链接
257 + handle_url: '1', // 处理链接
258 + },
259 + ],
260 + window_type: 'warn',
261 + },
262 + {
263 + name: '预警演示2',
264 + position: [120.588012, 31.314519],
265 + icon: 'https://cdn.ipadbiz.cn/xys/map/%E5%BC%82%E5%B8%B802@2x.png',
266 + details: [
267 + {
268 + name: '预警演示',
269 + code: 'Y0218',
270 + note: '烟感异常',
271 + status: '异常',
272 + datetime: '2021-12-22 16:39:42',
273 + cctv_url: '', // 监控链接
274 + case_url: '1', // 预案链接
275 + notice_url: '1', // 通知链接
276 + handle_url: '1', // 处理链接
277 + },
278 + ],
279 + window_type: 'warn',
280 + },
281 + ],
282 + }
283 + data.list = data.list.concat(temp);
284 + this.navBarList = data.list; // 底部导航条
285 + this.mapTiles = data.level; // 获取图层
286 + this.navKey = data.list[0]['id']; // 默认选中 第一个 id
287 + this.navList = data.list.filter(item => item.id === this.navKey)[0]['list']; // 返回默认选中项的实体信息
233 // 初始化地图 288 // 初始化地图
234 this.initMap(); 289 this.initMap();
235 // this.setMapBoundary(); 290 // this.setMapBoundary();
...@@ -305,11 +360,11 @@ export default { ...@@ -305,11 +360,11 @@ export default {
305 // 360 //
306 this.map.setRotation(6, true); 361 this.map.setRotation(6, true);
307 }, 362 },
308 - setNavLayer({ key }, index) { // 选择地图图层显示 363 + setNavLayer({ id }, index) { // 选择地图图层显示
309 this.isActive = index; 364 this.isActive = index;
310 - this.navList = map_max.filter(item => item.key === key)[0]['entity_info']; // 返回默认选中项的实体信息 365 + this.navList = this.navBarList.filter(item => item.id === id)[0]['list']; // 返回默认选中项的实体信息
311 this.removeLayer(); 366 this.removeLayer();
312 - this.loadMaker(key); 367 + this.loadMaker(id);
313 this.closeInfoWindow(); 368 this.closeInfoWindow();
314 setTimeout(() => { 369 setTimeout(() => {
315 // 地图zooms调整 370 // 地图zooms调整
...@@ -318,9 +373,9 @@ export default { ...@@ -318,9 +373,9 @@ export default {
318 }, 100); 373 }, 100);
319 this.removeNavRoute(); 374 this.removeNavRoute();
320 }, 375 },
321 - loadMaker (key) { 376 + loadMaker (id) {
322 var zoomStyleMapping = { 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0, 20: 0 }; 377 var zoomStyleMapping = { 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0, 20: 0 };
323 - const entity_info = this.navBarList.filter(item => item.key === key)[0]['entity_info']; 378 + const entity_info = this.navBarList.filter(item => item.id === id)[0]['list'];
324 this.markerSum = []; 379 this.markerSum = [];
325 _.each(entity_info, (x, i) => { 380 _.each(entity_info, (x, i) => {
326 var marker = new AMap.ElasticMarker({ 381 var marker = new AMap.ElasticMarker({
...@@ -572,8 +627,12 @@ export default { ...@@ -572,8 +627,12 @@ export default {
572 this.show_walk_route = true; 627 this.show_walk_route = true;
573 }, 628 },
574 computedMapSource(x, y, z) { // 根据图层信息生成图层实际地址 629 computedMapSource(x, y, z) { // 根据图层信息生成图层实际地址
575 - // TODO:等待正式映射图层真实的地址 630 + for (const id in this.mapTiles) {
576 - return `images/tiles/${z}/${x}_${y}.png` 631 + if (z == id) {
632 + const scope = this.mapTiles[id];
633 + return scope[`${x}-${y}`]
634 + }
635 + }
577 }, 636 },
578 setTitleLayer() { // 生成瓦片图 637 setTitleLayer() { // 生成瓦片图
579 const _this = this; 638 const _this = this;
...@@ -583,9 +642,9 @@ export default { ...@@ -583,9 +642,9 @@ export default {
583 zIndex: 100, 642 zIndex: 100,
584 createTile: function (x, y, z, success, fail) { 643 createTile: function (x, y, z, success, fail) {
585 // 控制地图等级显示图片范围-过滤不显示的图层渲染 644 // 控制地图等级显示图片范围-过滤不显示的图层渲染
586 - for (const key in _this.titleLayerSet) { 645 + for (const id in _this.titleLayerSet) {
587 - if (z == key) { 646 + if (z == id) {
588 - const scope = _this.titleLayerSet[key]; 647 + const scope = _this.titleLayerSet[id];
589 if (x < scope.x[0] || x > scope.x[1]) { 648 if (x < scope.x[0] || x > scope.x[1]) {
590 fail() 649 fail()
591 return; 650 return;
...@@ -730,8 +789,10 @@ export default { ...@@ -730,8 +789,10 @@ export default {
730 handleNavMarker (item) { // 底部列表点击跳转弹框判断 789 handleNavMarker (item) { // 底部列表点击跳转弹框判断
731 if (item.window_type === 'normal') { 790 if (item.window_type === 'normal') {
732 this.positionMarker(item) 791 this.positionMarker(item)
733 - } else { 792 + } else if (item.window_type === 'lite') {
734 this.positionLiteMarker(item) 793 this.positionLiteMarker(item)
794 + } else if (item.window_type === 'warn') {
795 + this.positionWarnMarker(item)
735 } 796 }
736 }, 797 },
737 positionMarker(item) { 798 positionMarker(item) {
...@@ -759,7 +820,6 @@ export default { ...@@ -759,7 +820,6 @@ export default {
759 }); 820 });
760 }, 821 },
761 positionWarnMarker(item) { 822 positionWarnMarker(item) {
762 - console.log(item);
763 // 点击后创建自定义信息窗口 823 // 点击后创建自定义信息窗口
764 this.setInfoWindowsWarn(item) 824 this.setInfoWindowsWarn(item)
765 // 把地图中心点设置为当前点击的标记点 825 // 把地图中心点设置为当前点击的标记点
......