diff --git a/src/Login.vue b/src/Login.vue index 4f3b2482..c430ab9c 100644 --- a/src/Login.vue +++ b/src/Login.vue @@ -223,6 +223,7 @@ export default { localStorage.setItem(storageKey.dateFormat, data.date_format) localStorage.setItem(storageKey.sysName, data.system_name) localStorage.setItem(storageKey.sysLogo, data.system_logo) + localStorage.setItem(storageKey.mapConfig, data.map_config) } }, async mounted () { diff --git a/src/utils/constants.js b/src/utils/constants.js index f645e8f0..547be9ad 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -47,7 +47,8 @@ export const storageKey = { linkInfo: 'cn-link-info', history: 'cn-history', schemaEntityExplore: 'schema_entity_explore', - trackingSubscribers: 'tracking-subscribers' + trackingSubscribers: 'cn-tracking-subscribers', + mapConfig: 'cn-map-config' } export const largeCountryList = ['CN', 'US', 'RU', 'AU', 'CA', 'KZ', 'IN', 'BR'] @@ -2531,6 +2532,14 @@ export const reg = { containChinese: /[\u4E00-\u9FA5\uF900-\uFA2D]+/ } +export const defaultMapConfig = { + center: [116.38, 39.82], // 默认地图中心 + maxZoom: 14, // 最大缩放等级 + minZoom: 3, // 最小缩放等级 + mapLevel: 2, // 数据精度 1、2、3,1最大 + defaultZoom: 12 // 默认缩放等级 +} + export const report = { timeRuleList: [ { name: 'overall.today', value: 'today' }, diff --git a/src/views/location/Index.vue b/src/views/location/Index.vue index fc4039a8..76c4f31a 100644 --- a/src/views/location/Index.vue +++ b/src/views/location/Index.vue @@ -391,7 +391,7 @@ import maplibregl from 'maplibre-gl' import mapStyle from '@/views/charts2/charts/entityDetail/mapStyle' import 'maplibre-gl/dist/maplibre-gl.css' import unitConvert, { valueToRangeValue } from '@/utils/unit-convert' -import { unitTypes, storageKey } from '@/utils/constants' +import { unitTypes, storageKey, defaultMapConfig } from '@/utils/constants' import * as echarts from 'echarts' import { appListChartOption } from '@/views/charts2/charts/options/echartOption' import { pieOption } from '@/views/location/chartOption' @@ -1687,6 +1687,8 @@ export default { baseStation: 153, human: 167 } + + const mapConfig = localStorage.getItem(storageKey.mapConfig) ? JSON.parse(localStorage.getItem(storageKey.mapConfig)) : defaultMapConfig return { activeTab, dropDownValue, @@ -1719,12 +1721,12 @@ export default { currentShowSubscriber, // 当前在地图上展示轨迹的Subscriber trackingSubscriberRecordMap: [], // record数据量大时,vue监听性能开销太大,所以单独用非监听的数组来维护subscriberId与record的关系 loading, // 控制组件内各处loading图标 - maxZoom: 14, // 地图最小缩放比例 - minZoom: 3, // 地图最大缩放比例 - mapLevel: 2, // 地图精度 1、2、3 + maxZoom: mapConfig.maxZoom, // 地图最小缩放比例 + minZoom: mapConfig.minZoom, // 地图最大缩放比例 + mapLevel: mapConfig.mapLevel, // 地图精度 1、2、3 unitTypes, - defaultZoom: 12, // 地图默认缩放比例 - center: [116.38, 39.82], // 地图默认中心点。北京:[116.38, 39.9] 纽约:[-73.94539, 40.841843] + defaultZoom: mapConfig.defaultZoom, // 地图默认缩放比例 + center: mapConfig.center, // 地图默认中心点。北京:[116.38, 39.9] 纽约:[-73.94539, 40.841843] debounceMinuteChange: shallowRef(null), debounceOnResize: shallowRef(null), debounceVisualChange: shallowRef(null),