Commit 279c8131 by xinla

百度地图key配置

1 parent 36e28bb3
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
}, },
async mounted() { async mounted() {
// 百度地图AK: GeDsF2XGs01U0bUSpFIUCmvyNoYuGC3P // 百度地图AK: GeDsF2XGs01U0bUSpFIUCmvyNoYuGC3P
await loadBMap('GeDsF2XGs01U0bUSpFIUCmvyNoYuGC3P') // 加载引入BMap await loadBMap() // 加载引入BMap
if (this.initData.address) { if (this.initData.address) {
this.form.address = this.initData.address this.form.address = this.initData.address
if (this.initData.longitude && this.initData.latitude) { if (this.initData.longitude && this.initData.latitude) {
......
...@@ -28,6 +28,7 @@ const common = { ...@@ -28,6 +28,7 @@ const common = {
DEFAULT_H5_WORDE: env.DOMAIN + '/static/WORD.png', DEFAULT_H5_WORDE: env.DOMAIN + '/static/WORD.png',
DEFAULT_H5_PPT: env.DOMAIN + '/static/PPT.png', DEFAULT_H5_PPT: env.DOMAIN + '/static/PPT.png',
PRIVIEW_URL: env.VIEW_URL, PRIVIEW_URL: env.VIEW_URL,
BAIDU_MAP_KEY: 'GeDsF2XGs01U0bUSpFIUCmvyNoYuGC3P', // 百度地图key
MICRO_APPS: { MICRO_APPS: {
store: { store: {
......
...@@ -2,20 +2,19 @@ ...@@ -2,20 +2,19 @@
* 动态加载百度地图api函数 * 动态加载百度地图api函数
* @param {String} ak 百度地图AK,必传 * @param {String} ak 百度地图AK,必传
*/ */
export default function loadBMap(ak) { export default function loadBMap() {
return new Promise(function(resolve, reject) { return new Promise(function (resolve, reject) {
if (typeof window.BMap !== 'undefined') { if (typeof window.BMap !== 'undefined') {
resolve(window.BMap) resolve(window.BMap)
return true return true
} }
window.onBMapCallback = function() { window.onBMapCallback = function () {
resolve(window.BMap) resolve(window.BMap)
} }
let script = document.createElement('script') let script = document.createElement('script')
script.type = 'text/javascript' script.type = 'text/javascript'
script.src = script.src = 'https://api.map.baidu.com/api?v=3.0&ak=' + window.lwConfig.BAIDU_MAP_KEY + '&callback=onBMapCallback'
'https://api.map.baidu.com/api?v=3.0&ak=' + ak + '&callback=onBMapCallback'
script.onerror = reject script.onerror = reject
document.head.appendChild(script) document.head.appendChild(script)
}) })
}
\ No newline at end of file \ No newline at end of file
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!