Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
scmMiniprogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f7f3251a
authored
Sep 15, 2021
by
liangjianmin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
css
parent
58355e58
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
13 deletions
pages.json
pages/mine/auth.vue
pages/mine/authPhone.vue
pages/mine/login.vue
pages.json
View file @
f7f3251a
...
...
@@ -25,7 +25,12 @@
},
{
"path"
:
"pages/mine/auth"
,
"style"
:
{
"navigationBarTitleText"
:
"登录"
"navigationBarTitleText"
:
"授权登录"
}
},
{
"path"
:
"pages/mine/authPhone"
,
"style"
:
{
"navigationBarTitleText"
:
"授权手机号"
}
},
{
"path"
:
"pages/mine/login"
,
...
...
@@ -37,12 +42,12 @@
"style"
:
{
"navigationBarTitleText"
:
"提交结果"
}
},{
},
{
"path"
:
"pages/question/handle"
,
"style"
:
{
"navigationBarTitleText"
:
"操作处理"
}
},{
},
{
"path"
:
"pages/question/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"操作详情"
...
...
pages/mine/auth.vue
View file @
f7f3251a
...
...
@@ -47,13 +47,16 @@ export default {
wx
.
getUserProfile
({
desc
:
'用于完善会员资料'
,
success
:
res
=>
{
self
.
request
(
API
.
getOpenId
,
'GET'
,
{
code
:
self
.
code
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
uni
.
setStorageSync
(
'openid'
,
res
.
data
.
openid
);
self
.
bindWechat
(
res
);
}
else
{
self
.
request
(
API
.
getOpenId
,
'GET'
,
{
code
:
self
.
code
},
true
).
then
(
data
=>
{
if
(
data
.
err_code
===
0
)
{
uni
.
setStorageSync
(
'openid'
,
data
.
data
.
openid
);
uni
.
setStorageSync
(
'session_key'
,
data
.
data
.
session_key
);
uni
.
navigateTo
({
url
:
'/pages/mine/authPhone'
});
}
else
{
uni
.
showToast
({
title
:
res
.
err_msg
,
title
:
data
.
err_msg
,
icon
:
'none'
,
duration
:
2000
});
...
...
@@ -69,8 +72,8 @@ export default {
}
});
},
bindWechat
(
data
)
{
this
.
request
(
API
.
BindWechat
,
'POST'
,
{
encryptedData
:
data
.
encryptedData
,
iv
:
data
.
iv
},
true
).
then
(
res
=>
{
bindWechat
(
data
,
openid
,
session_key
)
{
this
.
request
(
API
.
BindWechat
,
'POST'
,
{
encryptedData
:
data
.
encryptedData
,
iv
:
data
.
iv
,
openid
:
openid
,
session_key
:
session_key
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
uni
.
navigateTo
({
url
:
'/pages/mine/login'
...
...
pages/mine/authPhone.vue
0 → 100644
View file @
f7f3251a
<
template
>
<view
class=
"page-auth column rowCenter verCenter"
>
<text
class=
"logo"
></text>
<text
class=
"title"
>
SCM商务系统
</text>
<button
class=
"share row rowCenter verCenter"
open-type=
"getPhoneNumber"
@
getphonenumber=
"decryptPhoneNumber"
>
<text
class=
"iconfont icon-jinggao1"
></text>
<text
class=
"t1"
>
微信授权获取手机号
</text>
</button>
<view
class=
"copyright"
>
©2021深圳市猎芯供应链有限公司 ALL RIGHTS RESERVED
</view>
</view>
</
template
>
<
script
>
import
{
API
}
from
'@/util/api.js'
;
export
default
{
data
()
{
return
{};
},
onLoad
(
options
)
{
uni
.
login
({
success
:
res
=>
{
console
.
log
(
'login'
,
JSON
.
stringify
(
res
));
}
});
},
onShareTimeline
(
res
)
{},
methods
:
{
decryptPhoneNumber
(
e
)
{
let
openid
=
uni
.
getStorageSync
(
'openid'
);
let
session_key
=
uni
.
getStorageSync
(
'session_key'
);
console
.
log
(
e
);
this
.
request
(
API
.
BindWechat
,
'POST'
,
{
encryptedData
:
e
.
detail
.
encryptedData
,
iv
:
e
.
detail
.
iv
,
openid
:
openid
,
session_key
:
session_key
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
uni
.
navigateTo
({
url
:
'/pages/mine/login'
});
}
});
}
}
};
</
script
>
<
style
lang=
"scss"
>
@import
'../../assets/css/mine/auth.scss'
;
</
style
>
pages/mine/login.vue
View file @
f7f3251a
...
...
@@ -53,8 +53,23 @@ export default {
return
false
;
}
let
wechat_unique_id
=
uni
.
getStorageSync
(
'openid'
);
this
.
request
(
API
.
Login
,
'POST'
,
{
account
:
this
.
account
,
pwd
:
this
.
pwd
,
wechat_unique_id
:
wechat_unique_id
},
true
).
then
(
res
=>
{
let
openid
=
uni
.
getStorageSync
(
'openid'
);
let
session_key
=
uni
.
getStorageSync
(
'session_key'
);
let
encryptedData
=
uni
.
getStorageSync
(
'encryptedData'
);
let
iv
=
uni
.
getStorageSync
(
'iv'
);
this
.
request
(
API
.
Login
,
'POST'
,
{
account
:
this
.
account
,
pwd
:
this
.
pwd
,
openid
:
openid
,
session_key
:
session_key
,
encryptedData
:
encryptedData
,
iv
:
iv
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
uni
.
setStorageSync
(
'token'
,
res
.
data
.
token
);
uni
.
navigateBack
({
...
...
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