| xqd
@@ -210,7 +210,6 @@
|
|
|
|
|
|
//点击登录(验证码/密码)
|
|
|
startReg: async function() {
|
|
|
- //注册
|
|
|
if (this.isRotate) {
|
|
|
//判断是否加载中,避免重复点击请求
|
|
|
return false;
|
| xqd
@@ -239,7 +238,7 @@
|
|
|
'password': this.password
|
|
|
});
|
|
|
if (res.status == 0) {
|
|
|
-
|
|
|
+
|
|
|
store.commit('setJwt', res.data.token);
|
|
|
store.commit('setUser', res.data);
|
|
|
store.commit('login');
|
| xqd
@@ -279,83 +278,62 @@
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
- if (this.verCode.length != 4) {
|
|
|
+ if (this.verCode.length == 0) {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
position: 'bottom',
|
|
|
- title: '验证码不正确'
|
|
|
+ title: '请输入验证码'
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
- let code = uni.getStorageSync('verfiyCode')
|
|
|
+ // 发送登陆
|
|
|
+ let res = await this.$request.post('common/phoneLogin', {
|
|
|
+ 'phone': this.phoneData,
|
|
|
+ 'verify': this.verCode
|
|
|
+ });
|
|
|
|
|
|
- if (code == null || code == '') {
|
|
|
+ if (res.status == 0) {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
position: 'bottom',
|
|
|
- title: '验证码错误'
|
|
|
+ title: '登陆成功'
|
|
|
});
|
|
|
+ uni.removeStorage('verfiyCode')
|
|
|
+ store.commit('setJwt', res.data.token);
|
|
|
+ store.commit('setUser', res.data);
|
|
|
+ store.commit('login');
|
|
|
+
|
|
|
+ getApp().globalData.imService = new IMService();
|
|
|
+ let loginResult = getApp().globalData.imService.login({
|
|
|
+ uuid: res.data.data.flag,
|
|
|
+ name: res.data.data.name,
|
|
|
+ avatar: res.data.data.avatar
|
|
|
+ });
|
|
|
+ if (loginResult) {
|
|
|
+ //连接IM
|
|
|
+ getApp().globalData.imService.connectIM();
|
|
|
+ }
|
|
|
+ // 写一个跳转到首页
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ uni.switchTab({
|
|
|
+ url: "../index/index"
|
|
|
+ })
|
|
|
+ }, 2000)
|
|
|
return false;
|
|
|
} else {
|
|
|
- if (this.verCode == code) {
|
|
|
- // 发送登陆
|
|
|
- let res = await this.$request.post('common/phoneLogin', {
|
|
|
- 'phone': this.phoneData
|
|
|
- });
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ position: 'bottom',
|
|
|
+ title: res.message
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- if (res.status == 0) {
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- position: 'bottom',
|
|
|
- title: '登陆成功'
|
|
|
- });
|
|
|
- uni.removeStorage('verfiyCode')
|
|
|
- store.commit('setJwt', res.data.token);
|
|
|
- store.commit('setUser', res.data);
|
|
|
- store.commit('login');
|
|
|
|
|
|
- getApp().globalData.imService = new IMService();
|
|
|
- let loginResult = getApp().globalData.imService.login({
|
|
|
- uuid: res.data.data.flag,
|
|
|
- name: res.data.data.name,
|
|
|
- avatar: res.data.data.avatar
|
|
|
- });
|
|
|
- if (loginResult) {
|
|
|
- //连接IM
|
|
|
- getApp().globalData.imService.connectIM();
|
|
|
- }
|
|
|
- // 写一个跳转到首页
|
|
|
- setTimeout(function() {
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- uni.switchTab({
|
|
|
- url: "../index/index"
|
|
|
- })
|
|
|
- }, 2000)
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- position: 'bottom',
|
|
|
- title: res.message
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- position: 'bottom',
|
|
|
- title: '验证码错误'
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|