张延森 před 3 roky
rodič
revize
71742ffb54

+ 4
- 14
src/pages/org/org/Edit/components/BasicPage.jsx Zobrazit soubor

1
 import { Form, Input, Button } from 'antd';
1
 import { Form, Input, Button } from 'antd';
2
-import QRCode from '@/components/QRCode'
2
+import QRCode from './QRCode'
3
 import React, { useEffect, useState, useCallback, useRef, useMemo } from 'react'
3
 import React, { useEffect, useState, useCallback, useRef, useMemo } from 'react'
4
 import { useModel } from 'umi'
4
 import { useModel } from 'umi'
5
 import { getDetail, saveOrg, updateOrg } from '@/services/org';
5
 import { getDetail, saveOrg, updateOrg } from '@/services/org';
12
   const [form] = Form.useForm();
12
   const [form] = Form.useForm();
13
   const [formData, setFormData] = useState()
13
   const [formData, setFormData] = useState()
14
   const [loading, setLoading] = useState(false)
14
   const [loading, setLoading] = useState(false)
15
-  const qrcodeRef = useRef()
15
+
16
   const qrcodeText = useMemo(() => initialState.report_url + '#resume-work-form?org=' + id, [id, initialState.report_url])
16
   const qrcodeText = useMemo(() => initialState.report_url + '#resume-work-form?org=' + id, [id, initialState.report_url])
17
-  const downloadQrcode = useCallback(() => {
18
-    if (qrcodeRef.current) {
19
-      qrcodeRef.current.download();
20
-    }
21
-  }, [])
22
 
17
 
23
   const onFinish = (values) => {
18
   const onFinish = (values) => {
24
     setLoading(true)
19
     setLoading(true)
76
           <Input type='number' min='0' />
71
           <Input type='number' min='0' />
77
         </Form.Item>
72
         </Form.Item>
78
         {
73
         {
79
-          id && <Form.Item label=' ' colon={false} wrapperCol={{ offset: 3 }}>
80
-            <QRCode ref={qrcodeRef} border width={200} content={qrcodeText} title={formData?.orgName} fileName={formData?.orgName} />
74
+          id && <Form.Item label='申报二维码' >
75
+            <QRCode text={qrcodeText} title={formData?.orgName} />
81
           </Form.Item>
76
           </Form.Item>
82
         }
77
         }
83
         <Form.Item label=' ' colon={false} >
78
         <Form.Item label=' ' colon={false} >
84
           <Button type="primary" htmlType="submit" loading={loading}>
79
           <Button type="primary" htmlType="submit" loading={loading}>
85
             保存
80
             保存
86
           </Button>
81
           </Button>
87
-          {id &&
88
-            <Button style={{ marginLeft: '32px' }} onClick={downloadQrcode} >
89
-              下载二维码
90
-            </Button>
91
-          }
92
           <Button style={{ marginLeft: '32px' }} onClick={() => { history.go(-1); }} >返回</Button>
82
           <Button style={{ marginLeft: '32px' }} onClick={() => { history.go(-1); }} >返回</Button>
93
         </Form.Item>
83
         </Form.Item>
94
       </Form>
84
       </Form>

src/pages/org/org/components/QRCode.jsx → src/pages/org/org/Edit/components/QRCode.jsx Zobrazit soubor

35
       <Popover content={content} placement="right">
35
       <Popover content={content} placement="right">
36
         <QrcodeOutlined style={{ fontSize: '32px' }} />
36
         <QrcodeOutlined style={{ fontSize: '32px' }} />
37
       </Popover>
37
       </Popover>
38
-      <Button style={{ marginLeft: '16px' }} onClick={download}>下载</Button>
38
+      <Button style={{ marginLeft: '16px' }} onClick={download} type='link'>下载</Button>
39
     </div>
39
     </div>
40
   )
40
   )
41
 }
41
 }