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
ab27a766
Commit
ab27a766
authored
Nov 25, 2020
by
叶飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: notice
parent
6151b3f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
45 deletions
+67
-45
proxy.js
config/proxy.js
+0
-15
NoticeList.js
src/components/NoticeIcon/NoticeList.js
+10
-3
index.js
src/components/NoticeIcon/Templates/Unknown/index.js
+23
-4
index.js
src/components/Notifier/index.js
+34
-23
No files found.
config/proxy.js
View file @
ab27a766
...
...
@@ -2,13 +2,8 @@ module.exports = {
dev
:
{
'/CityInterface'
:
{
// target: 'http://192.168.10.151:8055',
<<<<<<<
HEAD
// target: 'https://panda-water.cn',
target
:
'https://panda-water.com'
,
=======
target
:
'https://panda-water.cn'
,
// target: 'https://panda-water.com',
>>>>>>>
933261
f5fb1407b8a8e5c423964807f4542a36bb
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
...
...
@@ -22,13 +17,8 @@ module.exports = {
},
'/cityinterface'
:
{
// target: 'http://192.168.10.151:8055',
<<<<<<<
HEAD
// target: 'https://panda-water.cn',
target
:
'https://panda-water.com'
,
=======
target
:
'https://panda-water.cn'
,
// target: 'https://panda-water.com',
>>>>>>>
933261
f5fb1407b8a8e5c423964807f4542a36bb
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin
:
true
,
...
...
@@ -43,13 +33,8 @@ module.exports = {
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
<<<<<<<
HEAD
// target: 'https://panda-water.cn',
target
:
'https://panda-water.com'
,
=======
target
:
'https://panda-water.cn'
,
// target: 'https://panda-water.com',
>>>>>>>
933261
f5fb1407b8a8e5c423964807f4542a36bb
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
...
...
src/components/NoticeIcon/NoticeList.js
View file @
ab27a766
...
...
@@ -29,17 +29,24 @@ class NoticeList extends React.Component {
this
.
state
=
{
isLoading
:
false
,
};
this
.
mounted
=
false
;
this
.
handleScrollCallback
=
this
.
throttle
(
this
.
handleScroll
.
bind
(
this
),
30
).
bind
(
this
);
}
componentDidMount
()
{
this
.
mounted
=
true
;
if
(
this
.
container
.
current
)
{
this
.
container
.
current
.
addEventListener
(
'scroll'
,
this
.
throttle
(
this
.
handleScroll
.
bind
(
this
),
30
)
,
this
.
handleScrollCallback
,
);
}
}
componentWillUnmount
(){
this
.
mounted
=
false
;
}
throttle
(
fn
,
wait
)
{
var
pre
=
Date
.
now
();
return
function
()
{
...
...
@@ -55,6 +62,7 @@ class NoticeList extends React.Component {
handleScroll
(
e
)
{
e
.
stopPropagation
();
if
(
!
this
.
mounted
)
return
;
if
(
!
this
.
container
.
current
)
return
;
let
current
=
this
.
container
.
current
;
if
(
...
...
@@ -75,11 +83,10 @@ class NoticeList extends React.Component {
()
=>
{
if
(
!
this
.
loadMore
)
return
;
this
.
loadMore
().
then
(
data
=>
{
if
(
!
this
.
mounted
)
return
;
this
.
setState
({
isLoading
:
false
,
});
this
.
forceUpdate
();
console
.
log
(
"开始更新了。。。。。"
,
data
);
});
},
);
...
...
src/components/NoticeIcon/Templates/Unknown/index.js
View file @
ab27a766
...
...
@@ -4,22 +4,41 @@ import commonStyles from '../common.less';
import
classNames
from
'classnames'
;
const
Unknown
=
({
message
,
confirmRead
})
=>
{
let
alarmContent
=
message
.
infoContent
;
console
.
log
(
'未知类型消息'
,
message
);
let
content
=
''
;
try
{
let
type
=
typeof
message
.
infoContent
;
switch
(
type
)
{
case
'object'
:
content
=
JSON
.
stringify
(
message
.
infoContent
);
break
;
case
'string'
:
content
=
message
.
infoContent
;
break
;
default
:
break
;
}
}
catch
(
e
)
{
console
.
log
;
}
return
(
<
div
className
=
{
classNames
(
styles
.
unknown
,
commonStyles
.
messageContainer
)
}
title
=
"点击查看详情"
>
<
div
className
=
{
classNames
(
styles
.
unknown
,
commonStyles
.
messageContainer
)}
title
=
"点击查看详情"
>
<
div
className
=
{
commonStyles
.
title
}
>
<
span
>
消息
<
/span
>
<
img
className
=
{
commonStyles
.
confirm
}
title
=
"点击标为已读"
onClick
=
{()
=>
{
confirmRead
(
false
,
[
message
.
id
]);
confirmRead
(
false
,
[
message
.
id
]);
}}
src
=
"https://panda-water.cn/Web4/assets/images/message/%E5%8B%BE%E6%B5%85.png"
/>
<
/div
>
<
div
className
=
{
commonStyles
.
content
}
>
<
p
>
{
message
.
infoC
ontent
}
<
/p
>
<
p
>
{
c
ontent
}
<
/p
>
<
p
className
=
{
commonStyles
.
messageTime
}
>
{
message
.
time
}
<
/p
>
<
/div
>
<
/div
>
...
...
src/components/Notifier/index.js
View file @
ab27a766
...
...
@@ -68,9 +68,9 @@ class Notifier {
// 对外接口
async
start
()
{
window
.
cc
=
this
.
messageCache
;
window
.
cc
=
this
.
messageCache
;
this
.
_getMqttSiteCode
().
then
(()
=>
{
this
.
loadHisMessages
(
this
.
currentPageIndex
,
this
.
currentPageSize
);
this
.
loadHisMessages
(
this
.
currentPageIndex
,
this
.
currentPageSize
);
this
.
connectMQTTServer
();
});
}
...
...
@@ -108,7 +108,7 @@ class Notifier {
try
{
handler
(
payload
);
}
catch
(
e
)
{
console
.
log
(
'订阅器委托错误'
);
console
.
log
(
'订阅器委托错误'
+
e
.
message
);
}
});
}
...
...
@@ -135,7 +135,7 @@ class Notifier {
if
(
isAll
)
{
me
.
messageCache
.
totalCount
=
0
;
me
.
messageCache
.
messages
=
[];
me
.
currentPageIndex
=
1
;
me
.
currentPageIndex
=
1
;
}
else
{
hisIDs
.
forEach
(
id
=>
{
let
index
=
me
.
messageCache
.
messages
.
findIndex
(
...
...
@@ -160,7 +160,7 @@ class Notifier {
}
loadMore
(
callback
)
{
if
(
!
this
.
hasMore
())
return
Promise
.
resolve
([]);
this
.
currentPageIndex
+=
1
;
this
.
currentPageIndex
+=
1
;
return
this
.
loadHisMessages
(
this
.
currentPageIndex
,
this
.
currentPageSize
);
}
...
...
@@ -292,7 +292,7 @@ class Notifier {
}
// 工具类
async
loadHisMessages
(
pageIndex
,
pageSize
)
{
async
loadHisMessages
(
pageIndex
,
pageSize
)
{
let
me
=
this
;
return
Http
.
getInformationInfo
({
userID
:
me
.
userInfo
.
OID
,
...
...
@@ -312,6 +312,10 @@ class Notifier {
});
index
==
-
1
&&
me
.
messageCache
.
messages
.
push
(
message
);
});
if
(
me
.
messageCache
.
totalCount
>
me
.
messageCache
.
messages
.
length
&&
res
.
getMe
.
length
==
0
){
// 服务端返回总数还有,但是查不到数据了,前端修正服务端返回的总数
me
.
messageCache
.
totalCount
=
me
.
messageCache
.
messages
.
length
;
};
me
.
publish
(
NEW_MESSAGE
,
me
.
messageCache
);
return
Promise
.
resolve
(
result
);
});
...
...
@@ -379,6 +383,7 @@ class Notifier {
infoType
=
'remindType'
;
break
;
case
'SCADA报警'
:
case
''
:
infoType
=
'scadaType'
;
default
:
break
;
...
...
@@ -423,23 +428,30 @@ class Notifier {
}
_handleMessageStrToJSON
(
infoType
,
messString
)
{
let
infoContent
=
messString
;
switch
(
infoType
)
{
case
'scadaType'
:
infoContent
=
this
.
_analysisAlarm
(
messString
);
break
;
case
'caseType'
:
infoContent
=
this
.
_analysisCase
(
messString
);
break
;
case
'sysType'
:
infoContent
=
this
.
_analysisNotice
(
messString
);
break
;
case
'saveWaType'
:
break
;
case
'EIMType'
:
break
;
default
:
break
;
try
{
switch
(
infoType
)
{
case
'scadaType'
:
infoContent
=
this
.
_analysisAlarm
(
messString
);
break
;
case
'caseType'
:
infoContent
=
this
.
_analysisCase
(
messString
);
break
;
case
'sysType'
:
infoContent
=
this
.
_analysisNotice
(
messString
);
break
;
case
'saveWaType'
:
break
;
case
'EIMType'
:
break
;
case
'unknown'
:
break
;
default
:
break
;
}
}
catch
(
e
){
console
.
log
(
"1.0消息通知解析消息内容出错:"
+
e
.
message
,
"消息对象:"
,
messString
);
}
return
infoContent
;
}
_analysisCase
(
messString
)
{
...
...
@@ -482,7 +494,6 @@ class Notifier {
};
return
noticeContent
;
}
}
export
default
Notifier
;
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