system-copyright-react/src/route/TrademarkMall/components/EditOne/EditOne.tsx

256 lines
6.5 KiB
TypeScript
Raw Normal View History

2025-06-04 09:25:40 +08:00
import { useState } from 'react'
import { Button, Radio, Form, Input } from 'antd'
import './EditOne.css'
const { TextArea } = Input;
export default function EditOne(props: any) {
2025-06-04 10:23:27 +08:00
const [formA] = Form.useForm<any>(); // 文字商标表单
const [formB] = Form.useForm<any>(); // 图形商标表单
2025-06-04 09:25:40 +08:00
const height = window.innerHeight - 350;
const [goodsType, setGoodsType] = useState('a')
const handleSubmit = () => {
// console.log(form);
// props.setEditProcess(2);
// 调用表单实例的 submit 方法
2025-06-04 10:23:27 +08:00
if (goodsType === 'a') {
formA.submit();
} else if (goodsType === 'b') {
formB.submit();
} else {
// 表单不显示时,直接更新步骤
props.setEditProcess(2);
}
2025-06-04 09:25:40 +08:00
};
2025-06-04 10:23:27 +08:00
const onFinishA = (values: any) => {
console.log(values);
props.setEditProcess(2);
}
const onFinishB = (values: any) => {
2025-06-04 09:25:40 +08:00
console.log(values);
props.setEditProcess(2);
}
const onChange = (e: any) => {
setGoodsType(e.target.value)
};
return (
<div className='editOneBox'>
<div className='topLine'></div>
<div className='' style={{
height: height,
// background: 'pink',
padding: '10px',
boxSizing: 'border-box',
}}>
2025-06-04 10:52:03 +08:00
<div>
</div>
2025-06-04 09:25:40 +08:00
<div className='editFormTitle'>
</div>
<div className='editFormItem firstItem'>
<div className='editFormItemTitle'>
<span className='redTitle'>*</span>
</div>
<div style={{
marginLeft: '2px',
}}>
<Radio.Group onChange={onChange} value={goodsType}>
<Radio.Button value="a"></Radio.Button>
<Radio.Button value="b"></Radio.Button>
<Radio.Button value="c"></Radio.Button>
</Radio.Group>
</div>
<a style={{
marginLeft: '10px',
cursor: 'pointer',
}}>?</a>
</div>
<div style={{
display: goodsType === 'a' ? 'unset' : 'none',
}}>
<Form
2025-06-04 10:23:27 +08:00
name="FormA"
form={formA}
onFinish={onFinishA}
2025-06-04 09:25:40 +08:00
initialValues={{ softWare: '' }}
style={{ marginTop: 20 }}
>
<div className='editFormItem '>
<div className='editFormItemTitle'>
<span className='redTitle' >*</span>
</div>
<Form.Item
name="title"
rules={[{ required: true, message: '请输入商标名称!' }]}
>
<Input style={{
width: 600,
height: 46,
background: '#FFF',
color: 'black'
}}
placeholder="商标名称"
>
</Input>
</Form.Item>
</div>
<div className='editFormItem' style={{
marginTop: '20px',
}}>
<div className='editFormItemTitle'>
<span className='redTitle'>*</span>
</div>
<Form.Item
name="text"
rules={[{ required: true, message: '请输入商标说明' }]}
>
<TextArea style={{
width: 600,
height: 150,
background: '#FFF',
color: 'black',
resize: 'none'
}}
placeholder="商标说明"
>
</TextArea>
</Form.Item>
</div>
{/* <Form.Item>
<div className='trademark-btn'>
<Button type="primary" htmlType="submit" style={{
width: 273,
height: 52
}}
>
</Button>
</div>
</Form.Item> */}
</Form>
</div>
2025-06-04 10:23:27 +08:00
<div style={{
display: goodsType === 'b' ? 'unset' : 'none',
}}>
<Form
name="FormB"
form={formB}
onFinish={onFinishB}
initialValues={{ softWare: '' }}
style={{ marginTop: 20 }}
>
<div className='editFormItem '>
<div className='editFormItemTitle'>
<span className='redTitle' >*</span>
</div>
<Form.Item
name="titleB"
rules={[{ required: true, message: '请输入商标名称!' }]}
>
<Input style={{
width: 600,
height: 46,
background: '#FFF',
color: 'black'
}}
placeholder="商标名称"
>
</Input>
</Form.Item>
</div>
<div className='editFormItem' style={{
marginTop: '20px',
}}>
<div className='editFormItemTitle'>
<span className='redTitle'>*</span>
</div>
<Form.Item
name="textB"
rules={[{ required: true, message: '请输入商标说明' }]}
>
<TextArea style={{
width: 600,
height: 150,
background: '#FFF',
color: 'black',
resize: 'none'
}}
placeholder="商标说明"
>
</TextArea>
</Form.Item>
</div>
{/* <Form.Item>
<div className='trademark-btn'>
<Button type="primary" htmlType="submit" style={{
width: 273,
height: 52
}}
>
</Button>
</div>
</Form.Item> */}
</Form>
</div>
2025-06-04 09:25:40 +08:00
</div>
<div className='topLine'></div>
<div style={{
marginTop: '8px',
display: 'flex',
justifyContent: 'flex-end',
}}>
<Button
type='primary'
style={{
width: '100px',
height: '40px',
borderRadius: '5px',
}}
onClick={() => {
handleSubmit()
}}
></Button>
</div>
</div>
)
}