Commit 3bfaadd9 by hank

登录修改

parent eabfa361
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment