From d4d0284a339dde475b5e7c4b3a82a22637b6f4fa Mon Sep 17 00:00:00 2001
From: lrw <18279117177@163.com>
Date: Sun, 16 Feb 2020 11:40:24 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E3=80=81=E8=BA=AB=E4=BB=BD?=
=?UTF-8?q?=E8=AF=81=20=E6=A3=80=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/fillIn/fillIn.vue | 32 +++++++++++++++++++++++++++++++-
pages/fillInDay/fillInDay.vue | 1 +
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/pages/fillIn/fillIn.vue b/pages/fillIn/fillIn.vue
index c815e90..edbedd8 100644
--- a/pages/fillIn/fillIn.vue
+++ b/pages/fillIn/fillIn.vue
@@ -74,7 +74,7 @@
*
{{index+1}}、{{item.label}}
+ @input="updateInputVal($event,item.value)" @blur="inputBlur($event,item)">
@@ -488,6 +488,7 @@
titleClass: 'title',
placeholder: '请输入联系方式',
type: 'input',
+ validator:validate.isPhone
},
{
label: '国籍',
@@ -1314,6 +1315,8 @@
titleClass: 'title',
placeholder: '请输入身份证号/护照号',
type: 'input',
+ validator:validate.isIdCard
+
},
{
label: '户籍地址',
@@ -2063,6 +2066,17 @@
updateInputVal(event, props) {
this.form[props] = event.target.value
},
+ // 输入框失去焦点
+ inputBlur(e,item) {
+ const val = e.detail.value
+ if(item.validator && !item.validator(val)) {
+ uni.showToast({
+ icon: 'none',
+ title: `${item.label }填写错误`
+ })
+ }
+ },
+
// 更新下拉框绑定的表单内容
updatePickerVal(event, item) {
const opts = item.opts
@@ -2087,6 +2101,13 @@
formSubmit() {
let flag = true
let msg = ''
+ if(this.form.agree != 1) {
+ uni.showToast({
+ icon: 'none',
+ title: `请勾选知情同意书`
+ })
+ return
+ }
for (let i = 0; i < this.list.length; i++) {
if (this.list[i].required) {
const val = this.form[this.list[i].value]
@@ -2098,6 +2119,14 @@
})
break
}
+ if(this.list[i].validator && !this.list[i].validator(val)) {
+ flag = false
+ uni.showToast({
+ icon: 'none',
+ title: `第${i+1}项${this.list[i].label }填写错误`
+ })
+ break
+ }
if (!flag) {
break
}
@@ -2113,6 +2142,7 @@
uni.navigateBack()
uni.showToast({
icon: 'success',
+ title:'提交成功'
})
} else {
uni.showToast({
diff --git a/pages/fillInDay/fillInDay.vue b/pages/fillInDay/fillInDay.vue
index 783ddb7..beb5f12 100644
--- a/pages/fillInDay/fillInDay.vue
+++ b/pages/fillInDay/fillInDay.vue
@@ -820,6 +820,7 @@
uni.navigateBack()
uni.showToast({
icon: 'success',
+ title:'提交成功'
})
} else {
uni.showToast({
--
2.22.0