Commit bfda4822 authored by 前端-李俊鑫's avatar 前端-李俊鑫

fix: 修复选择地址组件校验问题

parent aafd4f4d
import { PATTERN_MAPS } from '@/constants/regExp'; import { PATTERN_MAPS } from '@/constants/regExp';
import { getManageAreaByPcode } from '@/services/ManageV2Api'; import { getManageAreaByPcode } from '@/services/ManageV2Api';
import { validatorByte } from '@/utils/regExp';
import { Cascader, Form, FormInstance, Input, Select, Switch } from 'antd'; import { Cascader, Form, FormInstance, Input, Select, Switch } from 'antd';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import AreaSet from './AreaSet'; import AreaSet from './AreaSet';
...@@ -114,7 +115,8 @@ function AddressForm(props: addrFormProps) { ...@@ -114,7 +115,8 @@ function AddressForm(props: addrFormProps) {
</FormItem> </FormItem>
<FormItem label={title.label} name={title.name} rules={[ <FormItem label={title.label} name={title.name} rules={[
{ required: true } { required: true, message: `${title.label}不能为空` },
{ validator: (rule, value, callback) => validatorByte(rule, value, callback, 40) }
]}> ]}>
<Input maxLength={40} /> <Input maxLength={40} />
</FormItem> </FormItem>
...@@ -149,13 +151,14 @@ function AddressForm(props: addrFormProps) { ...@@ -149,13 +151,14 @@ function AddressForm(props: addrFormProps) {
</div> </div>
<FormItem label="收货地址详情" name="address" rules={[ <FormItem label="收货地址详情" name="address" rules={[
{ required: true, message: "收货地址详情不能为空" } { required: true, message: "收货地址详情不能为空" },
{ validator: (rule, value, callback) => validatorByte(rule, value, callback, 60) }
]}> ]}>
<Input maxLength={60} /> <Input maxLength={60} />
</FormItem> </FormItem>
<div className='mt-16'> <div className='mt-16'>
<div className='text-gray-400'>法人手机号 <span className='text-red-500' style={{ fontFamily: "SimSun, sans-serif" }}>*</span></div> <div className='text-gray-400'>手机号 <span className='text-red-500' style={{ fontFamily: "SimSun, sans-serif" }}>*</span></div>
<div className='flex gap-5 mt-5'> <div className='flex gap-5 mt-5'>
<FormItem className='flex-1 w-17' name="areaCode" rules={[ <FormItem className='flex-1 w-17' name="areaCode" rules={[
{ required: true, message: "手机区域不能为空" } { required: true, message: "手机区域不能为空" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment