Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
8e4476b4
ShopXO
项目概览
starsw001
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8e4476b4
编写于
2月 16, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
百度地图密钥同步编辑器地图组件
上级
170b497e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
6 deletion
+39
-6
application/service/ConfigService.php
application/service/ConfigService.php
+32
-0
public/static/common/lib/ueditor/dialogs/map/map.html
public/static/common/lib/ueditor/dialogs/map/map.html
+5
-4
public/static/common/lib/ueditor/dialogs/map/show.html
public/static/common/lib/ueditor/dialogs/map/show.html
+2
-2
未找到文件。
application/service/ConfigService.php
浏览文件 @
8e4476b4
...
...
@@ -104,6 +104,12 @@ class ConfigService
$params
[
$k
]
=
$v
;
}
// 处理百度地图 ak, 空则默认变量
if
(
array_key_exists
(
'common_baidu_map_ak'
,
$params
))
{
$map_ak_old
=
MyC
(
'common_baidu_map_ak'
,
'{{common_baidu_map_ak}}'
,
true
);
}
// 循环保存数据
$success
=
0
;
...
...
@@ -136,6 +142,32 @@ class ConfigService
return
$ret
;
}
// 处理百度地图 ak
if
(
array_key_exists
(
'common_baidu_map_ak'
,
$params
)
&&
isset
(
$map_ak_old
))
{
$file_all
=
[
ROOT
.
'public/static/common/lib/ueditor/dialogs/map/map.html'
,
ROOT
.
'public/static/common/lib/ueditor/dialogs/map/show.html'
,
];
foreach
(
$file_all
as
$f
)
{
// 是否有权限
if
(
!
is_writable
(
$f
))
{
return
DataReturn
(
'编辑器文件没有权限['
.
$f
.
']'
,
-
1
);
}
// 替换
$search
=
[
'ak={{common_baidu_map_ak}}'
,
'ak='
.
$map_ak_old
];
$replace
=
'ak='
.
MyC
(
'common_baidu_map_ak'
,
'{{common_baidu_map_ak}}'
,
true
);
$status
=
file_put_contents
(
$f
,
str_replace
(
$search
,
$replace
,
file_get_contents
(
$f
)));
if
(
$status
===
false
)
{
return
DataReturn
(
'百度地图密钥配置失败'
,
-
5
);
}
}
}
return
DataReturn
(
'编辑成功'
.
'['
.
$success
.
']'
);
}
return
DataReturn
(
'编辑失败'
,
-
100
);
...
...
public/static/common/lib/ueditor/dialogs/map/map.html
浏览文件 @
8e4476b4
...
...
@@ -4,7 +4,7 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title></title>
<script
type=
"text/javascript"
src=
"../internal.js"
></script>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?v=
1.1&services=true
"
></script>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?v=
2.0&ak={{common_baidu_map_ak}}
"
></script>
<style
type=
"text/css"
>
.content
{
width
:
530px
;
height
:
350px
;
margin
:
10px
auto
;}
.content
table
{
width
:
100%
}
...
...
@@ -87,7 +87,7 @@
map
.
centerAndZoom
(
points
[
0
],
13
);
}
point
=
map
.
getCenter
();
marker
.
setPo
int
(
point
);
marker
.
setPo
sition
(
point
);
}
else
{
alert
(
lang
.
errorMsg
);
}
...
...
@@ -139,11 +139,12 @@
};
dialog
.
onok
=
function
(){
var
center
=
map
.
getCenter
();
var
zoom
=
map
.
zoomLevel
;
var
zoom
=
map
.
getZoom
();
console
.
log
(
zoom
)
var
size
=
map
.
getSize
();
var
mapWidth
=
size
.
width
;
var
mapHeight
=
size
.
height
;
var
point
=
marker
.
getPo
int
();
var
point
=
marker
.
getPo
sition
();
if
(
$G
(
'
is_dynamic
'
).
checked
)
{
var
URL
=
editor
.
options
.
UEDITOR_HOME_URL
,
...
...
public/static/common/lib/ueditor/dialogs/map/show.html
浏览文件 @
8e4476b4
...
...
@@ -14,7 +14,7 @@
overflow
:
hidden
;
}
</style>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?
key=&v=1.1&services=true
"
></script>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?
v=2.0&ak={{common_baidu_map_ak}}
"
></script>
</head>
<body
onload=
"initMap();"
>
...
...
@@ -106,7 +106,7 @@
function
mapListenerHandler
()
{
var
zoom
=
map
.
getZoom
(),
center
=
map
.
getCenter
(),
marker
=
window
.
marker
.
getPo
int
();
marker
=
window
.
marker
.
getPo
sition
();
containerIframe
.
src
=
containerIframe
.
src
.
replace
(
new
RegExp
(
'
([?#&])center=([^?#&]+)
'
,
'
i
'
),
'
$1center=
'
+
center
.
lng
+
'
,
'
+
center
.
lat
).
replace
(
new
RegExp
(
'
([?#&])markers=([^?#&]+)
'
,
'
i
'
),
'
$1markers=
'
+
marker
.
lng
+
'
,
'
+
marker
.
lat
).
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录