Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 279c8131
authored
Jun 17, 2023
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
百度地图key配置
1 parent
36e28bb3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
vue3-lw-pc/src/components/common/BaiduMap.vue
vue3-lw-pc/src/config.js
vue3-lw-pc/src/utils/baiduMap.js
vue3-lw-pc/src/components/common/BaiduMap.vue
View file @
279c813
...
@@ -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
)
{
...
...
vue3-lw-pc/src/config.js
View file @
279c813
...
@@ -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
:
{
...
...
vue3-lw-pc/src/utils/baiduMap.js
View file @
279c813
...
@@ -2,19 +2,18 @@
...
@@ -2,19 +2,18 @@
* 动态加载百度地图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
)
})
})
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment