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
shenshaokai
jinfa-platform
Commits
335fb03d
Commit
335fb03d
authored
Dec 07, 2020
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改socket参数
parent
a5e388c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
index.ts
src/constants/index.ts
+1
-1
RightContent.tsx
src/layouts/components/RightContent.tsx
+2
-2
No files found.
src/constants/index.ts
View file @
335fb03d
export
const
NOT_CHANGE_VALUE
=
'hello, world'
// socket的链接地址, 默认会使用后端接口网关地址
export
const
SOCKET_URL
=
process
.
env
.
SOCKET_URL
?.
replace
(
'http|https'
,
'ws'
)
||
process
.
env
.
BACK_GATEWAY
?.
replace
(
'http|https'
,
'ws'
)
||
"ws://10.0.0.25:9400"
export
const
SOCKET_URL
=
process
.
env
.
SOCKET_URL
?.
replace
(
'http|https'
,
'ws'
)
||
process
.
env
.
BACK_GATEWAY
?.
replace
(
'http|https'
,
'ws'
)
console
.
log
(
SOCKET_URL
);
export
const
MALL_TYPE
=
{
...
...
src/layouts/components/RightContent.tsx
View file @
335fb03d
...
...
@@ -31,8 +31,8 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
const
ws
=
useRef
<
WebSocket
|
null
>
(
null
);
const
webSocketInit
=
useCallback
(()
=>
{
console
.
log
(
ws
.
current
)
if
((
!
ws
.
current
||
ws
.
current
.
readyState
===
3
)
&&
userInfo
)
{
const
url
=
`
${
SOCKET_URL
}
/report/websocket?memberId=
${
userInfo
.
memberId
}
&roleId=
${
userInfo
.
memberRoleId
}
&token=
${
userInfo
.
token
}
`
;
if
(
SOCKET_URL
&&
(
!
ws
.
current
||
ws
.
current
.
readyState
===
3
)
&&
userInfo
)
{
const
url
=
`
${
SOCKET_URL
}
/report/websocket?memberId=
${
userInfo
.
memberId
}
&roleId=
${
userInfo
.
memberRoleId
}
&token=
${
userInfo
.
token
}
&source=
${
1
}
`
;
ws
.
current
=
new
WebSocket
(
url
);
ws
.
current
.
onopen
=
(
e
)
=>
{
console
.
log
(
e
)
...
...
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