Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TOSTUMI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maple
TOSTUMI
Commits
78b37d55
Commit
78b37d55
authored
Nov 27, 2020
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同编辑实现在线预览
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
b692d874
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
ContractContent.tsx
src/pages/ContractManagement/ContractContent.tsx
+12
-2
string.ts
src/utils/string.ts
+13
-0
No files found.
src/pages/ContractManagement/ContractContent.tsx
View file @
78b37d55
...
...
@@ -32,7 +32,7 @@ import { tipList } from '@/utils/tip';
import
FileViewer
from
'react-file-viewer'
;
import
PDF
from
'react-pdf-js'
;
import
{
stringSplit
}
from
'@/utils/string'
;
import
{
randomString
}
from
'@/utils/string'
;
const
ContractContent
=
(
props
:
any
)
=>
{
const
{
Contract
,
dispatch
,
FileImg
,
loading
}
=
props
;
...
...
@@ -174,7 +174,17 @@ const ContractContent = (props: any) => {
}
if
(
file
.
status
==
'done'
)
{
message
.
success
(
file
.
name
+
' Upload Successful !'
);
setFileList
([...
fileList
,
file
]);
// 实现在线预览
let
obj
=
{
uid
:
randomString
(
12
),
name
:
file
.
name
,
status
:
'done'
,
type
:
file
.
name
.
match
(
/
\.([^\.]
+
)
$/
)[
1
].
toLowerCase
(),
url
:
file
.
response
.
data
,
};
setFileList
([...
fileList
,
obj
]);
// 添加到表单
form
.
setFieldsValue
({
upload
:
'ok'
,
...
...
src/utils/string.ts
View file @
78b37d55
...
...
@@ -93,3 +93,16 @@ export const stringTab = (string: any) => {
// message.error("Ower Name Should be limit 2~30!",3)
// }
// }
// 生成随机字符串
export
const
randomString
=
(
len
?:
any
)
=>
{
len
=
len
||
32
;
var
$chars
=
'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
;
/****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
var
maxPos
=
$chars
.
length
;
var
pwd
=
''
;
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
pwd
+=
$chars
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
maxPos
));
}
return
pwd
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment