Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tomleePHP
uni-app
提交
08e7d544
U
uni-app
项目概览
tomleePHP
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
08e7d544
编写于
5月 09, 2019
作者:
d-u-a
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: H5 map组件支持用户在manifest配置key,增加错误提示信息
上级
8610f162
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
29 deletion
+29
-29
src/platforms/h5/components/system-routes/choose-location/index.vue
...rms/h5/components/system-routes/choose-location/index.vue
+14
-14
src/platforms/h5/components/system-routes/open-location/index.vue
...forms/h5/components/system-routes/open-location/index.vue
+10
-10
src/platforms/h5/service/api/location.js
src/platforms/h5/service/api/location.js
+4
-4
src/platforms/h5/view/components/map/index.vue
src/platforms/h5/view/components/map/index.vue
+1
-1
未找到文件。
src/platforms/h5/components/system-routes/choose-location/index.vue
浏览文件 @
08e7d544
<
template
>
<div
class=
"uni-system-choose-location"
>
<system-header
:confirm=
"!!data"
@
back=
"_back"
<system-header
:confirm=
"!!data"
@
back=
"_back"
@
confirm=
"_choose"
>
选择位置
</system-header>
<div
class=
"map-content"
>
<iframe
:src=
"src"
allow=
"geolocation"
seamless
sandbox=
"allow-scripts allow-same-origin allow-forms"
<iframe
:src=
"src"
allow=
"geolocation"
seamless
sandbox=
"allow-scripts allow-same-origin allow-forms"
frameborder=
"0"
/>
</div>
</div>
</
template
>
<
script
>
import
SystemHeader
from
'
../system-header
'
import
SystemHeader
from
'
../system-header
'
export
default
{
name
:
'
SystemChooseLocation
'
,
components
:
{
SystemHeader
name
:
'
SystemChooseLocation
'
,
components
:
{
SystemHeader
},
data
()
{
return
{
...
...
@@ -29,7 +29,7 @@ export default {
}
},
mounted
()
{
var
key
=
'
WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS
'
var
key
=
__uniConfig
.
qqMapKey
this
.
src
=
`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=
${
key
}
&referer=uniapp`
window
.
addEventListener
(
'
message
'
,
(
event
)
=>
{
var
loc
=
event
.
data
...
...
@@ -81,4 +81,4 @@ export default {
width
:
100%
;
height
:
100%
;
}
</
style
>
</
style
>
src/platforms/h5/components/system-routes/open-location/index.vue
浏览文件 @
08e7d544
...
...
@@ -2,17 +2,17 @@
<div
class=
"uni-system-open-location"
>
<system-header
@
back=
"_back"
>
位置
</system-header>
<div
class=
"map-content"
>
<iframe
ref=
"map"
:src=
"src"
allow=
"geolocation"
sandbox=
"allow-scripts allow-same-origin allow-forms"
<iframe
ref=
"map"
:src=
"src"
allow=
"geolocation"
sandbox=
"allow-scripts allow-same-origin allow-forms"
frameborder=
"0"
@
load=
"_load"
/>
<!-- 去这里 -->
<div
v-if=
"isPoimarkerSrc"
class=
"actTonav"
<div
v-if=
"isPoimarkerSrc"
class=
"actTonav"
@
click=
"_nav"
/>
</div>
</div>
...
...
@@ -20,7 +20,7 @@
<
script
>
import
SystemHeader
from
'
../system-header
'
const
key
=
'
WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS
'
const
key
=
__uniConfig
.
qqMapKey
const
referer
=
'
uniapp
'
const
poimarkerSrc
=
'
https://apis.map.qq.com/tools/poimarker
'
...
...
@@ -110,4 +110,4 @@ export default {
height
:
60px
;
border-radius
:
60px
;
}
</
style
>
</
style
>
src/platforms/h5/service/api/location.js
浏览文件 @
08e7d544
...
...
@@ -9,7 +9,7 @@ function wgs84ToGcj02 (coords, success, error) {
/**
* uniapp 内置key
*/
var
key
=
'
WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS
'
var
key
=
__uniConfig
.
qqMapKey
var
url
=
`https://apis.map.qq.com/ws/coord/v1/translate?locations=
${
coords
.
latitude
}
,
${
coords
.
longitude
}
&type=1&key=
${
key
}
&output=jsonp`
getJSONP
(
url
,
{},
(
res
)
=>
{
if
(
'
locations
'
in
res
&&
res
.
locations
.
length
)
{
...
...
@@ -18,7 +18,7 @@ function wgs84ToGcj02 (coords, success, error) {
latitude
:
res
.
locations
[
0
].
lat
})
}
else
{
error
()
error
(
res
)
}
},
error
)
}
...
...
@@ -48,9 +48,9 @@ export function getLocation ({
if
(
type
===
'
WGS84
'
)
{
callback
(
coords
)
}
else
{
wgs84ToGcj02
(
coords
,
callback
,
()
=>
{
wgs84ToGcj02
(
coords
,
callback
,
(
err
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
'
getLocation:fail
'
errMsg
:
'
getLocation:fail
'
+
JSON
.
stringify
(
err
)
})
})
}
...
...
src/platforms/h5/view/components/map/index.vue
浏览文件 @
08e7d544
...
...
@@ -791,7 +791,7 @@ export default {
maps
=
window
.
qq
.
maps
callback
()
}
else
{
let
key
=
'
XVXBZ-NDMC4-JOGUS-XGIEE-QVHDZ-AMFV2
'
let
key
=
__uniConfig
.
qqMapKey
let
callbackName
=
'
_callback
'
+
Date
.
now
()
window
[
callbackName
]
=
function
()
{
delete
window
[
callbackName
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录