79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
// 高德地图配置
|
||
export const amapConfig = {
|
||
// 高德地图Web服务API Key
|
||
// 在高德开放平台申请:https://console.amap.com/dev/key/app
|
||
key: '11da89fddf9340d0a69d4fff53c0ec4b',
|
||
|
||
// 高德地图安全密钥(Security Key)
|
||
// 在高德开放平台的安全设置中获取,用于保护API Key
|
||
securityKey: '32dca5ef246f3b96234cd8ef891e4d59',
|
||
|
||
// 地图默认配置
|
||
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}`
|
||
}
|
||
|
||
// 获取安全密钥(用于服务端签名)
|
||
export const getSecurityKey = () => {
|
||
return amapConfig.securityKey
|
||
}
|
||
|
||
// 验证密钥配置
|
||
export const validateKeys = () => {
|
||
const hasKey = amapConfig.key && amapConfig.key !== 'YOUR_AMAP_KEY'
|
||
const hasSecurityKey = amapConfig.securityKey && amapConfig.securityKey !== 'YOUR_SECURITY_KEY'
|
||
|
||
return {
|
||
hasKey,
|
||
hasSecurityKey,
|
||
isValid: hasKey && hasSecurityKey
|
||
}
|
||
}
|