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
a2f2fee8
Commit
a2f2fee8
authored
Nov 20, 2020
by
叶飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: notice
parent
02566d61
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
133 deletions
+44
-133
NoticeIconView.js
src/components/GlobalHeader/NoticeIconView.js
+2
-63
RightContent.js
src/components/GlobalHeader/RightContent.js
+1
-1
NoticeList.js
src/components/NoticeIcon/NoticeList.js
+2
-2
NoticeList.less
src/components/NoticeIcon/NoticeList.less
+30
-47
index.js
src/components/NoticeIcon/index.js
+2
-20
index.js
src/components/Notifier/index.js
+7
-0
No files found.
src/components/GlobalHeader/NoticeIconView.js
View file @
a2f2fee8
...
...
@@ -34,80 +34,19 @@ class NoticeIconView extends Component {
})
};
/* eslint-disable no-unused-vars */
changeReadState
=
clickedItem
=>
{};
/* eslint-disable no-unused-vars */
handleNoticeClear
=
(
title
,
key
)
=>
{};
getNoticeData
=
()
=>
{
const
{
notices
=
[]
}
=
this
.
props
;
if
(
!
notices
||
notices
.
length
===
0
||
!
Array
.
isArray
(
notices
))
{
return
{};
}
const
newNotices
=
notices
.
map
(
notice
=>
{
const
newNotice
=
{
...
notice
};
if
(
newNotice
.
datetime
)
{
newNotice
.
datetime
=
moment
(
notice
.
datetime
).
fromNow
();
}
if
(
newNotice
.
id
)
{
newNotice
.
key
=
newNotice
.
id
;
}
if
(
newNotice
.
extra
&&
newNotice
.
status
)
{
const
color
=
{
todo
:
''
,
processing
:
'blue'
,
urgent
:
'red'
,
doing
:
'gold'
,
}[
newNotice
.
status
];
newNotice
.
extra
=
(
<
Tag
color
=
{
color
}
style
=
{{
marginRight
:
0
,
}}
>
{
newNotice
.
extra
}
<
/Tag
>
);
}
return
newNotice
;
});
};
render
()
{
const
{
currentUser
,
fetchingNotices
,
onNoticeVisibleChange
}
=
this
.
props
;
const
noticeData
=
[];
//this.getNoticeData();
const
unreadMsg
=
[];
//this.getUnreadData(noticeData);
return
(
<
NoticeIcon
className
=
{
styles
.
action
}
count
=
{
this
.
state
.
count
}
onItemClick
=
{
item
=>
{
this
.
changeReadState
(
item
);
}}
loading
=
{
fetchingNotices
}
confirmRead
=
{
this
.
notifier
.
confirmRead
.
bind
(
this
.
notifier
)}
onClear
=
{
this
.
handleNoticeClear
}
onPopupVisibleChange
=
{
onNoticeVisibleChange
}
onViewMore
=
{()
=>
message
.
info
(
'Click on view more'
)}
clearClose
confirmRead
=
{
this
.
notifier
.
confirmRead
}
>
<
NoticeIcon
.
Tab
tabKey
=
"notification"
list
=
{
this
.
state
.
noticeData
}
title
=
"通知"
emptyText
=
"你已查看所有通知"
showViewMore
confirmRead
=
{
this
.
notifier
.
confirmRead
.
bind
(
this
.
notifier
)}
confirmRead
=
{
this
.
notifier
.
confirmRead
}
/
>
<
/NoticeIcon
>
);
...
...
src/components/GlobalHeader/RightContent.js
View file @
a2f2fee8
...
...
@@ -140,7 +140,7 @@ const GlobalHeaderRight = props => {
<
HomeIcon
onClick
=
{
goHome
}
/
>
<
OrderIcon
onClick
=
{
handleOrder
}
/
>
<
/div
>
<
NoticeIconView
notices
=
{[]}
/
>
<
NoticeIconView
/>
<
Avatar
menu
global
=
{
props
.
global
}
/
>
{
/* <SelectLang className={styles.action} /> */
}
<
/div
>
...
...
src/components/NoticeIcon/NoticeList.js
View file @
a2f2fee8
...
...
@@ -18,12 +18,12 @@ const Empty = ({ emptyText }) => (
<
/div
>
);
const
NoticeList
=
({
data
=
[],
onGoToWidget
,
emptyText
,
confirmRead
})
=>
{
const
NoticeList
=
({
data
=
[],
emptyText
,
confirmRead
})
=>
{
if
(
!
data
||
data
.
length
===
0
)
{
return
<
Empty
emptyText
=
{
emptyText
}
/>
;
}
return
(
<
div
>
<
div
className
=
{
styles
.
container
}
>
<
List
className
=
{
styles
.
list
}
dataSource
=
{
data
}
...
...
src/components/NoticeIcon/NoticeList.less
View file @
a2f2fee8
@import '~antd/es/style/themes/default.less';
.
list
{
.
container
{
max-height: 400px;
overflow: auto;
&::-webkit-scrollbar {
display: none;
}
.item {
overflow: hidden;
cursor: pointer;
.meta {
width: 100%;
.list {
.item {
overflow: hidden;
cursor: pointer;
.meta {
width: 100%;
}
&:hover {
background-color: @primary-1;
}
&:last-child {
border-bottom: 0;
}
}
&:hover {
background-color: @primary-1;
}
&:last-child {
border-bottom: 0;
}
}
}
.notFound {
padding: 73px 0 88px;
color: @text-color-secondary;
text-align: center;
border-radius: 0!important;
img {
display: inline-block;
height: 76px;
margin-bottom: 16px;
.notFound {
padding: 73px 0 88px;
color: @text-color-secondary;
text-align: center;
border-radius: 0 !important;
img {
display: inline-block;
height: 76px;
margin-bottom: 16px;
}
}
}
.bottomBar {
height: 46px;
color: @text-color;
line-height: 46px;
text-align: center;
border-top: 1px solid @border-color-split;
border-radius: 0 0 @border-radius-base @border-radius-base;
transition: all 0.3s;
div {
display: inline-block;
width: 50%;
cursor: pointer;
.bottomBar {
height: 46px;
color: @text-color;
line-height: 46px;
text-align: center;
transition: all 0.3s;
user-select: none;
&:only-child {
width: 100%;
}
&:not(:only-child):last-child {
border-left: 1px solid @border-color-split;
}
}
}
\ No newline at end of file
}
src/components/NoticeIcon/index.js
View file @
a2f2fee8
...
...
@@ -10,9 +10,8 @@ import Icon from '@ant-design/icons';
import
HeaderDropdown
from
'../HeaderDropdown'
;
import
styles
from
'./index.less'
;
import
NoticeList
from
'./NoticeList'
;
import
http
from
'../../api'
;
const
{
TabPane
}
=
Tabs
;
const
messageSvg
=
()
=>
(
<
svg
version
=
"1.1"
...
...
@@ -48,12 +47,7 @@ const NoticeIcon = props => {
const
getNotificationBox
=
()
=>
{
const
{
children
,
loading
,
confirmRead
,
onClear
,
onTabChange
,
onItemClick
,
onViewMore
,
}
=
props
;
if
(
!
children
)
{
return
null
;
...
...
@@ -67,24 +61,12 @@ const NoticeIcon = props => {
const
{
list
,
title
,
count
,
tabKey
,
showClear
,
showViewMore
,
}
=
child
.
props
;
const
len
=
list
&&
list
.
length
?
list
.
length
:
0
;
const
msgCount
=
count
||
count
===
0
?
count
:
len
;
const
tabTitle
=
msgCount
>
0
?
`
${
title
}
(
${
msgCount
}
)`
:
title
;
panes
.
push
(
<
NoticeList
{...
child
.
props
}
data
=
{
list
}
key
=
{
child
}
onClear
=
{()
=>
onClear
&&
onClear
(
title
,
tabKey
)}
onClick
=
{
item
=>
onItemClick
&&
onItemClick
(
item
,
child
.
props
)}
onViewMore
=
{
event
=>
onViewMore
&&
onViewMore
(
child
.
props
,
event
)}
showClear
=
{
showClear
}
showViewMore
=
{
showViewMore
}
title
=
{
title
}
/>
,
);
...
...
@@ -100,7 +82,7 @@ const NoticeIcon = props => {
);
};
const
{
className
,
count
,
bell
}
=
props
;
const
{
className
,
bell
}
=
props
;
const
[
visible
,
setVisible
]
=
useMergeValue
(
false
,
{
value
:
props
.
popupVisible
,
...
...
src/components/Notifier/index.js
View file @
a2f2fee8
...
...
@@ -53,6 +53,13 @@ class Notifier {
this
.
MQTTClient
=
null
;
this
.
MQTTOptions
=
{};
this
.
IsNeedReconnect
=
true
;
// 对外接口处理this指向问题
this
.
start
=
this
.
start
.
bind
(
this
);
this
.
stop
=
this
.
stop
.
bind
(
this
);
this
.
subscribe
=
this
.
subscribe
.
bind
(
this
);
this
.
unsubscribe
=
this
.
unsubscribe
.
bind
(
this
);
this
.
confirmRead
=
this
.
confirmRead
.
bind
(
this
);
}
// 对外接口
...
...
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