Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
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
shenshaokai
jinfa-platform
Commits
b39ed901
Commit
b39ed901
authored
Mar 29, 2022
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2-220218' of…
Merge branch 'v2-220218' of
https://gitlab.shushangyun.com/linkseeks-design/pro-platform
into fix0218
parents
d5751282
00c824d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
index.tsx
src/pages/systemSetting/key/index.tsx
+80
-0
No files found.
src/pages/systemSetting/key/index.tsx
0 → 100644
View file @
b39ed901
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Card
,
Row
,
Col
,
Button
,
Typography
}
from
'antd'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
getManageSecretKeyGetSecretKey
}
from
'@/services/ManageV2Api'
;
import
{
useIntl
}
from
'umi'
const
Key
=
()
=>
{
const
intl
=
useIntl
();
const
[
key
,
setKey
]
=
useState
<
string
>
(
''
);
const
[
fmt
,
setFmt
]
=
useState
<
string
>
(
''
);
const
countTime
=
()
=>
{
//获取当前时间
const
date
=
new
Date
();
const
now
=
date
.
getTime
();
//设置截止时间
const
end
=
sessionStorage
.
getItem
(
'time'
)
&&
Number
(
sessionStorage
.
getItem
(
'time'
));
//时间差
const
leftTime
=
end
-
now
;
//定义变量 d,h,m,s保存倒计时的时间
let
d
,
h
,
m
,
s
;
if
(
leftTime
>=
0
)
{
d
=
Math
.
floor
(
leftTime
/
1000
/
60
/
60
/
24
);
h
=
Math
.
floor
(
leftTime
/
1000
/
60
/
60
%
24
);
m
=
Math
.
floor
(
leftTime
/
1000
/
60
%
60
);
s
=
Math
.
floor
(
leftTime
/
1000
%
60
);
}
//递归每秒调用countTime方法,显示动态时间效果
setFmt
(
`
${
d
}${
intl
.
formatMessage
({
id
:
'contract.tian'
})}${
h
}${
intl
.
formatMessage
({
id
:
'selfManagement.hours'
})}${
m
}${
intl
.
formatMessage
({
id
:
'member.components.MemberInvestigateInfo.score.unit'
})}${
s
}${
intl
.
formatMessage
({
id
:
'detail.purchase.second'
})}
`
);
setTimeout
(
countTime
,
1000
);
}
const
getSecretKey
=
async
()
=>
{
await
getManageSecretKeyGetSecretKey
().
then
((
res
:
any
)
=>
{
if
(
res
.
code
!==
1000
)
{
return
}
const
{
data
}
=
res
;
setKey
(
data
.
secretKey
);
sessionStorage
.
setItem
(
'time'
,
data
.
effectiveTime
)
})
}
useEffect
(()
=>
{
getSecretKey
();
countTime
()
},
[])
return
(
<
PageHeaderWrapper
>
<
Card
>
<
Row
>
<
Col
span=
{
24
}
style=
{
{
margin
:
'10px'
}
}
>
<
Typography
.
Text
style=
{
{
display
:
'flex'
,
alignItems
:
'center'
}
}
>
{
intl
.
formatMessage
({
id
:
'systemSetting.key.decryptionKey'
})
}
:
<
Typography
.
Paragraph
style=
{
{
marginBottom
:
'0'
,
marginLeft
:
'24px'
}
}
strong
copyable=
{
{
icon
:
[<
Button
style=
{
{
marginLeft
:
'24px'
}
}
>
{
intl
.
formatMessage
({
id
:
'systemSetting.key.copyKey'
})
}
</
Button
>,
<
Button
style=
{
{
marginLeft
:
'24px'
}
}
type=
'primary'
>
{
intl
.
formatMessage
({
id
:
'systemSetting.key.copyKey'
})
}
</
Button
>]
}
}
>
{
key
}
</
Typography
.
Paragraph
>
</
Typography
.
Text
>
</
Col
>
<
Col
span=
{
24
}
style=
{
{
margin
:
'10px'
}
}
>
<
Typography
.
Text
>
{
`${intl.formatMessage({ id: 'systemSetting.key.keyUsefulTime' })}:${fmt}`
}
</
Typography
.
Text
>
</
Col
>
<
Col
span=
{
24
}
style=
{
{
margin
:
'10px'
}
}
>
<
Typography
.
Text
>
{
intl
.
formatMessage
({
id
:
'systemSetting.key.resettingKey'
})
}
</
Typography
.
Text
>
</
Col
>
</
Row
>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
Key
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