Selaa lähdekoodia

完善手机号验证登录

littleblue55 6 päivää sitten
vanhempi
commit
f7d3eabb18
1 muutettua tiedostoa jossa 13 lisäystä ja 21 poistoa
  1. 13 21
      pages/login/login.vue

+ 13 - 21
pages/login/login.vue

@@ -200,29 +200,20 @@
 
 				let checkUserBook = await this.checkUserBook()
 				if (!this.checkUserBook()) return;
-				// console.log(this.phoneForm)
 				uni.showLoading({
 					title: '正在登录...'
 				})
 				loginPhone(this.phoneForm).then(res => {
-					// msg("登录成功");
-					console.log(res);
+					if (res.data.token) {
+						msgSuccess("登录成功!")
+						this.useAuthStore.setAuthToken(res.data.token)
+						setTimeout(() => {
+							uni.switchTab({
+								url: "/pages/index/index"
+							})
+						}, 1000)
+					}
 				})
-				// 联调
-				// 1.登录 发送请求
-				// 2.保存 token
-				// 3.获取个人信息,保存个人新
-				msg("登录成功");
-				// setTimeout(() => {
-				// 	this.useAuthStore.setAuthToken("test")
-				// 	uni.setStorageSync("userinfo", {
-				// 		userId: "2121",
-				// 		isMember: true
-				// 	})
-				// 	uni.switchTab({
-				// 		url: "/pages/index/index"
-				// 	})
-				// }, 1000)
 
 			},
 			// 账号登录
@@ -323,13 +314,14 @@
 					phone: this.phoneForm.phone
 				});
 
-				if (codeRes && codeResdata.captchaUuid) {
+				if (codeRes && codeRes.data.captchaUuid) {
 					this.getPhoneCapt++;
-					this.phoneForm.captchaUuid = codeRes.captchaUuid
+					this.phoneForm.captchaUuid = codeRes.data.captchaUuid
+					// console.log(this.phoneForm)
 					this.closePopup();
 					this.$refs.uCode1.start()
 				}
-
+				
 				uni.hideLoading();
 			},
 			// 加载验证码图片