xlqx/app/config/amap.ts

76 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-10-29 14:44:18 +08:00
// 高德地图配置
export const amapConfig = {
// 高德地图Web服务API Key
// 在高德开放平台申请https://console.amap.com/dev/key/app
key: '11da89fddf9340d0a69d4fff53c0ec4b',
// 高德地图安全密钥Security Key
// 在高德开放平台的安全设置中获取用于保护API Key
2025-10-30 09:39:22 +08:00
2025-10-29 14:44:18 +08:00
// 地图默认配置
defaultCenter: [39.9042, 116.4074], // 北京坐标
defaultZoom: 13,
// 地图样式
styles: {
normal: 'amap://styles/normal',
dark: 'amap://styles/dark',
light: 'amap://styles/light',
fresh: 'amap://styles/fresh',
grey: 'amap://styles/grey',
graffiti: 'amap://styles/graffiti',
macaron: 'amap://styles/macaron',
blue: 'amap://styles/blue',
darkblue: 'amap://styles/darkblue',
wine: 'amap://styles/wine'
},
// 服务网点坐标(示例数据)
servicePoints: [
{
id: 1,
name: '北京总部',
address: '北京市朝阳区xxx街道xxx号',
position: [116.4074, 39.9042],
phone: '010-12345678',
hours: '9:00-18:00'
},
{
id: 2,
name: '上海分公司',
address: '上海市浦东新区xxx路xxx号',
position: [121.4737, 31.2304],
phone: '021-87654321',
hours: '9:00-18:00'
},
{
id: 3,
name: '广州分公司',
address: '广州市天河区xxx大道xxx号',
position: [113.2644, 23.1291],
phone: '020-11223344',
hours: '9:00-18:00'
}
]
}
// 获取地图API URL
export const getAMapScriptUrl = () => {
return `https://webapi.amap.com/maps?v=2.0&key=${amapConfig.key}`
}
2025-10-30 09:39:22 +08:00
2025-10-29 14:44:18 +08:00
// 验证密钥配置
export const validateKeys = () => {
const hasKey = amapConfig.key && amapConfig.key !== 'YOUR_AMAP_KEY'
2025-10-30 09:39:22 +08:00
2025-10-29 14:44:18 +08:00
return {
hasKey,
2025-10-30 09:39:22 +08:00
isValid: hasKey
2025-10-29 14:44:18 +08:00
}
}