Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
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
CivWeb
Commits
d66d307c
Commit
d66d307c
authored
Jun 23, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 消息卡片添加其他消息跳转
parent
3da1389d
Pipeline
#53718
waiting for manual action with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
4 deletions
+39
-4
NoticeIconView.js
src/components/GlobalHeader/NoticeIconView.js
+36
-1
index.js
src/pages/system/notifications/index.js
+3
-3
No files found.
src/components/GlobalHeader/NoticeIconView.js
View file @
d66d307c
import
React
,
{
Component
}
from
'react'
;
import
{
Button
,
Form
,
Input
,
Modal
}
from
'antd'
;
import
{
Button
,
Form
,
Input
,
Modal
,
notification
}
from
'antd'
;
import
{
connect
}
from
'react-redux'
;
import
{
Notifier
,
NoticeIcon
,
FormattedMessage
}
from
'@wisdom-utils/components'
;
import
{
ERR_OK
,
MESSAGE_TYPE
,
NEW_MESSAGE
}
from
'@wisdom-utils/components/lib/AppLayout/notifier/constants'
;
...
...
@@ -240,6 +240,39 @@ class NoticeIconView extends Component {
this
.
renderSysPlatform
(
message
);
};
handlerUnknowDetail
=
message
=>
{
// 需要有跳转路径
if
(
!
message
.
webPath
)
return
notification
.
info
({
message
:
'提示'
,
duration
:
3
,
description
:
'未配置跳转路径'
});
const
parsePath
=
url
=>
{
const
[
path
,
param
=
''
]
=
url
.
split
(
'|'
);
let
params
=
param
.
split
(
'&'
).
reduce
((
pre
,
item
)
=>
{
if
(
!
item
)
return
pre
;
const
[
key
,
value
]
=
item
.
split
(
'='
);
pre
[
key
]
=
value
;
return
pre
;
},
{});
return
[
path
,
param
,
params
];
}
const
[
path
,,
params
]
=
parsePath
(
message
.
webPath
);
// 需要有widget参数
if
(
!
params
.
widget
)
return
notification
.
info
({
message
:
'提示'
,
duration
:
3
,
description
:
'未配置跳转路径'
});
// 根据widget匹配菜单
const
menu
=
(
this
.
props
.
flatMenu
||
[]).
find
(
item
=>
item
.
params
&&
item
.
params
.
widget
===
params
.
widget
);
// const menu = (this.props.flatMenu || []).find(item => item.path.indexOf(path) > -1);
let
targetMenuPath
=
menu
?
menu
.
path
.
replace
(
/^
\/
/
,
''
)
:
''
;
if
(
targetMenuPath
==
''
)
{
notification
.
info
({
message
:
'提示'
,
duration
:
3
,
description
:
'你没有跳转菜单权限,请联系管理员添加权限'
});
return
;
}
params
.
_source
=
'消息通知'
;
params
.
_target
=
message
.
webPath
;
sessionStorage
.
setItem
(
'routerParams'
,
JSON
.
stringify
(
params
));
window
.
history
.
pushState
(
params
,
''
,
`/civbase/
${
targetMenuPath
}
`
);
}
render
()
{
return
(
<>
...
...
@@ -257,6 +290,7 @@ class NoticeIconView extends Component {
emptyText
=
{
<
FormattedMessage
id
=
'component.noticeIcon.allClear'
/>
}
confirmRead
=
{
this
.
notifier
.
confirmRead
}
handlerSysDetail
=
{
this
.
handlerSysDetail
}
handlerUnknowDetail
=
{
this
.
handlerUnknowDetail
.
bind
(
this
)}
loadMore
=
{
this
.
notifier
.
loadMore
}
hasMore
=
{
this
.
notifier
.
hasMore
}
/
>
...
...
@@ -471,6 +505,7 @@ class NoticeIconView extends Component {
const
mapStateToProps
=
state
=>
({
global
:
state
.
getIn
([
'global'
,
'globalConfig'
]),
flatMenu
:
state
.
getIn
([
'global'
,
'flatMenu'
]),
});
const
mapDispatchToProps
=
dispatch
=>
({
...
...
src/pages/system/notifications/index.js
View file @
d66d307c
...
...
@@ -18,12 +18,12 @@ const findMenuPath = (flatMenu, url) => {
const
[
path
,
param
=
''
]
=
url
.
split
(
'|'
);
let
params
=
param
.
split
(
'&'
).
reduce
((
pre
,
item
)
=>
{
if
(
!
item
)
return
pre
;
const
[
key
,
value
]
=
item
.
split
(
'
&
'
);
const
[
key
,
value
]
=
item
.
split
(
'
=
'
);
pre
[
key
]
=
value
;
return
pre
;
},
{});
//
const menu = flatMenu.find(item => item.params && item.params.widget === params.widget); // 根据widget匹配菜单
const
menu
=
flatMenu
.
find
(
item
=>
item
.
path
.
indexOf
(
path
)
>
-
1
);
// 根据路径匹配菜单
const
menu
=
flatMenu
.
find
(
item
=>
item
.
params
&&
item
.
params
.
widget
===
params
.
widget
);
// 根据widget匹配菜单
//
const menu = flatMenu.find(item => item.path.indexOf(path) > -1); // 根据路径匹配菜单
return
menu
?
menu
.
path
.
replace
(
/^
\/
/
,
''
)
:
''
;
};
...
...
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