|
@@ -1,40 +1,55 @@
|
|
|
import { Button, Card, Drawer, Form, Input } from 'antd'
|
|
|
-import React from 'react'
|
|
|
-import styles from './index.less';
|
|
|
+import React, { useState, useEffect } from 'react'
|
|
|
+import styles from './index.less'
|
|
|
|
|
|
const Popcontactform = props => {
|
|
|
-
|
|
|
+ // 浏览器实际宽度
|
|
|
+ const [clientWidth, setClientWidth] = useState(document.body.clientWidth * 0.8)
|
|
|
+ useEffect(() => {
|
|
|
+ window.addEventListener('resize', () => {
|
|
|
+ setClientWidth(document.body.clientWidth * 0.8)
|
|
|
+ })
|
|
|
+ return () => {
|
|
|
+ window.removeEventListener('resize')
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
const { visible, onClose, onCreate } = props
|
|
|
const [form] = Form.useForm()
|
|
|
return (
|
|
|
<div>
|
|
|
<div className={styles.popDrawer}>
|
|
|
- <Drawer
|
|
|
- title="联系人"
|
|
|
- placement="right"
|
|
|
- width={1000}
|
|
|
- closable={false}
|
|
|
- onClose={onClose}
|
|
|
- visible={visible}
|
|
|
- // mask={false}
|
|
|
- >
|
|
|
- {/* className={styles.formTextmuted} */}
|
|
|
- <Form layout="inline" form={form}>
|
|
|
- <Form.Item name="code" rules={[{ required: true, message: '请输入编号' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Form>
|
|
|
- <Card title="联系人" bordered={false} extra={<span>陈特 创建于 2019年5月6日 14:55</span>}>
|
|
|
- <h3>张三</h3>
|
|
|
- </Card>
|
|
|
- <Button onClick={() => {
|
|
|
- form.validateFields().then(values => {
|
|
|
- onCreate(values)
|
|
|
- }).catch(err => {
|
|
|
- console.log(err);
|
|
|
- })
|
|
|
- }}>保存</Button>
|
|
|
- </Drawer>
|
|
|
+ <Drawer
|
|
|
+ title="联系人"
|
|
|
+ placement="right"
|
|
|
+ width={clientWidth}
|
|
|
+ closable={false}
|
|
|
+ onClose={onClose}
|
|
|
+ visible={visible}
|
|
|
+ // mask={false}
|
|
|
+ >
|
|
|
+ {/* className={styles.formTextmuted} */}
|
|
|
+ <Form layout="inline" form={form}>
|
|
|
+ <Form.Item name="code" rules={[{ required: true, message: '请输入编号' }]}>
|
|
|
+ <Input />
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ <Card title="联系人" bordered={false} extra={<span>陈特 创建于 2019年5月6日 14:55</span>}>
|
|
|
+ <h3>张三</h3>
|
|
|
+ </Card>
|
|
|
+ <Button
|
|
|
+ onClick={() => {
|
|
|
+ form
|
|
|
+ .validateFields()
|
|
|
+ .then(values => {
|
|
|
+ onCreate(values)
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ }}>
|
|
|
+ 保存
|
|
|
+ </Button>
|
|
|
+ </Drawer>
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|