Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
linweijiong
jinfa-platform
Commits
455aae88
Commit
455aae88
authored
Nov 12, 2020
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接入socket
parent
95e1ccb8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
48 deletions
+75
-48
msg_platform.png
src/assets/imgs/msg_platform.png
+0
-0
msg_system.png
src/assets/imgs/msg_system.png
+0
-0
RightContent.tsx
src/layouts/components/RightContent.tsx
+31
-1
index.tsx
src/pages/systemSetting/message/index.tsx
+44
-47
No files found.
src/assets/imgs/msg_platform.png
0 → 100644
View file @
455aae88
1012 Bytes
src/assets/imgs/msg_system.png
0 → 100644
View file @
455aae88
908 Bytes
src/layouts/components/RightContent.tsx
View file @
455aae88
import
{
Tooltip
}
from
'antd'
;
import
{
Tooltip
}
from
'antd'
;
import
{
BellOutlined
,
CustomerServiceOutlined
}
from
'@ant-design/icons'
;
import
{
BellOutlined
,
CustomerServiceOutlined
}
from
'@ant-design/icons'
;
import
React
from
'react'
;
import
React
,
{
useCallback
,
useRef
,
useLayoutEffect
}
from
'react'
;
// import { connect, ConnectProps } from 'umi';
// import { connect, ConnectProps } from 'umi';
// import { ConnectState } from '@/models/connect';
// import { ConnectState } from '@/models/connect';
import
Avatar
from
'./AvatarDropdown'
;
import
Avatar
from
'./AvatarDropdown'
;
...
@@ -9,6 +9,7 @@ import Location from './Location';
...
@@ -9,6 +9,7 @@ import Location from './Location';
import
Roles
from
'./Roles'
;
import
Roles
from
'./Roles'
;
import
styles
from
'../styles/RightContent.less'
;
import
styles
from
'../styles/RightContent.less'
;
import
{
Link
}
from
'umi'
;
import
{
Link
}
from
'umi'
;
import
{
getAuth
}
from
'@/utils/auth'
// export type SiderTheme = 'light' | 'dark';
// export type SiderTheme = 'light' | 'dark';
// export interface GlobalHeaderRightProps extends Partial<ConnectProps> {
// export interface GlobalHeaderRightProps extends Partial<ConnectProps> {
...
@@ -25,6 +26,35 @@ const GlobalHeaderRight: React.SFC<{}> = (props) => {
...
@@ -25,6 +26,35 @@ const GlobalHeaderRight: React.SFC<{}> = (props) => {
// className = `${styles.right} ${styles.dark}`;
// className = `${styles.right} ${styles.dark}`;
// }
// }
const
userInfo
=
getAuth
()
const
ws
=
useRef
<
WebSocket
|
null
>
(
null
);
const
webSocketInit
=
useCallback
(()
=>
{
console
.
log
(
ws
.
current
)
if
(
!
ws
.
current
||
ws
.
current
.
readyState
===
3
)
{
ws
.
current
=
new
WebSocket
(
`ws://10.0.0.25:8100/report/websocket?memberId=
${
userInfo
.
memberId
}
&roleId=
${
userInfo
.
memberRoleId
}
`
);
ws
.
current
.
onopen
=
(
e
)
=>
{
console
.
log
(
e
)
}
ws
.
current
.
onmessage
=
(
e
)
=>
{
console
.
log
(
e
)
};
ws
.
current
.
onclose
=
(
e
)
=>
{
console
.
log
(
"关闭连接"
)
}
ws
.
current
.
onerror
=
(
e
)
=>
{
console
.
log
(
"socket 出错"
)
}
}
},
[
ws
]);
useLayoutEffect
(()
=>
{
webSocketInit
();
return
()
=>
{
ws
.
current
?.
close
();
};
},
[
ws
,
webSocketInit
]);
return
(
return
(
<
div
className=
{
className
}
>
<
div
className=
{
className
}
>
<
Link
to=
'/'
style=
{
{
color
:
'rgba(0, 0, 0, 0.85)'
}
}
>
返回商城
</
Link
>
<
Link
to=
'/'
style=
{
{
color
:
'rgba(0, 0, 0, 0.85)'
}
}
>
返回商城
</
Link
>
...
...
src/pages/systemSetting/message/index.tsx
View file @
455aae88
import
React
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
history
}
from
'umi'
;
import
{
history
}
from
'umi'
;
import
{
Button
,
Row
,
Col
,
Card
,
List
,
Avatar
}
from
'antd'
;
import
{
Card
,
List
,
Avatar
}
from
'antd'
;
import
styles
from
'./index.less'
import
styles
from
'./index.less'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
StatusTag
from
'@/components/StatusTag'
;
import
StatusTag
from
'@/components/StatusTag'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
moment
from
'moment'
;
import
msg_system
from
'@/assets/imgs/msg_system.png'
import
msg_platform
from
'@/assets/imgs/msg_platform.png'
const
Message
:
React
.
FC
<
{}
>
=
()
=>
{
const
Message
:
React
.
FC
<
{}
>
=
()
=>
{
const
[
dataSource
,
setDataSource
]
=
useState
<
any
>
([])
const
pagation
=
{
current
:
1
,
pageSize
:
10
,
}
useEffect
(()
=>
{
// @ts-ignore
async
function
init
()
{
const
data
=
await
getList
(
pagation
);
setDataSource
(
data
);
}
init
()
},
[])
const
data
=
[
const
getList
=
async
(
params
)
=>
{
{
///report/message/member/page
id
:
1
,
const
res
=
await
PublicApi
.
getReportMessageMemberPage
(
params
);
icon
:
''
,
if
(
res
.
code
===
1000
)
{
status
:
'success'
,
return
res
.
data
type
:
'系统消息'
,
}
title
:
'订单发货'
,
return
{
message
:
'订单发货,请注意查收,清单发货,请注意查收!'
,
totalCount
:
0
,
time
:
'2015-15-05'
,
data
:
[]
},
}
{
}
id
:
2
,
icon
:
''
,
const
handlePaginationChange
=
(
page
,
pageSize
)
=>
{
status
:
'success'
,
getList
({
page
,
pageSize
})
type
:
'系统消息'
,
.
then
((
data
)
=>
{
title
:
'订单收货'
,
setDataSource
(
data
);
message
:
'订单发货,请注意查收,清单发货,请注意查收!'
,
})
time
:
'2015-15-05'
,
}
},
{
id
:
3
,
icon
:
''
,
status
:
'primary'
,
type
:
'系统消息'
,
title
:
'系统消息'
,
message
:
'账户异常,请注意账户资金安全!'
,
time
:
'2015-15-05'
,
},
{
id
:
4
,
icon
:
''
,
status
:
'primary'
,
type
:
'系统消息'
,
title
:
'系统消息'
,
message
:
'账户支出300元,请注意账户资金安全!'
,
time
:
'2015-15-05'
,
},
];
const
renderMessage
=
(
data
)
=>
{
const
renderMessage
=
(
data
)
=>
{
...
@@ -69,25 +68,23 @@ const Message: React.FC<{}> = () => {
...
@@ -69,25 +68,23 @@ const Message: React.FC<{}> = () => {
>
>
<
List
<
List
itemLayout=
"horizontal"
itemLayout=
"horizontal"
dataSource=
{
data
}
dataSource=
{
data
Source
.
data
}
className=
{
styles
.
customList
}
className=
{
styles
.
customList
}
pagination=
{
{
pagination=
{
{
onChange
:
page
=>
{
onChange
:
handlePaginationChange
,
console
.
log
(
page
);
},
pageSize
:
10
,
pageSize
:
10
,
size
:
"small"
,
size
:
"small"
,
showQuickJumper
:
true
,
showQuickJumper
:
true
,
total
:
4
,
total
:
dataSource
.
totalCount
,
showTotal
:
showTotal
showTotal
:
showTotal
}
}
}
}
renderItem=
{
item
=>
(
renderItem=
{
item
=>
(
<
List
.
Item
>
<
List
.
Item
>
<
List
.
Item
.
Meta
<
List
.
Item
.
Meta
avatar=
{
<
Avatar
src=
{
item
.
icon
}
/>
}
avatar=
{
<
Avatar
src=
{
msg_system
}
/>
}
title=
{
renderMessage
(
item
)
}
title=
{
renderMessage
(
item
)
}
/>
/>
<
div
>
{
item
.
time
}
</
div
>
<
div
>
{
moment
(
item
.
createTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
}
</
div
>
</
List
.
Item
>
</
List
.
Item
>
)
}
)
}
/>
/>
...
...
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