From a9a71b5c1758862e7fc60976adc98e7654f7e44f Mon Sep 17 00:00:00 2001
From: wjt <1797368093@qq.com>
Date: 星期六, 22 六月 2024 19:39:20 +0800
Subject: [PATCH] 添加验证手机号的功能
---
pages/companyLogin/companyLogin.vue | 24 ++++++++++++++++++++----
pages/registerCompany/registerCompany.vue | 32 +++++++++++++++++++++++++++++++-
2 files changed, 51 insertions(+), 5 deletions(-)
diff --git a/pages/companyLogin/companyLogin.vue b/pages/companyLogin/companyLogin.vue
index 984f5aa..f008f40 100644
--- a/pages/companyLogin/companyLogin.vue
+++ b/pages/companyLogin/companyLogin.vue
@@ -107,10 +107,12 @@
title: '姝e湪鑾峰彇楠岃瘉鐮�'
})
getCode({phone: this.form.phone }).then(val => {
- this.startCountdown()
- uni.hideLoading();
- this.tips = `${this.countdownTime}s鍚庨噸鏂拌幏鍙朻
- uni.$u.toast('楠岃瘉鐮佸凡鍙戦��');
+ if(val.data.code == 200) {
+ this.startCountdown()
+ uni.hideLoading();
+ this.tips = `${this.countdownTime}s鍚庨噸鏂拌幏鍙朻
+ uni.$u.toast('楠岃瘉鐮佸凡鍙戦��');
+ }
})
} else {
uni.$u.toast('鍊掕鏃剁粨鏉熷悗鍐嶅彂閫�');
@@ -134,6 +136,20 @@
}, 1000)
},
loging() {
+ if(!this.form.phone){
+ uni.showToast({
+ title: '璇疯緭鍏ユ墜鏈哄彿',
+ icon: 'none'
+ })
+ return
+ }
+ if(!this.form.code){
+ uni.showToast({
+ title: '璇疯緭鍏ラ獙璇佺爜',
+ icon: 'none'
+ })
+ return
+ }
codeLogin(this.form).then(val => {
if(val.data.token) {
this.loginToken = val.data.token
diff --git a/pages/registerCompany/registerCompany.vue b/pages/registerCompany/registerCompany.vue
index 4f1caed..d17a0e8 100644
--- a/pages/registerCompany/registerCompany.vue
+++ b/pages/registerCompany/registerCompany.vue
@@ -167,7 +167,28 @@
},
// 鏍¢獙瀛楁
authField(){
-
+ if(!this.form.companyUser) {
+ return '璇疯緭鍏ュ鍚�'
+ }
+ if(!this.form.companyPhone) {
+ return '璇疯緭鍏ユ墜鏈哄彿'
+ }
+ if(!this.form.code){
+ return '璇疯緭鍏ラ獙璇佺爜'
+ }
+ if(!this.form.companyName) {
+ return "璇疯緭鍏ヤ紒涓氬悕绉�"
+ }
+ if(!this.form.companyCode){
+ return '璇疯緭鍏ョ粺涓�绀句細淇$敤浠g爜'
+ }
+ if(!this.form.companyAddress){
+ return "璇疯緭鍏ヤ紒涓氬湴鍧�"
+ }
+ if(!this.form.companyImg || !this.form.companyImg.length){
+ return '璇蜂笂浼犺惀涓氭墽鐓�'
+ }
+ return false
},
// 鏍¢獙code
async checkCode() {
@@ -188,9 +209,18 @@
throw "鏍¢獙澶辫触"
}
},
+
// 娉ㄥ唽鎺ュ彛
async register(){
try{
+ const value = this.authField()
+ if(value){
+ uni.showToast({
+ title: value,
+ icon: 'none'
+ })
+ return
+ }
await this.checkCode()
// this.form.companyStatus = 1
registerCompany(this.form).then(val=>{
--
Gitblit v1.9.1