|  | @@ -1,7 +1,6 @@
 | 
	
		
			
				|  |  | -import New1Radio from "@/pages/launchSystemV3/components/New1Radio"
 | 
	
		
			
				|  |  |  import TextAideInput from "@/pages/launchSystemV3/components/TextAideInput"
 | 
	
		
			
				|  |  |  import { txtLength } from "@/utils/utils"
 | 
	
		
			
				|  |  | -import { Button, Card, Form, Modal, Popconfirm, Space, message } from "antd"
 | 
	
		
			
				|  |  | +import { Button, Card, Form, Modal, Popconfirm, Radio, Space, message } from "antd"
 | 
	
		
			
				|  |  |  import React, { useEffect, useState } from "react"
 | 
	
		
			
				|  |  |  import { TextTypeList } from "../../const"
 | 
	
		
			
				|  |  |  import { DeleteOutlined, PlusOutlined } from "@ant-design/icons"
 | 
	
	
		
			
				|  | @@ -10,6 +9,7 @@ import { DeleteOutlined, PlusOutlined } from "@ant-design/icons"
 | 
	
		
			
				|  |  |  interface Props {
 | 
	
		
			
				|  |  |      textData: any,
 | 
	
		
			
				|  |  |      dynamicMaterialDTos: any,
 | 
	
		
			
				|  |  | +    mediaType: 0 | 1 | 2,
 | 
	
		
			
				|  |  |      value?: any,
 | 
	
		
			
				|  |  |      visible?: boolean
 | 
	
		
			
				|  |  |      onClose?: () => void
 | 
	
	
		
			
				|  | @@ -21,7 +21,7 @@ interface Props {
 | 
	
		
			
				|  |  |   * @param param0 
 | 
	
		
			
				|  |  |   * @returns 
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  | -const NewText: React.FC<Props> = ({ visible, onClose, onChange, value, textData, dynamicMaterialDTos }) => {
 | 
	
		
			
				|  |  | +const NewText: React.FC<Props> = ({ visible, onClose, onChange, value, textData, dynamicMaterialDTos, mediaType }) => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /*************************************/
 | 
	
		
			
				|  |  |      const [form] = Form.useForm();
 | 
	
	
		
			
				|  | @@ -47,7 +47,6 @@ const NewText: React.FC<Props> = ({ visible, onClose, onChange, value, textData,
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      useEffect(() => {
 | 
	
		
			
				|  |  | -        console.log('创意文案--->', value)
 | 
	
		
			
				|  |  |          if (value && Object.keys(value).length) {
 | 
	
		
			
				|  |  |              const { type, dynamicCreativesTextDetailDTOList } = value
 | 
	
		
			
				|  |  |              form.setFieldsValue({
 | 
	
	
		
			
				|  | @@ -86,7 +85,7 @@ const NewText: React.FC<Props> = ({ visible, onClose, onChange, value, textData,
 | 
	
		
			
				|  |  |              form={form}
 | 
	
		
			
				|  |  |              name="newText"
 | 
	
		
			
				|  |  |              labelAlign='left'
 | 
	
		
			
				|  |  | -            labelCol={{ span: 5 }}
 | 
	
		
			
				|  |  | +            layout="vertical"
 | 
	
		
			
				|  |  |              colon={false}
 | 
	
		
			
				|  |  |              style={{ backgroundColor: '#f1f4fc', maxHeight: 650, overflow: 'hidden', overflowY: 'auto', padding: '0 10px 10px', borderRadius: '0 0 8px 8px' }}
 | 
	
		
			
				|  |  |              scrollToFirstError={{
 | 
	
	
		
			
				|  | @@ -104,28 +103,28 @@ const NewText: React.FC<Props> = ({ visible, onClose, onChange, value, textData,
 | 
	
		
			
				|  |  |          >
 | 
	
		
			
				|  |  |              <Card className="cardResetCss" style={{ marginTop: 10 }}>
 | 
	
		
			
				|  |  |                  <Form.Item name="type" label={<strong>文案分配规则</strong>} style={{ marginBottom: 0 }} rules={[{ required: true, message: '请选择文案分配规则!' }]}>
 | 
	
		
			
				|  |  | -                    <New1Radio
 | 
	
		
			
				|  |  | -                        data={TextTypeList}
 | 
	
		
			
				|  |  | -                        onChange={(value) => {
 | 
	
		
			
				|  |  | -                            let count = dynamicMaterialDTos.dynamicGroup.length
 | 
	
		
			
				|  |  | -                            let oldtextDto: PULLIN.TextDtoProps[] = JSON.parse(JSON.stringify(textDto))
 | 
	
		
			
				|  |  | -                            let length = oldtextDto.length
 | 
	
		
			
				|  |  | -                            if (value === 0) {
 | 
	
		
			
				|  |  | -                                oldtextDto = [textDto[0] || {}]
 | 
	
		
			
				|  |  | -                            } else if (value === 1) {
 | 
	
		
			
				|  |  | -                                if (count > length) {
 | 
	
		
			
				|  |  | -                                    oldtextDto = oldtextDto.concat(Array(count - length).fill({}))
 | 
	
		
			
				|  |  | -                                } else {
 | 
	
		
			
				|  |  | -                                    oldtextDto = oldtextDto.slice(0, count)
 | 
	
		
			
				|  |  | -                                }
 | 
	
		
			
				|  |  | -                            } else if (value === 2) {
 | 
	
		
			
				|  |  | -                                if (count < length) {
 | 
	
		
			
				|  |  | -                                    oldtextDto = oldtextDto.slice(0, count)
 | 
	
		
			
				|  |  | -                                }
 | 
	
		
			
				|  |  | +                    <Radio.Group onChange={(e) => {
 | 
	
		
			
				|  |  | +                        let value = e.target.value
 | 
	
		
			
				|  |  | +                        let count = dynamicMaterialDTos.dynamicGroup.length
 | 
	
		
			
				|  |  | +                        let oldtextDto: PULLIN.TextDtoProps[] = JSON.parse(JSON.stringify(textDto))
 | 
	
		
			
				|  |  | +                        let length = oldtextDto.length
 | 
	
		
			
				|  |  | +                        if (value === 0) {
 | 
	
		
			
				|  |  | +                            oldtextDto = [textDto[0] || {}]
 | 
	
		
			
				|  |  | +                        } else if (value === 1) {
 | 
	
		
			
				|  |  | +                            if (count > length) {
 | 
	
		
			
				|  |  | +                                oldtextDto = oldtextDto.concat(Array(count - length).fill({}))
 | 
	
		
			
				|  |  | +                            } else {
 | 
	
		
			
				|  |  | +                                oldtextDto = oldtextDto.slice(0, count)
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  | -                            form.setFieldsValue({ textDto: oldtextDto })
 | 
	
		
			
				|  |  | -                        }}
 | 
	
		
			
				|  |  | -                    />
 | 
	
		
			
				|  |  | +                        } else if (value === 2) {
 | 
	
		
			
				|  |  | +                            if (count < length) {
 | 
	
		
			
				|  |  | +                                oldtextDto = oldtextDto.slice(0, count)
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        form.setFieldsValue({ textDto: oldtextDto })
 | 
	
		
			
				|  |  | +                    }}>
 | 
	
		
			
				|  |  | +                        {TextTypeList.filter(item => mediaType !== 1 ? item.value !== 4 : true).map(item => <Radio value={item.value} key={item.value}>{item.label}</Radio>)}
 | 
	
		
			
				|  |  | +                    </Radio.Group>
 | 
	
		
			
				|  |  |                  </Form.Item>
 | 
	
		
			
				|  |  |              </Card>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -137,7 +136,7 @@ const NewText: React.FC<Props> = ({ visible, onClose, onChange, value, textData,
 | 
	
		
			
				|  |  |                              className="cardResetCss"
 | 
	
		
			
				|  |  |                              style={{ marginTop: 10, width: '100%' }}
 | 
	
		
			
				|  |  |                              key={key}
 | 
	
		
			
				|  |  | -                            extra={([3, 2].includes(type) && textDto?.length > 1) && <Popconfirm
 | 
	
		
			
				|  |  | +                            extra={([3, 2, 4].includes(type) && textDto?.length > 1) && <Popconfirm
 | 
	
		
			
				|  |  |                                  title="你确定删除当前文案组?"
 | 
	
		
			
				|  |  |                                  onConfirm={() => remove(name)}
 | 
	
		
			
				|  |  |                              >
 | 
	
	
		
			
				|  | @@ -165,13 +164,13 @@ const NewText: React.FC<Props> = ({ visible, onClose, onChange, value, textData,
 | 
	
		
			
				|  |  |                                              }
 | 
	
		
			
				|  |  |                                          }]}
 | 
	
		
			
				|  |  |                                      >
 | 
	
		
			
				|  |  | -                                        <TextAideInput placeholder={'请输入' + item.label} style={{ width: 450 }} maxTextLength={item.restriction.textRestriction.maxLength} />
 | 
	
		
			
				|  |  | +                                        <TextAideInput placeholder={'请输入' + item.label} style={{ width: 580 }} maxTextLength={item.restriction.textRestriction.maxLength} />
 | 
	
		
			
				|  |  |                                      </Form.Item>
 | 
	
		
			
				|  |  |                                  })}
 | 
	
		
			
				|  |  |                              </div>
 | 
	
		
			
				|  |  |                          </Card>
 | 
	
		
			
				|  |  |                      ))}
 | 
	
		
			
				|  |  | -                    {[3, 2].includes(type) && !(type === 2 && textDto.length >= dynamicMaterialDTos.dynamicGroup.length) && <Form.Item style={{ marginTop: 10, marginBottom: 0 }}>
 | 
	
		
			
				|  |  | +                    {[3, 2, 4].includes(type) && !(type === 2 && textDto.length >= dynamicMaterialDTos.dynamicGroup.length) && <Form.Item style={{ marginTop: 10, marginBottom: 0 }}>
 | 
	
		
			
				|  |  |                          <Button type="dashed" onClick={() => add({})} block icon={<PlusOutlined />} disabled={type === 3 && textDto.length >= 30}>
 | 
	
		
			
				|  |  |                              新增
 | 
	
		
			
				|  |  |                          </Button>
 |