wgl 4 年之前
父节点
当前提交
c1153b9a72
共有 2 个文件被更改,包括 37 次插入22 次删除
  1. 1 1
      config/project.js
  2. 36 21
      src/projects/home/views/User/Login.vue

+ 1 - 1
config/project.js

@@ -1 +1 @@
-exports.name = 'business'
+exports.name = 'home'

+ 36 - 21
src/projects/home/views/User/Login.vue

@@ -31,10 +31,7 @@
 			</div>
 			<div class="vongi-btn vongi-login-btn">
 				<button class="mui-btn mui-btn-primary" @click="nextStep">
-					登录
-				</button>
-				<button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" @click="register">
-					申请加入
+					注册/登录
 				</button>
 			</div>
 		</div>
@@ -102,11 +99,11 @@
 				if (this.checkForm()) {
 					this.isLoading = true;
 					API_Person.findByNameAndPhone(this.subForm).then(response => {
-
-						this.personId = response;
 						this.isLoading = false;
 
+						this.personId = response;
 						this.sendMsg();
+
 					}).catch(error => {
 						this.isLoading = false;
 						mui.toast(error);
@@ -117,7 +114,8 @@
 			sendMsg() {
 				this.isLoading = true;
 				API_Common.sendMsg({
-					personId: this.personId
+					personId: this.personId,
+					telephone: this.subForm.phone,
 				}).then(response => {
 					//倒计时
 					this.msgTimeInterval();
@@ -150,22 +148,27 @@
 					API_Person.validateCode({
 						personId: this.personId,
 						verifyCode: this.verifyCode,
-						openId: this.openId
+						openId: this.openId,
+						telephone: this.subForm.phone,
 					}).then(response => {
-
-						this.set_token(response.token);
-						if (response.personInfo.faceImageUrl) {
-							//跳转到项目主页上去
-							window.location.href = '../' + this.$route.query.project + '/#/master';
+						if (response.token) {
+							this.set_token(response.token);
+							if (response.personInfo.faceImageUrl) {
+								//跳转到项目主页上去
+								window.location.href = '../' + this.$route.query.project + '/#/master';
+							} else {
+								//上传头像					
+								this.$router.push({
+									name: 'UserUploadPhoto',
+									query: {
+										personId: this.personId,
+										project: this.$route.query.project
+									}
+								})
+							}
 						} else {
-							//上传头像					
-							this.$router.push({
-								name: 'UserUploadPhoto',
-								query: {
-									personId: this.personId,
-									project: this.$route.query.project
-								}
-							})
+							//注册
+							this.confirmRegister();
 						}
 
 						this.isLoading = false;
@@ -176,6 +179,18 @@
 				}
 			},
 			//注册
+			confirmRegister() {
+				var btnArray = ['否', '是'];
+				mui.confirm('当前用户不存在,是否立即注册?', '提示', btnArray, function(e) {
+					if (e.index == 1) {
+						this.$router.push({
+							name: 'RegisterHome',
+							query: {}
+						})
+					}
+				})
+			},
+			//注册
 			register() {
 				this.$router.push({
 					name: 'RegisterHome',