|
@@ -15,6 +15,7 @@ import { creativeConfig, overrideCanvasHeadOptionEnum } from './config'
|
|
|
import BrandImage from './brandImage'
|
|
|
import HeadNickJump from './headNickJump'
|
|
|
import moment from 'moment'
|
|
|
+import { txtLength } from '@/utils/utils'
|
|
|
interface Props {
|
|
|
queryForm: Partial<CreateAdProps>,
|
|
|
title?: string,
|
|
@@ -865,7 +866,25 @@ function CreativePup(props: Props) {
|
|
|
adcreative_template?.adcreativeElements?.filter(item => item.name === 'title').map(item => {
|
|
|
return <div key={item.fieldType}>
|
|
|
<Form.Item label={<strong>{item.description}(选填)</strong>} className={'my_title'} >
|
|
|
- <Form.Item name={item.name} rules={[{ pattern: RegExp(item.restriction.textRestriction.textPattern?.replace(/\+/ig, `{1,${item.restriction.textRestriction.maxLength}}`)), message: '请输入正确的' + item.description }]} noStyle>
|
|
|
+ <Form.Item
|
|
|
+ name={item.name}
|
|
|
+ rules={[{
|
|
|
+ // pattern: RegExp(item.restriction.textRestriction.textPattern?.replace(/\+/ig, `{1,${item.restriction.textRestriction.maxLength}}`)),
|
|
|
+ required: true,
|
|
|
+ message: '请输入正确的' + item.description,
|
|
|
+ validator: (rule, value) => {
|
|
|
+ if (!value) {
|
|
|
+ return Promise.reject()
|
|
|
+ } else if (!value.match(RegExp(item.restriction.textRestriction.textPattern))) {
|
|
|
+ return Promise.reject()
|
|
|
+ } else if (txtLength(value) > item.restriction.textRestriction.maxLength) {
|
|
|
+ return Promise.reject()
|
|
|
+ }
|
|
|
+ return Promise.resolve()
|
|
|
+ }
|
|
|
+ }]}
|
|
|
+ noStyle
|
|
|
+ >
|
|
|
<Input
|
|
|
placeholder={'请输入' + item.description}
|
|
|
style={{ width: 500 }}
|
|
@@ -901,7 +920,21 @@ function CreativePup(props: Props) {
|
|
|
let maxNum = (adcreativeTemplateId === 1708 || adcreativeTemplateId === 1707) && actionBtn ? 10 : item.restriction.textRestriction.maxLength
|
|
|
return <div key={item.fieldType}>
|
|
|
<Form.Item label={<strong>{item.description}</strong>} className={'my_description'}>
|
|
|
- <Form.Item name={item.name} noStyle rules={[{ required: true, pattern: RegExp(item.restriction.textRestriction.textPattern?.replace(/\+/ig, `{1,${maxNum}}`)), message: '请输入正确的' + item.description }]}>
|
|
|
+ <Form.Item name={item.name} noStyle rules={[{
|
|
|
+ required: true,
|
|
|
+ // pattern: RegExp(item.restriction.textRestriction.textPattern?.replace(/\+/ig, `{1,${maxNum}}`)),
|
|
|
+ message: '请输入正确的' + item.description,
|
|
|
+ validator: (rule, value) => {
|
|
|
+ if (!value) {
|
|
|
+ return Promise.reject()
|
|
|
+ } else if (!value.match(RegExp(item.restriction.textRestriction.textPattern))) {
|
|
|
+ return Promise.reject()
|
|
|
+ } else if (txtLength(value) > maxNum) {
|
|
|
+ return Promise.reject()
|
|
|
+ }
|
|
|
+ return Promise.resolve()
|
|
|
+ }
|
|
|
+ }]}>
|
|
|
<Input
|
|
|
placeholder={'请输入' + item.description}
|
|
|
style={{ width: 500 }}
|
|
@@ -1044,7 +1077,21 @@ function CreativePup(props: Props) {
|
|
|
</Form.Item>
|
|
|
<div className={'my_endPageDesc'} >
|
|
|
<Form.Item label={<strong>结束文案</strong>}>
|
|
|
- <Form.Item name='endPageDesc' rules={[{ required: true, pattern: RegExp("^[^\\<\\>\\&'\\\"\\/\\x08\\x09\\x0A\\x0D\\\\]{1,12}$"), message: '请输入正确的结束页文案' }]} noStyle>
|
|
|
+ <Form.Item name='endPageDesc' rules={[{
|
|
|
+ required: true,
|
|
|
+ // pattern: RegExp("^[^\\<\\>\\&'\\\"\\/\\x08\\x09\\x0A\\x0D\\\\]{1,12}$"),
|
|
|
+ message: '请输入正确的结束页文案',
|
|
|
+ validator: (rule, value) => {
|
|
|
+ if (!value) {
|
|
|
+ return Promise.reject()
|
|
|
+ } else if (!value.match(RegExp("^[^\\<\\>\\&'\\\"\\/\\x08\\x09\\x0A\\x0D\\\\]+$"))) {
|
|
|
+ return Promise.reject()
|
|
|
+ } else if (txtLength(value) > 12) {
|
|
|
+ return Promise.reject()
|
|
|
+ }
|
|
|
+ return Promise.resolve()
|
|
|
+ }
|
|
|
+ }]} noStyle>
|
|
|
<Input
|
|
|
placeholder='请输入结束页文案'
|
|
|
style={{ width: 300 }}
|