Commit 3bfaadd9 by hank

登录修改

parent eabfa361
...@@ -107,20 +107,33 @@ class Login extends Component { ...@@ -107,20 +107,33 @@ class Login extends Component {
const { userPhone, checkCode } = this.state const { userPhone, checkCode } = this.state
try { try {
Taro.showLoading({ title: '登录中...' }) Taro.showLoading({ title: '登录中...' })
const { data } = await api.user.login(userPhone, checkCode) const data = await api.user.login(userPhone, checkCode)
Taro.hideLoading() Taro.hideLoading()
if (data) { await token.setToken(data.token)
await token.setToken(data) if (data.token && data.loginState !== 'SIGNIN') {
if (process.env.TARO_ENV !== 'rn') { Taro.showModal({
Taro.switchTab({ url: '/pages/home/tempaltes/index' }) title: '通知',
} else { showCancel: false,
Taro.redirectTo({ url: '/pages/home/tempaltes/index' }) 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) { // if (Taro.getCurrentPages().length === 0) {
// Taro.redirectTo({ url: '/pages/home/tempaltes/index' }) // Taro.redirectTo({ url: '/pages/home/tempaltes/index' })
// } else { // } else {
// Taro.navigateBack() // Taro.navigateBack()
// } // }
} else {
Taro.redirectTo({ url: '/pages/home/device/index' })
} }
} catch (error) { } catch (error) {
// console.warn('用户登录出错~', 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