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
c69dc8f7
Commit
c69dc8f7
authored
Aug 15, 2023
by
hxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序手机号逻辑更新
parent
ec41953c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
12 deletions
+31
-12
src/api/login.js
+5
-0
src/pages/login/index.vue
+26
-12
No files found.
src/api/login.js
View file @
c69dc8f7
...
...
@@ -57,5 +57,9 @@ console.log(process.env,'-----------------config------')
addCustomerRel
(
data
)
{
return
requestGET
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/addCustomerRel?tagId=
${
data
}
`
)
},
// 根据 code 获取用户手机号
getPhoneNumber
(
code
)
{
return
requestGET
(
`
${
process
.
env
.
OLSHOP_URL
}
/getPhoneNumber?code=
${
code
}
`
)
},
}
\ No newline at end of file
src/pages/login/index.vue
View file @
c69dc8f7
...
...
@@ -67,14 +67,16 @@
<p
class=
"hint"
>
绑定手机号,同步历史订单
</p>
<button
class=
"btn"
v-if=
"showGetPhoneBtn"
v-if=
"showGetPhoneBtn
&& tempData.isBindingPhoneMethod != 1
"
open-type=
"getPhoneNumber"
@
getphonenumber=
"getPhoneNumber"
>
微信授权一键绑定
</button>
<div
class=
"btn2"
@
click=
"handbindHandle"
>
手动绑定手机号
</div>
<div
class=
"cancelLogin"
@
click=
"cancelLogin"
>
暂不登录
</div>
<div
class=
"btn2"
v-if=
"tempData.isBindingPhoneMethod != 0"
@
click=
"handbindHandle"
>
手动绑定手机号
</div>
<div
class=
"cancelLogin"
@
click=
"cancelLogin"
>
{{
tempData
.
isForceUnion
==
'true'
?
'暂不登录'
:
'暂不绑定'
}}
</div>
</div>
</div>
<!-- 选择企业 -->
...
...
@@ -730,17 +732,22 @@ export default {
}
wx
.
checkSession
({
success
:
()
=>
{
success
:
async
()
=>
{
//session_key 未过期,并且在本生命周期一直有效
if
(
e
.
target
.
errMsg
==
"getPhoneNumber:ok"
)
{
// this.isShowPhone = false;
this
.
phoneNumber
=
wx_decode
(
this
.
appid
,
this
.
session_key
,
e
.
mp
.
detail
.
encryptedData
,
e
.
mp
.
detail
.
iv
+
""
).
phoneNumber
;
log
.
info
(
"生命周期一直"
,
this
.
phoneNumber
);
if
(
e
.
mp
.
detail
.
code
)
{
// 新组件处理方法
const
res
=
await
login
.
getPhoneNumber
(
e
.
mp
.
detail
.
code
);
if
(
res
.
data
.
code
==
200
)
{
this
.
phoneNumber
=
res
.
data
.
data
;
}
}
else
{
// 旧组件处理方法
this
.
phoneNumber
=
wx_decode
(
this
.
appid
,
this
.
session_key
,
e
.
mp
.
detail
.
encryptedData
,
e
.
mp
.
detail
.
iv
+
""
).
phoneNumber
;
}
this
.
bindUser
();
}
},
...
...
@@ -868,6 +875,13 @@ export default {
});
},
cancelLogin
(){
if
(
this
.
tempData
.
isForceUnion
==
'false'
)
{
// 不强制绑定
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
this
.
tempData
.
sessionId
});
return
this
.
checkLogin
();
}
// wx.reLaunch({
// url : '/pages/home/main'
// })
...
...
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