修改位置交互,修改代码逻辑
This commit is contained in:
@@ -8,7 +8,6 @@ Page({
|
||||
data: {
|
||||
applyForm: {
|
||||
name: '',
|
||||
idCard: '',
|
||||
phone: ''
|
||||
}
|
||||
},
|
||||
@@ -44,7 +43,7 @@ Page({
|
||||
* 提交申请
|
||||
*/
|
||||
async onSubmit() {
|
||||
const { name, idCard, phone } = this.data.applyForm;
|
||||
const { name, phone } = this.data.applyForm;
|
||||
|
||||
// 表单验证
|
||||
if (!this.validateForm()) {
|
||||
@@ -58,7 +57,7 @@ Page({
|
||||
});
|
||||
|
||||
// 调用API提交申请
|
||||
const result = await this.submitApplication({ name, idCard, phone });
|
||||
const result = await this.submitApplication({ name, phone });
|
||||
|
||||
if (result.success) {
|
||||
wx.showToast({
|
||||
@@ -115,9 +114,9 @@ Page({
|
||||
* 表单验证
|
||||
*/
|
||||
validateForm(): boolean {
|
||||
const { name, idCard, phone } = this.data.applyForm;
|
||||
const { name, phone } = this.data.applyForm;
|
||||
|
||||
if (!name || !idCard || !phone) {
|
||||
if (!name || !phone) {
|
||||
wx.showToast({
|
||||
title: '请填写完整信息',
|
||||
icon: 'none',
|
||||
@@ -126,16 +125,6 @@ Page({
|
||||
return false;
|
||||
}
|
||||
|
||||
// 身份证号验证
|
||||
if (idCard.length !== 18) {
|
||||
wx.showToast({
|
||||
title: '请输入正确的身份证号',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// 手机号验证
|
||||
if (!/^1[3-9]\d{9}$/.test(phone)) {
|
||||
wx.showToast({
|
||||
|
@@ -25,21 +25,7 @@
|
||||
<view class="apply-form-underline"></view>
|
||||
</view>
|
||||
|
||||
<!-- 身份证号输入 -->
|
||||
<view class="apply-form-group">
|
||||
<text class="apply-form-label">身份证号</text>
|
||||
<input
|
||||
class="apply-form-input"
|
||||
type="idcard"
|
||||
value="{{applyForm.idCard}}"
|
||||
data-field="idCard"
|
||||
bindinput="onApplyFormInput"
|
||||
placeholder="请输入18位身份证号码"
|
||||
placeholder-class="apply-form-placeholder"
|
||||
maxlength="18"
|
||||
/>
|
||||
<view class="apply-form-underline"></view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 手机号输入 -->
|
||||
<view class="apply-form-group">
|
||||
|
Reference in New Issue
Block a user