Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
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
ReactWeb5
wisdom-components
Commits
8b66ab74
Commit
8b66ab74
authored
Sep 25, 2023
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 直接token刷新
parent
c4e62b55
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
RealModel.js
...s/extend-components/EC_ConfigurationView/src/RealModel.js
+14
-1
index.js
.../extend-components/EC_ConfigurationView/src/apis/index.js
+10
-0
utils.js
...es/extend-components/EC_ConfigurationView/src/js/utils.js
+17
-0
No files found.
packages/extend-components/EC_ConfigurationView/src/RealModel.js
View file @
8b66ab74
...
...
@@ -48,6 +48,7 @@ import {
isJson
,
stationData
,
getVideoUrl
,
loginauthen
,
}
from
'./js/utils'
;
import
'./index.less'
;
...
...
@@ -101,6 +102,7 @@ const ConfigurationView = (props) => {
const
ConfigurationRef
=
useRef
();
const
DomRef
=
useRef
();
const
TwoRef
=
useRef
();
const
loginTimer
=
useRef
();
const
ConfigurationViewRef
=
useCallback
((
dom
)
=>
{
if
(
DomRef
)
DomRef
.
current
=
!!
dom
;
setDomFlag
(
!!
dom
);
...
...
@@ -893,6 +895,17 @@ const ConfigurationView = (props) => {
}
},
[
isAuModalVisible
]);
useEffect
(()
=>
{
loginauthen
();
loginTimer
.
current
=
setInterval
(()
=>
{
loginauthen
();
},
1000
*
28800
);
return
()
=>
{
clearInterval
(
loginTimer
.
current
);
loginTimer
.
current
=
null
;
};
},
[]);
/** ************************************获取画板JSON******************************* */
const
getDiagramJson
=
async
(
list
,
siteInfo
)
=>
{
const
response
=
await
getSketchPadContent
({
...
...
@@ -3144,7 +3157,7 @@ const ConfigurationView = (props) => {
// title={historyInfoParams.length ? historyInfoParams[0].sensors || '' : ''}
wrapClassName={classNames(`
$
{
prefixCls
}
-
historyInfoModal
`)}
>
<HistoryView deviceParams={historyInfoParams} />
<HistoryView deviceParams={historyInfoParams}
title={historyInfoParams.length ? historyInfoParams[0].sensors || '' : ''}
/>
</Modal>
)}
{/* 统计历史曲线 */}
...
...
packages/extend-components/EC_ConfigurationView/src/apis/index.js
View file @
8b66ab74
...
...
@@ -85,3 +85,12 @@ export function getDictionaryInfo(params) {
params
,
});
}
// 获取
export
function
authorizationToken
(
params
)
{
return
request
({
url
:
`
${
baseURI
}
/PandaCore/Identity/AuthorizationToken`
,
method
:
REQUEST_METHOD_GET
,
params
,
});
}
\ No newline at end of file
packages/extend-components/EC_ConfigurationView/src/js/utils.js
View file @
8b66ab74
import
{
authorizationToken
}
from
'../apis'
;
// 判断是否是数字
export
const
isNumber
=
(
val
)
=>
{
const
regPos
=
/^
\d
+
(\.\d
+
)?
$/
;
// 非负浮点数
...
...
@@ -159,3 +161,18 @@ export const getVideoUrl = () => {
return
hasGateWay
?
`
${
address
}
/`
:
`
${
defaultAddress
}
/`
;
};
export
const
loginauthen
=
()
=>
{
if
(
!
window
.
globalConfig
?.
hasGateWay
)
return
false
;
authorizationToken
({
loginName
:
window
.
globalConfig
.
userInfo
?.
loginName
||
''
,
type
:
'WorkNo'
,
})
.
then
((
tokenRes
)
=>
{
if
(
tokenRes
.
code
===
0
)
{
window
.
globalConfig
.
access_token
=
tokenRes
.
data
?.
access_token
??
''
;
localStorage
.
setItem
(
'access_token'
,
tokenRes
.
data
?.
access_token
??
''
);
}
})
.
catch
((
err
)
=>
{});
};
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