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
3f802ea0
Commit
3f802ea0
authored
Mar 18, 2021
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客服时获取定位
parent
46552484
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
33 deletions
+71
-33
src/pages/contact/index.vue
+46
-32
src/utils/wxIndex.js
+25
-1
No files found.
src/pages/contact/index.vue
View file @
3f802ea0
<
template
>
<
template
>
<div
class=
"contact"
>
<div
class=
"contact"
>
<div
class=
"contact-img"
>
<div
class=
"contact-img"
>
<img
src=
"../../../static/images/contact_img.png"
alt=
""
>
<img
src=
"../../../static/images/contact_img.png"
alt=
""
/
>
</div>
</div>
<div
class=
"btn-wrap"
>
<div
class=
"btn-wrap"
>
<button
open-type=
"contact
"
>
<button
open-type=
"contact"
show-message-card
:session-from=
"sessionFrom
"
>
<div
class=
"btn-main"
>
<div
class=
"btn-main"
>
<div
class=
"main-img"
>
<div
class=
"main-img"
>
<img
src=
"../../../static/images/wx.png"
alt=
""
>
<img
src=
"../../../static/images/wx.png"
alt=
""
/
>
</div>
</div>
<div
class=
"main-text"
>
官方微信客服
</div>
<div
class=
"main-text"
>
官方微信客服
</div>
</div>
</div>
<img
class=
"btn-next"
src=
"../../../static/images/next.png"
alt=
""
>
<img
class=
"btn-next"
src=
"../../../static/images/next.png"
alt=
""
/
>
</button>
</button>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
{
getUserLocation
}
from
"../../utils/wxIndex.js"
;
export
default
{
export
default
{
data
()
{
return
{
sessionFrom
:
""
,
};
},
onLoad
(
options
)
{
getUserLocation
().
then
((
res
)
=>
{
let
longitude
=
res
.
longitude
;
let
latitude
=
res
.
latitude
;
});
}
this
.
sessionFrom
=
options
.
opt
;
},
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.contact
{
.contact
{
padding
:
10px
22px
0
22px
;
padding
:
10px
22px
0
22px
;
}
}
.contact-img
{
.contact-img
{
width
:
100%
;
width
:
100%
;
height
:
154px
;
height
:
154px
;
margin-bottom
:
24px
;
margin-bottom
:
24px
;
background-color
:
#ccc
;
background-color
:
#ccc
;
border-radius
:
8px
;
border-radius
:
8px
;
}
}
.contact-img
img
{
.contact-img
img
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
}
}
.btn-wrap
{
.btn-wrap
{
width
:
100%
;
width
:
100%
;
height
:
80px
;
height
:
80px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
}
}
button
{
button
{
width
:
100%
;
width
:
100%
;
height
:
80px
;
height
:
80px
;
border
:
none
;
border
:
none
;
...
@@ -53,35 +66,35 @@ export default {
...
@@ -53,35 +66,35 @@ export default {
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
space-between
;
justify-content
:
space-between
;
}
}
.btn-main
{
.btn-main
{
display
:
flex
;
display
:
flex
;
height
:
40px
;
height
:
40px
;
}
}
.main-img
{
.main-img
{
width
:
54px
;
width
:
54px
;
height
:
40px
;
height
:
40px
;
border-right
:
1px
solid
#D7D4D
4
;
border-right
:
1px
solid
#d7d4d
4
;
padding-top
:
3px
;
padding-top
:
3px
;
}
}
.main-img
img
{
.main-img
img
{
width
:
42px
;
width
:
42px
;
height
:
34px
;
height
:
34px
;
}
}
.main-text
{
.main-text
{
color
:
#1C1B1B
;
color
:
#1c1b1b
;
font-size
:
17px
;
font-size
:
17px
;
margin-left
:
10px
;
margin-left
:
10px
;
}
}
.btn-next
{
.btn-next
{
width
:
9px
;
width
:
9px
;
height
:
14px
;
height
:
14px
;
}
}
.btn-next
img
{
.btn-next
img
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
}
}
button
::after
{
button
::after
{
border
:
none
;
border
:
none
;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/utils/wxIndex.js
View file @
3f802ea0
// 微信解密
// 微信解密
export
function
wx_decode
(
appId
,
sessionKey
,
encryptedData
,
iv
)
{
export
function
wx_decode
(
appId
,
sessionKey
,
encryptedData
,
iv
)
{
var
WXBizDataCrypt
=
require
(
'./WXBizDataCrypt'
);
var
WXBizDataCrypt
=
require
(
'./WXBizDataCrypt'
);
var
pc
=
new
WXBizDataCrypt
(
appId
,
sessionKey
);
var
pc
=
new
WXBizDataCrypt
(
appId
,
sessionKey
);
var
data
=
pc
.
decryptData
(
encryptedData
,
iv
);
var
data
=
pc
.
decryptData
(
encryptedData
,
iv
);
return
data
;
return
data
;
}
}
// 定位方法
export
function
getUserLocation
()
{
return
Promise
((
resolve
,
reject
)
=>
{
wx
.
getLocation
({
type
:
'gcj02'
,
// type有两中类型,gcj02 是腾讯地图所能解析的
success
:
res
=>
{
resolve
(
res
)
}
})
})
}
// 获取定位城市名称方法
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