cfel-base-components 2.5.23 → 2.5.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cfel-base-components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.25",
|
|
4
4
|
"description": "cfel-base-components",
|
|
5
5
|
"main": "/src/index.tsx",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"antd": "^5.5.2"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"dayjs": "^1.11.9"
|
|
55
|
+
"dayjs": "^1.11.9",
|
|
56
|
+
"html2canvas": "^1.4.1"
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -193,7 +193,7 @@ export default function Index({
|
|
|
193
193
|
name={key}
|
|
194
194
|
rules={[
|
|
195
195
|
{ required: required, message: '请输入' },
|
|
196
|
-
{ pattern:
|
|
196
|
+
{ pattern: /^1[0-9]{10}$/, message: '请输入正确的电话号码' }
|
|
197
197
|
]}
|
|
198
198
|
>
|
|
199
199
|
<Input placeholder='请输入' />
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import QRCode from 'qrcode.react'
|
|
3
|
+
|
|
4
|
+
import { Button, Modal, Form, Input } from 'antd'
|
|
5
|
+
import dayjs from 'dayjs'
|
|
6
|
+
import html2canvas from 'html2canvas'
|
|
7
|
+
|
|
8
|
+
export default function Index({
|
|
9
|
+
ModalOpen, //弹框状态
|
|
10
|
+
editOpenStatus, //关闭弹框
|
|
11
|
+
editingData //编辑数据
|
|
12
|
+
}: any) {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!ModalOpen) return
|
|
15
|
+
}, [ModalOpen])
|
|
16
|
+
|
|
17
|
+
const closeModel = () => {
|
|
18
|
+
editOpenStatus(false)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const qrcodeFunc = () => {
|
|
22
|
+
const { tenant, productCode } = (window as any)?.g_config
|
|
23
|
+
let ts = dayjs(dayjs().format()).valueOf()
|
|
24
|
+
return `${location?.origin}/h5/sub-registry?tenantId=${tenant?.id}&roleCode=${editingData?.roleCode}&productCode=${productCode}&expire=${ts}`
|
|
25
|
+
}
|
|
26
|
+
const onDownload = () => {
|
|
27
|
+
let img: any = document.getElementById('down')
|
|
28
|
+
html2canvas(img).then(canvas => {
|
|
29
|
+
const link = document.createElement('a')
|
|
30
|
+
link.href = canvas.toDataURL()
|
|
31
|
+
link.setAttribute('download', `${editingData?.roleName}邀请码.png`)
|
|
32
|
+
link.style.display = 'none'
|
|
33
|
+
document.body.appendChild(link)
|
|
34
|
+
link.click()
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Modal
|
|
40
|
+
title={''}
|
|
41
|
+
destroyOnClose={true}
|
|
42
|
+
open={ModalOpen}
|
|
43
|
+
width={450}
|
|
44
|
+
onCancel={() => {
|
|
45
|
+
closeModel()
|
|
46
|
+
}}
|
|
47
|
+
footer={null}
|
|
48
|
+
>
|
|
49
|
+
<div
|
|
50
|
+
id='down'
|
|
51
|
+
style={{
|
|
52
|
+
width: '400px',
|
|
53
|
+
textAlign: 'center'
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
style={{
|
|
58
|
+
fontSize: '20px',
|
|
59
|
+
marginBottom: '10px'
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{editingData?.roleName}邀请码
|
|
63
|
+
</div>
|
|
64
|
+
<div>
|
|
65
|
+
<QRCode value={qrcodeFunc()} size={200} />
|
|
66
|
+
</div>
|
|
67
|
+
<div>
|
|
68
|
+
有效期截止:
|
|
69
|
+
{dayjs(dayjs().format()).add(7, 'day').format('YYYY-MM-DD HH:mm:ss')}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
<div style={{ textAlign: 'center', marginTop: '10px' }}>
|
|
73
|
+
<Button
|
|
74
|
+
key='submit'
|
|
75
|
+
type='primary'
|
|
76
|
+
onClick={() => {
|
|
77
|
+
onDownload()
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
下载
|
|
81
|
+
</Button>
|
|
82
|
+
</div>
|
|
83
|
+
</Modal>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
@@ -5,8 +5,8 @@ import QueryFilter from '../../base-component/QueryFilter';
|
|
|
5
5
|
import ProTable from '../../base-component/ProTable';
|
|
6
6
|
import Pagination from '../../base-component/Pagination';
|
|
7
7
|
import useTableHooks from "../../../hooks/useTableHooks"
|
|
8
|
-
|
|
9
8
|
import { timeFormatter, getUrlParams } from '../../../utils';
|
|
9
|
+
|
|
10
10
|
import { get } from 'lodash'
|
|
11
11
|
import { Space, Button, message, Modal, Popover } from 'antd'
|
|
12
12
|
import { pageRequest, create, remove, update } from './api'
|
|
@@ -14,6 +14,7 @@ import { pageRequest, create, remove, update } from './api'
|
|
|
14
14
|
import { ProFormText } from '@ant-design/pro-components'
|
|
15
15
|
|
|
16
16
|
import AddModal from './AddModal'
|
|
17
|
+
import QrCodeModal from './QrCodeModal'
|
|
17
18
|
import './index.scss'
|
|
18
19
|
export interface RoleProps {
|
|
19
20
|
historyAction: any
|
|
@@ -23,6 +24,9 @@ export default function Role({ historyAction }: RoleProps) {
|
|
|
23
24
|
|
|
24
25
|
const [ModalOpen, setModalOpen] = useState(false)
|
|
25
26
|
const [editingData, setEditingData] = useState(null) //编辑数据
|
|
27
|
+
const [qrCodeModalOpen, setQrCodeModalOpen] = useState(false)
|
|
28
|
+
const [qrCodeModalData, setQrCodeModalData] = useState(null)
|
|
29
|
+
|
|
26
30
|
useEffect(() => {
|
|
27
31
|
init()
|
|
28
32
|
execute()
|
|
@@ -133,6 +137,14 @@ export default function Role({ historyAction }: RoleProps) {
|
|
|
133
137
|
>
|
|
134
138
|
配置
|
|
135
139
|
</a>
|
|
140
|
+
<a
|
|
141
|
+
onClick={() => {
|
|
142
|
+
setQrCodeModalOpen(true)
|
|
143
|
+
setQrCodeModalData(rowdata)
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
邀请码
|
|
147
|
+
</a>
|
|
136
148
|
{rowdata.source !== 'system' && (
|
|
137
149
|
<a
|
|
138
150
|
onClick={() => {
|
|
@@ -250,6 +262,14 @@ export default function Role({ historyAction }: RoleProps) {
|
|
|
250
262
|
editingData={editingData} //当前数据
|
|
251
263
|
actionFunc={actionFunc} //事件
|
|
252
264
|
/>
|
|
265
|
+
<QrCodeModal
|
|
266
|
+
ModalOpen={qrCodeModalOpen}
|
|
267
|
+
editOpenStatus={(type: boolean) => {
|
|
268
|
+
setQrCodeModalOpen(type)
|
|
269
|
+
setQrCodeModalData(null)
|
|
270
|
+
}}
|
|
271
|
+
editingData={qrCodeModalData} //当前数据
|
|
272
|
+
/>
|
|
253
273
|
</PageContainer>
|
|
254
274
|
)
|
|
255
275
|
}
|