Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
visualcloud
/
Vmatrix-client-taro
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3bfaadd9
authored
Sep 19, 2019
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录修改
parent
eabfa361
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
src/pages/login/index.tsx
+21
-8
No files found.
src/pages/login/index.tsx
View file @
3bfaadd9
...
...
@@ -107,20 +107,33 @@ class Login extends Component {
const
{
userPhone
,
checkCode
}
=
this
.
state
try
{
Taro
.
showLoading
({
title
:
'登录中...'
})
const
{
data
}
=
await
api
.
user
.
login
(
userPhone
,
checkCode
)
const
data
=
await
api
.
user
.
login
(
userPhone
,
checkCode
)
Taro
.
hideLoading
()
if
(
data
)
{
await
token
.
setToken
(
data
)
if
(
process
.
env
.
TARO_ENV
!==
'rn'
)
{
Taro
.
switchTab
({
url
:
'/pages/home/tempaltes/index'
})
}
else
{
Taro
.
redirectTo
({
url
:
'/pages/home/tempaltes/index'
})
}
await
token
.
setToken
(
data
.
token
)
if
(
data
.
token
&&
data
.
loginState
!==
'SIGNIN'
)
{
Taro
.
showModal
({
title
:
'通知'
,
showCancel
:
false
,
content
:
'您已获得3个月会员资格,可以使用全部精美模板。'
}).
then
(()
=>
{
if
(
process
.
env
.
TARO_ENV
!==
'rn'
)
{
Taro
.
switchTab
({
url
:
'/pages/home/tempaltes/index'
})
}
else
{
Taro
.
redirectTo
({
url
:
'/pages/home/tempaltes/index'
})
}
})
// if (process.env.TARO_ENV !== 'rn') {
// Taro.switchTab({ url: '/pages/home/tempaltes/index' })
// } else {
// Taro.redirectTo({ url: '/pages/home/tempaltes/index' })
// }
// if (Taro.getCurrentPages().length === 0) {
// Taro.redirectTo({ url: '/pages/home/tempaltes/index' })
// } else {
// Taro.navigateBack()
// }
}
else
{
Taro
.
redirectTo
({
url
:
'/pages/home/device/index'
})
}
}
catch
(
error
)
{
// console.warn('用户登录出错~', error)
...
...
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