Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
9a9c25fe
Commit
9a9c25fe
authored
Mar 19, 2021
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跳转客服页添加参数
parent
3f802ea0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
17 deletions
+5
-17
src/pages/contact/index.vue
+4
-4
src/utils/wxIndex.js
+1
-13
No files found.
src/pages/contact/index.vue
View file @
9a9c25fe
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
ex
port
{
getUserLocation
}
from
"../../utils/wxIndex.js"
;
im
port
{
getUserLocation
}
from
"../../utils/wxIndex.js"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -27,11 +27,11 @@ export default {
...
@@ -27,11 +27,11 @@ export default {
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
getUserLocation
().
then
((
res
)
=>
{
getUserLocation
().
then
((
res
)
=>
{
let
longitude
=
res
.
longitude
;
options
.
longitude
=
res
.
longitude
;
let
latitude
=
res
.
latitude
;
options
.
latitude
=
res
.
latitude
;
this
.
sessionFrom
=
options
;
});
});
this
.
sessionFrom
=
options
.
opt
;
},
},
};
};
</
script
>
</
script
>
...
...
src/utils/wxIndex.js
View file @
9a9c25fe
...
@@ -8,7 +8,7 @@ export function wx_decode(appId, sessionKey, encryptedData, iv) {
...
@@ -8,7 +8,7 @@ export function wx_decode(appId, sessionKey, encryptedData, iv) {
// 定位方法
// 定位方法
export
function
getUserLocation
()
{
export
function
getUserLocation
()
{
return
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getLocation
({
wx
.
getLocation
({
type
:
'gcj02'
,
// type有两中类型,gcj02 是腾讯地图所能解析的
type
:
'gcj02'
,
// type有两中类型,gcj02 是腾讯地图所能解析的
success
:
res
=>
{
success
:
res
=>
{
...
@@ -16,15 +16,4 @@ export function getUserLocation() {
...
@@ -16,15 +16,4 @@ export function getUserLocation() {
}
}
})
})
})
})
}
// 获取定位城市名称方法
function
getCity
()
{
var
_this
=
this
wx
.
request
({
url
:
`https://apis.map.qq.com/ws/geocoder/v1/?key=key填写的位置&location=`
+
_this
.
data
.
locationObj
.
latitude
+
','
+
_this
.
data
.
locationObj
.
longitude
,
success
:
res
=>
{
console
.
log
(
res
)
// 此处返回的就是需要查询的城市名称
}
})
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment