Browse Source

处理表单提交时候的验证错误

Administrator 7 years ago
parent
commit
f8dbb3cc36

+ 11 - 11
components/mobile/registerEnterprise/index.vue

@@ -237,7 +237,7 @@
       },
       // 验证手机
       checkPhone () {
-        if (!this.state.mobile === 'success' && !this.state.token === 'success') {
+        if (this.state.mobile !== 'success' || this.state.token !== 'success') {
           this.downToast('请确认填写部分是否有误')
         } else if (this.checked === false) {
           this.downToast('您对阅读条款未做勾选')
@@ -421,11 +421,11 @@
       // 企业注册
       sureRegister () {
         if (!this.hasRegister) {
-          if (this.state.spaceName !== 'success' &&
-            this.state.businessCode !== 'success' &&
-            this.state.vipName !== 'success' &&
-            this.state.password !== 'success' &&
-            this.state.confirm !== 'success' &&
+          if (this.state.spaceName !== 'success' ||
+            this.state.businessCode !== 'success' ||
+            this.state.vipName !== 'success' ||
+            this.state.password !== 'success' ||
+            this.state.confirm !== 'success' ||
             this.state.email !== 'success') {
             this.downToast('请确认填写部分是否有误')
           } else {
@@ -433,17 +433,17 @@
           }
         } else {
           if (!this.hasEmail) {
-            if (this.state.spaceName !== 'success' &&
-              this.state.businessCode !== 'success' &&
-              this.state.password !== 'success' &&
+            if (this.state.spaceName !== 'success' ||
+              this.state.businessCode !== 'success' ||
+              this.state.password !== 'success' ||
               this.state.email !== 'success') {
               this.downToast('请确认填写部分是否有误')
             } else {
               this.sbmitRegister()
             }
           } else {
-            if (this.state.spaceName !== 'success' &&
-              this.state.businessCode !== 'success' &&
+            if (this.state.spaceName !== 'success' ||
+              this.state.businessCode !== 'success' ||
               this.state.password !== 'success') {
               this.downToast('请确认填写部分是否有误')
             } else {

+ 4 - 4
components/mobile/registerPersonal/index.vue

@@ -242,10 +242,10 @@
       },
       // 表单提交
       submit () {
-        if (this.state.vipName !== 'success' &&
-          this.state.password !== 'success' &&
-          this.state.confirm !== 'success' &&
-          this.state.mobile !== 'success' &&
+        if (this.state.vipName !== 'success' ||
+          this.state.password !== 'success' ||
+          this.state.confirm !== 'success' ||
+          this.state.mobile !== 'success' ||
           this.state.token !== 'success') {
           this.downToast('请确认填写部分是否有误')
         } else if (this.checked === false) {

+ 6 - 6
components/mobile/reset/stepAppeal.vue

@@ -301,12 +301,12 @@
           }
         },
         sureAccount (type) {
-          if (this.state.mobile !== 'success' &&
-            this.state.token !== 'success' &&
-            this.state.password !== 'success' &&
-            this.state.confirm !== 'success' &&
-            this.state.contactName !== 'success' &&
-            this.state.contactTel !== 'success' &&
+          if (this.state.mobile !== 'success' ||
+            this.state.token !== 'success' ||
+            this.state.password !== 'success' ||
+            this.state.confirm !== 'success' ||
+            this.state.contactName !== 'success' ||
+            this.state.contactTel !== 'success' ||
             this.state.contactEmail !== 'success') {
             this.downToast('请确认填写部分是否有误')
           } else {

+ 1 - 1
components/mobile/reset/stepFirst.vue

@@ -80,7 +80,7 @@
           }
         },
         sureAccount (type) {
-          if (this.state.mobile !== 'success' && this.state.captcha !== 'success') {
+          if (this.state.mobile !== 'success' || this.state.captcha !== 'success') {
             this.downToast('请确认填写部分是否有误')
           } else {
             this.$indicator.open('验证过程中...')

+ 1 - 1
components/mobile/reset/stepNew.vue

@@ -102,7 +102,7 @@
         }
       },
       sureAccount (type) {
-        if (this.state.password !== 'success' && this.state.confirm !== 'success') {
+        if (this.state.password !== 'success' || this.state.confirm !== 'success') {
           this.downToast('请确认填写部分是否有误')
         } else {
           this.$indicator.open('验证中...')

+ 1 - 1
components/mobile/reset/stepSecurity .vue

@@ -95,7 +95,7 @@
           })
       },
       sureAccount (type) {
-        if (this.state.answer1 !== 'success' && this.state.answer2 !== 'success') {
+        if (this.state.answer1 !== 'success' || this.state.answer2 !== 'success') {
           this.downToast('请确认填写部分是否有误')
         } else {
           this.$indicator.open('验证过程中...')

+ 1 - 1
middleware/authenticated.js

@@ -2,7 +2,7 @@
 export default function ({ isServer, store, req, redirect }) {
   if (isServer && !req) return
 
-  if (!store.state.option.isLogin.data.content.isLogin) {
+  if (!store.state.option.isLogin.logged) {
     return redirect('/')
   }
 }