| | |
| | | } else { |
| | | uni.showToast({ title: res.msg || '发送失败', icon: 'none' }); |
| | | } |
| | | }).catch(err => { |
| | | uni.showToast({ title: '发送失败', icon: 'none' }); |
| | | }); |
| | | }) |
| | | }, |
| | | login() { |
| | | if (!this.isAgreed) { |
| | |
| | | uni.showToast({ title: '请输入密码', icon: 'none' }); |
| | | return; |
| | | } |
| | | |
| | | uni.showLoading({ title: '登录中...' }) |
| | | this.$u.api.login(this.form).then(res => { |
| | | uni.hideLoading() |
| | | if (res.code === 200) { |
| | | this.$store.commit('setToken', res.data.token); |
| | | this.$u.api.verifyDetail().then(user => { |
| | |
| | | return; |
| | | } |
| | | |
| | | uni.showLoading({ title: '登录中...' }) |
| | | this.$u.api.register({ telephone: this.form.telephone, code: this.form.code }).then(res => { |
| | | uni.hideLoading() |
| | | if (res.code === 200) { |
| | | this.$store.commit('setToken', res.data.token); |
| | | this.$u.api.verifyDetail().then(user => { |
| | |
| | | } |
| | | }) |
| | | } |
| | | }).catch(() => { |
| | | uni.hideLoading() |
| | | }) |
| | | } |
| | | } |