Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
electronic-assets-wx
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程新智
electronic-assets-wx
Commits
d7221acf
Commit
d7221acf
authored
Jun 13, 2022
by
lijiongliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改登录
parent
e0091d5d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
5 deletions
+49
-5
user.js
kui/api/user.js
+6
-0
index.vue
pages/index/index.vue
+43
-5
No files found.
kui/api/user.js
View file @
d7221acf
...
@@ -8,3 +8,9 @@ export const loginByUsername = (params) => http.request({
...
@@ -8,3 +8,9 @@ export const loginByUsername = (params) => http.request({
method
:
'POST'
,
method
:
'POST'
,
data
:
params
data
:
params
})
})
export
const
loginByPhone
=
(
params
)
=>
http
.
request
({
url
:
$config
.
serveUrl
+
'auth/web/LoginByMaCode'
,
method
:
'POST'
,
data
:
params
})
\ No newline at end of file
pages/index/index.vue
View file @
d7221acf
...
@@ -35,9 +35,20 @@
...
@@ -35,9 +35,20 @@
<user
v-else
/>
<user
v-else
/>
</view>
</view>
<view
class=
"home-btn"
v-if=
"!token"
>
<view
class=
"home-btn"
v-if=
"!token"
>
<button
type=
"primary"
@
click=
"clickLogin"
><span>
<!--
<button
type=
"primary"
@
click=
"clickLogin"
>
<span>
<image
src=
"@/static/home/wx_logo.png"
>
<image
src=
"@/static/home/wx_logo.png"
>
</span>
授权登录
</button>
</span>
授权登录
</button>
-->
<button
class=
"login__btn"
hover-class=
"none"
type=
'primary'
open-type=
"getPhoneNumber"
@
getphonenumber=
"getPhoneNumber"
>
<span>
<image
src=
"@/static/home/wx_logo.png"
>
</span>
授权登录
</button>
</view>
</view>
<u-picker
:show=
"selectShow"
@
cancel=
'cancel'
@
confirm=
"confirm"
:columns=
"columns"
></u-picker>
<u-picker
:show=
"selectShow"
@
cancel=
'cancel'
@
confirm=
"confirm"
:columns=
"columns"
></u-picker>
<!--
<button
type=
"primary"
open-type=
"share"
@
click=
"share"
>
分享
</button>
-->
<!--
<button
type=
"primary"
open-type=
"share"
@
click=
"share"
>
分享
</button>
-->
...
@@ -53,7 +64,7 @@ import {
...
@@ -53,7 +64,7 @@ import {
login
login
}
from
"@/kui/util/login.js"
;
}
from
"@/kui/util/login.js"
;
import
{
import
{
loginByUsername
,
loginByUsername
,
loginByPhone
}
from
"@/kui/api/user.js"
;
}
from
"@/kui/api/user.js"
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -149,10 +160,12 @@ export default {
...
@@ -149,10 +160,12 @@ export default {
uni
.
getUserProfile
({
uni
.
getUserProfile
({
desc
:
'用于完善会员资料'
,
// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
desc
:
'用于完善会员资料'
,
// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
res
,
11111
)
console
.
log
(
this
.
config
,
11111
)
this
.
config
.
userInfo
=
res
.
userInfo
this
.
config
.
userInfo
=
res
.
userInfo
this
.
$store
.
state
.
userInfo
=
res
.
userInfo
this
.
$store
.
state
.
userInfo
=
res
.
userInfo
uni
.
setStorageSync
(
'userInfo'
,
res
.
userInfo
);
uni
.
setStorageSync
(
'userInfo'
,
res
.
userInfo
);
this
.
wxLogin
(
this
.
config
)
//
this.wxLogin(this.config)
},
},
fail
:
(
res
)
=>
{
fail
:
(
res
)
=>
{
console
.
log
(
'--'
,
res
);
console
.
log
(
'--'
,
res
);
...
@@ -160,6 +173,32 @@ export default {
...
@@ -160,6 +173,32 @@ export default {
})
})
}
}
},
},
//解析手机号
getPhoneNumber
(
e
)
{
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
});
let
that
=
this
if
(
e
.
detail
.
errMsg
==
"getPhoneNumber:ok"
)
{
uni
.
hideLoading
()
this
.
decodePhoneLogin
(
e
.
detail
)
}
else
{
uni
.
hideLoading
()
console
.
log
(
"用户点击了拒绝"
)
}
},
// 解密手机并且登录
decodePhoneLogin
(
detail
){
let
code
=
detail
.
code
;
loginByPhone
({
code
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
0
)
{
this
.
$store
.
state
.
token
=
res
.
data
.
token
uni
.
setStorageSync
(
'token'
,
res
.
data
.
token
);
}
});
},
}
}
}
}
</
script
>
</
script
>
...
@@ -178,7 +217,6 @@ export default {
...
@@ -178,7 +217,6 @@ export default {
align-items: center;
align-items: center;
bottom: 0;
bottom: 0;
border-top: 1rpx solid #ddd;
border-top: 1rpx solid #ddd;
button {
button {
width: 600rpx;
width: 600rpx;
height: 80rpx;
height: 80rpx;
...
...
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