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
933261f5
Commit
933261f5
authored
Nov 24, 2020
by
叶飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: notice
parent
dfe20ef7
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
58 additions
and
52 deletions
+58
-52
proxy.js
config/proxy.js
+6
-6
Authorized.js
src/components/Authorized/Authorized.js
+1
-1
CheckPermissions.js
src/components/Authorized/CheckPermissions.js
+2
-2
PromiseRender.js
src/components/Authorized/PromiseRender.js
+1
-1
CheckPermissions.dev.js
src/components/Authorized/dist/CheckPermissions.dev.js
+0
-1
index.js
src/components/CitySelector/index.js
+0
-4
NoticeIconView.js
src/components/GlobalHeader/NoticeIconView.js
+1
-1
panel.js
src/components/HeaderSearch/panel.js
+0
-1
NoticeList.js
src/components/NoticeIcon/NoticeList.js
+7
-4
index.dev.js
src/components/Notifier/dist/index.dev.js
+0
-1
mqttws31.dev.js
src/components/Notifier/dist/mqttws31.dev.js
+0
-1
index.js
src/components/Notifier/index.js
+36
-19
mqttws31.js
src/components/Notifier/mqttws31.js
+0
-1
BasicLayout.js
src/layouts/BasicLayout.js
+1
-1
Site.js
src/layouts/Site.js
+0
-2
login.js
src/pages/user/login/login.js
+3
-4
Authorized.js
src/utils/Authorized.js
+0
-1
Authorized.dev.js
src/utils/dist/Authorized.dev.js
+0
-1
No files found.
config/proxy.js
View file @
933261f5
...
...
@@ -2,11 +2,11 @@ module.exports = {
dev
:
{
'/CityInterface'
:
{
// target: 'http://192.168.10.151:8055',
//
target: 'https://panda-water.cn',
target
:
'https://panda-water.cn'
,
// target: 'https://panda-water.com',
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
target
:
'http://192.168.10.20:8888'
,
//
target: 'http://192.168.10.20:8888',
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
...
...
@@ -17,10 +17,10 @@ module.exports = {
},
'/cityinterface'
:
{
// target: 'http://192.168.10.151:8055',
//
target: 'https://panda-water.cn',
target
:
'https://panda-water.cn'
,
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
target
:
'http://192.168.10.20:8888'
,
//
target: 'http://192.168.10.20:8888',
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
...
...
@@ -31,9 +31,9 @@ module.exports = {
},
'/Publish'
:
{
// target: 'http://192.168.12.8:8098',
target
:
'http://192.168.10.20:8888'
,
//
target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
//
target: 'https://panda-water.cn',
target
:
'https://panda-water.cn'
,
// target: 'https://panda-water.com',
changeOrigin
:
true
,
headers
:
{
...
...
src/components/Authorized/Authorized.js
View file @
933261f5
...
...
@@ -16,7 +16,7 @@ const Authorized = ({
/>
),
})
=>
{
debugger
const
childrenRender
=
typeof
children
===
'undefined'
?
null
:
children
;
const
dom
=
check
(
authority
,
flatMenu
,
childrenRender
,
noMatch
);
return
<>
{
dom
}
<
/>
;
...
...
src/components/Authorized/CheckPermissions.js
View file @
933261f5
...
...
@@ -9,7 +9,7 @@ const checkPermissions = (
target
,
Exception
,
)
=>
{
debugger
;
;
const
filterPath
=
[
{
name
:
'/'
,
path
:
'/'
},
{
name
:
'civbase'
,
path
:
`/civbase/?client=
${
window
.
globalConfig
.
client
}
`
},
...
...
@@ -38,7 +38,7 @@ const checkPermissions = (
};
function
check
(
authority
,
flatMenu
,
target
,
Exception
)
{
debugger
;
;
return
checkPermissions
(
authority
,
flatMenu
,
...
...
src/components/Authorized/PromiseRender.js
View file @
933261f5
...
...
@@ -56,7 +56,7 @@ export default class PromiseRender extends React.Component {
}
render
()
{
debugger
const
{
}
=
this
.
state
;
const
{
ok
,
error
,
promise
,
...
rest
}
=
this
.
props
;
return
component
?
(
...
...
src/components/Authorized/dist/CheckPermissions.dev.js
View file @
933261f5
...
...
@@ -40,7 +40,6 @@ var checkPermissions = function checkPermissions(authority, flatMenu, currentAut
};
function
check
(
authority
,
flatMenu
,
target
,
Exception
)
{
debugger
;
return
checkPermissions
(
authority
,
flatMenu
,
_renderAuthorize
.
CURRENT
,
target
,
Exception
);
}
...
...
src/components/CitySelector/index.js
View file @
933261f5
...
...
@@ -180,7 +180,6 @@ class CitySelector extends React.Component {
)
}
}
else
{
debugger
let
flg1
=
false
for
(
var
k
=
0
;
k
<
siteOption
.
length
;
k
++
)
{
if
(
siteOption
[
k
].
city
.
indexOf
(
item
.
address
)
>
-
1
)
{
...
...
@@ -235,14 +234,12 @@ class CitySelector extends React.Component {
}
handleChangeTab
=
(
activeKey
)
=>
{
debugger
this
.
setState
({
activeIndex
:
activeKey
})
}
selectCityHandle
=
(
event
,
item
,
status
)
=>
{
debugger
event
.
persist
();
this
.
setState
({
...
...
@@ -252,7 +249,6 @@ class CitySelector extends React.Component {
}
districtHandle
=
(
event
,
item
,
status
)
=>
{
debugger
event
.
persist
();
this
.
setState
({
districtCurrentItem
:
item
...
...
src/components/GlobalHeader/NoticeIconView.js
View file @
933261f5
...
...
@@ -12,7 +12,6 @@ class NoticeIconView extends Component {
noticeData
:
[],
};
this
.
notifier
=
new
Notifier
(
this
.
props
.
global
.
userInfo
);
}
async
componentDidMount
()
{
...
...
@@ -44,6 +43,7 @@ class NoticeIconView extends Component {
emptyText
=
"你已查看所有通知"
confirmRead
=
{
this
.
notifier
.
confirmRead
}
loadMore
=
{
this
.
notifier
.
loadMore
}
hasMore
=
{
this
.
notifier
.
hasMore
}
/
>
<
/NoticeIcon
>
);
...
...
src/components/HeaderSearch/panel.js
View file @
933261f5
...
...
@@ -51,7 +51,6 @@ const SearchPanel = props => {
}
const
handlerMore
=
(
event
)
=>
{
debugger
event
.
persist
&&
event
.
persist
()
event
&&
event
.
nativeEvent
.
stopImmediatePropagation
()
setVisible
(
true
)
...
...
src/components/NoticeIcon/NoticeList.js
View file @
933261f5
...
...
@@ -21,10 +21,10 @@ const Empty = ({ emptyText }) => (
class
NoticeList
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
data
=
props
.
data
;
this
.
emptyText
=
props
.
emptyText
;
this
.
confirmRead
=
props
.
confirmRead
;
this
.
loadMore
=
props
.
loadMore
;
this
.
hasMore
=
props
.
hasMore
;
this
.
container
=
React
.
createRef
();
this
.
state
=
{
isLoading
:
false
,
...
...
@@ -67,6 +67,7 @@ class NoticeList extends React.Component {
handleLoadMore
()
{
if
(
this
.
state
.
isLoading
)
return
;
if
(
!
this
.
hasMore
())
return
;
this
.
setState
(
{
isLoading
:
true
,
...
...
@@ -77,20 +78,22 @@ class NoticeList extends React.Component {
this
.
setState
({
isLoading
:
false
,
});
this
.
forceUpdate
();
console
.
log
(
"开始更新了。。。。。"
,
data
);
});
},
);
}
render
()
{
if
(
!
this
.
data
||
thi
s
.
data
.
length
===
0
)
{
if
(
!
this
.
props
.
data
||
this
.
prop
s
.
data
.
length
===
0
)
{
return
<
Empty
emptyText
=
{
this
.
emptyText
}
/>
;
}
return
(
<
div
className
=
{
styles
.
container
}
ref
=
{
this
.
container
}
>
<
List
className
=
{
styles
.
list
}
dataSource
=
{
this
.
data
}
dataSource
=
{
this
.
props
.
data
}
renderItem
=
{(
item
,
i
)
=>
{
const
itemCls
=
classNames
(
styles
.
item
,
{
[
styles
.
read
]:
item
.
read
,
...
...
@@ -131,7 +134,7 @@ class NoticeList extends React.Component {
<
Spin
/>
加载中
...
<
/
>
)
:
(
<
span
>
下拉加载更多
<
/span
>
this
.
hasMore
()
?
<
span
>
下拉加载更多
<
/span> : <span>已经没有更多消息了
</
span
>
)}
<
/div
>
<
/div
>
...
...
src/components/Notifier/dist/index.dev.js
View file @
933261f5
...
...
@@ -243,7 +243,6 @@ function () {
password
:
password
,
onSuccess
:
this
.
onMQTTConnect
.
bind
(
this
),
onFailure
:
function
onFailure
(
e
)
{
debugger
;
console
.
log
(
e
);
}
};
...
...
src/components/Notifier/dist/mqttws31.dev.js
View file @
933261f5
...
...
@@ -1309,7 +1309,6 @@ function onMessageArrived(message) {
ClientImpl
.
prototype
.
_on_socket_message
=
function
(
event
)
{
debugger
;
this
.
_trace
(
"Client._on_socket_message"
,
event
.
data
);
...
...
src/components/Notifier/index.js
View file @
933261f5
...
...
@@ -53,22 +53,24 @@ class Notifier {
this
.
MQTTClient
=
null
;
this
.
MQTTOptions
=
{};
this
.
IsNeedReconnect
=
true
;
this
.
pageIndex
=
1
;
this
.
pageSize
=
10
;
this
.
currentPageIndex
=
1
;
this
.
currentPageSize
=
10
;
// 对外接口处理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
);
this
.
loadMore
=
this
.
loadHisMessages
.
bind
(
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
);
this
.
loadMore
=
this
.
loadMore
.
bind
(
this
);
this
.
hasMore
=
this
.
hasMore
.
bind
(
this
);
}
// 对外接口
async
start
()
{
window
.
cc
=
this
.
messageCache
;
this
.
_getMqttSiteCode
().
then
(()
=>
{
this
.
loadHisMessages
(
{
userID
:
this
.
userInfo
.
OID
}
);
this
.
loadHisMessages
(
this
.
currentPageIndex
,
this
.
currentPageSize
);
this
.
connectMQTTServer
();
});
}
...
...
@@ -133,6 +135,7 @@ class Notifier {
if
(
isAll
)
{
me
.
messageCache
.
totalCount
=
0
;
me
.
messageCache
.
messages
=
[];
me
.
currentPageIndex
=
1
;
}
else
{
hisIDs
.
forEach
(
id
=>
{
let
index
=
me
.
messageCache
.
messages
.
findIndex
(
...
...
@@ -150,6 +153,16 @@ class Notifier {
console
.
log
(
'postInformationStatus调用失败'
+
err
);
});
}
hasMore
()
{
if
(
!
this
.
messageCache
)
return
false
;
if
(
!
this
.
messageCache
.
totalCount
)
return
false
;
return
this
.
messageCache
.
totalCount
>
this
.
messageCache
.
messages
.
length
;
}
loadMore
(
callback
)
{
if
(
!
this
.
hasMore
())
return
Promise
.
resolve
([]);
this
.
currentPageIndex
+=
1
;
return
this
.
loadHisMessages
(
this
.
currentPageIndex
,
this
.
currentPageSize
);
}
// mqtt
async
connectMQTTServer
()
{
...
...
@@ -161,7 +174,7 @@ class Notifier {
cleanSession
=
true
,
ssl
=
this
.
_siteConfig
.
IsSSL
,
userName
=
'mao2080'
,
password
=
"123"
,
password
=
'123'
,
path
=
this
.
_siteConfig
.
mqtt_path
;
this
.
MQTTCount
=
0
;
this
.
MQTTClient
=
new
MqttClient
.
Client
(
hostname
,
port
,
path
,
clientId
);
...
...
@@ -180,7 +193,6 @@ class Notifier {
password
:
password
,
onSuccess
:
this
.
onMQTTConnect
.
bind
(
this
),
onFailure
:
function
(
e
)
{
debugger
;
console
.
log
(
e
);
},
};
...
...
@@ -233,7 +245,7 @@ class Notifier {
onMessageArrived
(
buffer
)
{
let
me
=
this
;
try
{
console
.
log
(
'收到消息:'
+
buffer
.
payloadString
);
//
console.log('收到消息:' + buffer.payloadString);
let
temp
=
JSON
.
parse
(
buffer
.
payloadString
);
let
infoType
=
this
.
_typeInfo
(
temp
.
infoType
);
if
(
...
...
@@ -280,11 +292,10 @@ class Notifier {
}
// 工具类
async
loadHisMessages
({
userID
,
pageIndex
=
this
.
pageIndex
,
pageSize
=
this
.
pageSize
})
{
debugger
;
async
loadHisMessages
(
pageIndex
,
pageSize
)
{
let
me
=
this
;
return
Http
.
getInformationInfo
({
userID
,
userID
:
me
.
userInfo
.
OID
,
pageIndex
,
pageSize
,
'request.preventCache'
:
Date
.
now
(),
...
...
@@ -293,9 +304,15 @@ class Notifier {
totalCount
:
res
.
totalRcdNum
,
messages
:
res
.
getMe
.
map
(
this
.
_handleHisToMessage
.
bind
(
this
)),
};
this
.
messageCache
.
totalCount
+=
result
.
totalCount
;
this
.
messageCache
.
messages
.
push
(...
result
.
messages
);
me
.
publish
(
NEW_MESSAGE
,
this
.
messageCache
);
me
.
messageCache
.
totalCount
=
result
.
totalCount
;
result
.
messages
.
forEach
(
message
=>
{
// 防止加载更多时候塞入重复数据
let
index
=
me
.
messageCache
.
messages
.
findIndex
(
item
=>
{
return
item
.
id
==
message
.
id
;
});
index
==
-
1
&&
me
.
messageCache
.
messages
.
push
(
message
);
});
me
.
publish
(
NEW_MESSAGE
,
me
.
messageCache
);
return
Promise
.
resolve
(
result
);
});
}
...
...
@@ -368,7 +385,6 @@ class Notifier {
}
return
infoType
;
}
_handleHisToMessage
(
hisMessage
)
{
var
timeH
=
(
new
Date
()
-
new
Date
(
hisMessage
.
HisCreateTime
))
/
1000
/
60
;
var
timeMss
=
...
...
@@ -466,6 +482,7 @@ class Notifier {
};
return
noticeContent
;
}
}
export
default
Notifier
;
src/components/Notifier/mqttws31.js
View file @
933261f5
...
...
@@ -1219,7 +1219,6 @@ function onMessageArrived(message) {
* @ignore
*/
ClientImpl
.
prototype
.
_on_socket_message
=
function
(
event
)
{
debugger
this
.
_trace
(
"Client._on_socket_message"
,
event
.
data
);
var
messages
=
this
.
_deframeMessages
(
event
.
data
);
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
+=
1
)
{
...
...
src/layouts/BasicLayout.js
View file @
933261f5
...
...
@@ -66,7 +66,7 @@ const menuExtraRender = currentRoutes => {
<
a
style
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
img
src
=
{
`http://panda-water.cn/web4/
${
currentRoutes
&&
currentRoutes
.
extData
.
icon
}
`
}
currentRoutes
.
extData
&&
currentRoutes
.
extData
.
icon
}
`
}
style
=
{{
width
:
'20px'
,
height
:
'20px'
}}
/
>
<
span
...
...
src/layouts/Site.js
View file @
933261f5
...
...
@@ -56,7 +56,6 @@ class Site {
},
{
ignoreSite
:
true
}).
then
(
res
=>
{
debugger
if
(
res
&&
res
.
say
.
errMsg
===
''
&&
res
.
say
.
statusCode
===
ERR_OK
)
{
const
result
=
res
.
getMe
;
let
city
=
self
.
weatherCity
;
...
...
@@ -427,7 +426,6 @@ class Site {
}
handEnd
=
(
event
,
item
)
=>
{
debugger
event
.
persist
();
const
self
=
this
;
if
(
item
)
{
...
...
src/pages/user/login/login.js
View file @
933261f5
...
...
@@ -416,7 +416,6 @@ class Login {
});
}
getUserInfoAndConfig
(
failCallback
,
flag
,
industry
)
{
debugger
const
token
=
this
.
globalConfig
.
token
;
const
site
=
Cookies
.
get
(
'site'
);
const
self
=
this
;
...
...
@@ -471,9 +470,9 @@ class Login {
{},
response
,
self
.
globalConfig
.
userInfo
,
{
site
:
response
.
site
===
""
?
""
:
self
.
globalConfig
.
userInfo
.
site
}
//
{
//
site: response.site === "" ? "": self.globalConfig.userInfo.site
//
}
);
// Cookies.set('site', this.globalConfig.userInfo.site);
console
.
log
(
"self.globalConfig.userInfo"
,
self
.
globalConfig
.
userInfo
)
...
...
src/utils/Authorized.js
View file @
933261f5
...
...
@@ -7,7 +7,6 @@ let Authorized = RenderAuthorize(getAuthority());
// Reload the rights component
const
reloadAuthorized
=
()
=>
{
debugger
Authorized
=
RenderAuthorize
(
getAuthority
());
};
...
...
src/utils/dist/Authorized.dev.js
View file @
933261f5
...
...
@@ -17,7 +17,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
var
Authorized
=
(
0
,
_Authorized
[
"default"
])((
0
,
_authority
.
getAuthority
)());
// Reload the rights component
var
reloadAuthorized
=
function
reloadAuthorized
()
{
debugger
;
Authorized
=
(
0
,
_Authorized
[
"default"
])((
0
,
_authority
.
getAuthority
)());
};
...
...
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