Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xxx_phase2_web
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
夏敏伟
xxx_phase2_web
Commits
11fdd99b
Commit
11fdd99b
authored
Sep 25, 2023
by
高飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://192.168.168.218/xiaminwei/xxx_phase2_web
parents
2036cd7f
8f430b6c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
55 deletions
+113
-55
src/api/chat/chatRecords.js
src/api/chat/chatRecords.js
+9
-1
src/api/chat/chatRoom.js
src/api/chat/chatRoom.js
+8
-5
src/view/ddkz/components/chatRoomDialog.vue
src/view/ddkz/components/chatRoomDialog.vue
+12
-30
src/view/ddkz/components/noticeDialog.vue
src/view/ddkz/components/noticeDialog.vue
+58
-14
src/view/ddkz/ddkzzs.vue
src/view/ddkz/ddkzzs.vue
+26
-5
No files found.
src/api/chat/chatRecords.js
View file @
11fdd99b
...
@@ -2,7 +2,15 @@ import { get, post, addParam } from "../../util/http_util";
...
@@ -2,7 +2,15 @@ import { get, post, addParam } from "../../util/http_util";
const
PREFIX_RECORDS
=
'
api/rest/chat/chatRecords
'
;
const
PREFIX_RECORDS
=
'
api/rest/chat/chatRecords
'
;
//分页查询群聊记录
//分页查询群聊记录
//查询小群
export
const
getRecordsByPagingTeam
=
(
chatRoomId
,
currPage
,
pageSize
,
startTime
,
endTime
,
fromUserId
,
teamId
)
=>
{
let
url
=
`
${
PREFIX_RECORDS
}
/chatroomTeam/page`
;
url
+=
addParam
({
chatRoomId
,
currPage
,
pageSize
,
startTime
,
endTime
,
fromUserId
,
teamId
});
return
get
(
url
);
}
//查询大群
export
const
getRecordsByPaging
=
(
chatRoomId
,
currPage
,
pageSize
,
startTime
,
endTime
,
fromUserId
,
teamId
)
=>
{
export
const
getRecordsByPaging
=
(
chatRoomId
,
currPage
,
pageSize
,
startTime
,
endTime
,
fromUserId
,
teamId
)
=>
{
let
url
=
`
${
PREFIX_RECORDS
}
/chatroom/page`
;
let
url
=
`
${
PREFIX_RECORDS
}
/chatroom/page`
;
url
+=
addParam
({
chatRoomId
,
currPage
,
pageSize
,
startTime
,
endTime
,
fromUserId
,
teamId
});
url
+=
addParam
({
chatRoomId
,
currPage
,
pageSize
,
startTime
,
endTime
,
fromUserId
,
teamId
});
...
...
src/api/chat/chatRoom.js
View file @
11fdd99b
import
{
get
,
post
,
addParam
}
from
"
../../util/http_util
"
;
import
{
get
,
post
,
fileUpload
,
addParam
}
from
"
../../util/http_util
"
;
const
PREFIX_CHATROOM
=
'
api/rest/chat/chatroom
'
;
const
PREFIX_CHATROOM
=
'
api/rest/chat/chatroom
'
;
...
@@ -13,7 +13,7 @@ export const createChatRoom = data => {
...
@@ -13,7 +13,7 @@ export const createChatRoom = data => {
}
}
//查询某个聊天室(群组)详情信息
//查询某个聊天室(群组)详情信息
export
const
getChatRoomInfo
=
(
id
,
userId
)
=>
{
export
const
getChatRoomInfo
=
(
id
,
userId
)
=>
{
return
get
(
`
${
PREFIX_CHATROOM
}
/info?id=
${
id
}
&userId=
${
userId
}
`
);
return
get
(
`
${
PREFIX_CHATROOM
}
/info?id=
${
id
}
&userId=
${
userId
}
`
);
}
}
...
@@ -33,12 +33,12 @@ export const getChatRoomList = (userId) => {
...
@@ -33,12 +33,12 @@ export const getChatRoomList = (userId) => {
}
}
//阅读(群组)信息
//阅读(群组)信息
export
const
readChatRoom
=
(
chatRoomId
,
userId
)
=>
{
export
const
readChatRoom
=
(
chatRoomId
,
userId
)
=>
{
return
get
(
`
${
PREFIX_CHATROOM
}
/readChatRoom?chatRoomId=
${
chatRoomId
}
&userId=
${
userId
}
`
);
return
get
(
`
${
PREFIX_CHATROOM
}
/readChatRoom?chatRoomId=
${
chatRoomId
}
&userId=
${
userId
}
`
);
}
}
//设置聊天室(群组)当前议题
//设置聊天室(群组)当前议题
export
const
setChatRoomCurrentIssue
=
(
chatRoomId
,
currentIssue
)
=>
{
export
const
setChatRoomCurrentIssue
=
(
chatRoomId
,
currentIssue
)
=>
{
return
get
(
`
${
PREFIX_CHATROOM
}
/setChatRoomCurrentIssue?chatRoomId=
${
chatRoomId
}
¤tIssue=
${
currentIssue
}
`
);
return
get
(
`
${
PREFIX_CHATROOM
}
/setChatRoomCurrentIssue?chatRoomId=
${
chatRoomId
}
¤tIssue=
${
currentIssue
}
`
);
}
}
...
@@ -47,7 +47,10 @@ export const setChatRoomStatus = (chatRoomId) => {
...
@@ -47,7 +47,10 @@ export const setChatRoomStatus = (chatRoomId) => {
return
get
(
`
${
PREFIX_CHATROOM
}
/setChatRoomStatus?chatRoomId=
${
chatRoomId
}
`
);
return
get
(
`
${
PREFIX_CHATROOM
}
/setChatRoomStatus?chatRoomId=
${
chatRoomId
}
`
);
}
}
//上传文件
export
const
upLoadFiles
=
(
bucket
,
data
)
=>
{
return
fileUpload
(
`api/rest/file/upload?bucket=
${
bucket
}
`
,
data
)
}
...
...
src/view/ddkz/components/chatRoomDialog.vue
View file @
11fdd99b
...
@@ -43,8 +43,7 @@
...
@@ -43,8 +43,7 @@
<
script
>
<
script
>
import
avatar
from
'
../../../assets/img/ddkz/headPhoto.jpg
'
;
import
avatar
from
'
../../../assets/img/ddkz/headPhoto.jpg
'
;
import
'
../../../util/stomp.min.js
'
import
{
getRecordsByPagingTeam
}
from
'
../../../api/chat/chatRecords
'
;
import
{
getRecordsByPaging
}
from
'
../../../api/chat/chatRecords
'
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -56,16 +55,19 @@ export default {
...
@@ -56,16 +55,19 @@ export default {
},
},
sendMessage
:
''
,
sendMessage
:
''
,
chatMessageList
:
[],
chatMessageList
:
[],
stompClient
:
''
,
//
stompClient: '',
ws
:
null
,
//
ws: null,
analogDataList
:
[],
analogDataList
:
[],
currentChatRoom
:
{}
currentChatRoom
:
{},
myStompClient
:
null
}
}
},
},
props
:
{
props
:
{
visible
:
Boolean
,
visible
:
Boolean
,
analogData
:
Array
,
analogData
:
Array
,
stompClient
:
Object
,
currentChatRoomInfo
:
Object
currentChatRoomInfo
:
Object
},
},
methods
:
{
methods
:
{
handleClose
()
{
handleClose
()
{
...
@@ -73,7 +75,7 @@ export default {
...
@@ -73,7 +75,7 @@ export default {
},
},
sendMessageFn
()
{
sendMessageFn
()
{
if
(
this
.
sendMessage
.
trim
().
length
>
0
)
{
if
(
this
.
sendMessage
.
trim
().
length
>
0
)
{
this
.
s
tompClient
.
send
(
"
/app/sendToChatRoomTeam/
"
+
this
.
currentChatRoom
.
id
+
'
/
'
+
this
.
currentChatRoom
.
teamId
,
{},
JSON
.
stringify
({
this
.
myS
tompClient
.
send
(
"
/app/sendToChatRoomTeam/
"
+
this
.
currentChatRoom
.
id
+
'
/
'
+
this
.
currentChatRoom
.
teamId
,
{},
JSON
.
stringify
({
'
content
'
:
this
.
sendMessage
'
content
'
:
this
.
sendMessage
}));
}));
...
@@ -89,24 +91,6 @@ export default {
...
@@ -89,24 +91,6 @@ export default {
const
divscll
=
document
.
getElementById
(
'
chatContent
'
);
const
divscll
=
document
.
getElementById
(
'
chatContent
'
);
divscll
.
scrollTop
=
divscll
.
scrollHeight
;
divscll
.
scrollTop
=
divscll
.
scrollHeight
;
},
},
connect
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ws
=
new
WebSocket
(
`ws://192.168.168.110:8081/websocket/my-websocket`
);
this
.
stompClient
&&
this
.
stompClient
.
connected
&&
this
.
stompClient
.
disconnect
();
this
.
stompClient
=
Stomp
.
over
(
this
.
ws
);
this
.
stompClient
.
heartbeat
.
outgoing
=
20000
;
//若使用STOMP 1.1 版本,默认开启了心跳检测机制(默认值都是10000ms)
this
.
stompClient
.
heartbeat
.
incoming
=
0
;
//客户端不从服务端接收心跳包
this
.
stompClient
.
connect
({
name
:
this
.
userInfo
.
account
},
frame
=>
{
this
.
listChatroom
(
this
.
analogDataList
);
resolve
(
"
连接成功
"
)
},
err
=>
{
console
.
log
(
typeof
err
==
"
string
"
?
err
:
err
.
headers
.
message
)
reject
(
typeof
err
==
"
string
"
?
err
:
err
.
headers
.
message
)
});
})
},
listChatroom
(
data
)
{
listChatroom
(
data
)
{
//取消群聊的订阅
//取消群聊的订阅
for
(
const
sub
in
this
.
stompClient
.
subscriptions
)
{
for
(
const
sub
in
this
.
stompClient
.
subscriptions
)
{
...
@@ -116,10 +100,6 @@ export default {
...
@@ -116,10 +100,6 @@ export default {
}
}
data
.
forEach
(
e
=>
{
data
.
forEach
(
e
=>
{
//订阅聊天室主题,订阅功能中设置ID:
//订阅聊天室主题,订阅功能中设置ID:
this
.
stompClient
.
subscribe
(
'
/topic/multicast/
'
+
e
.
id
,
data
=>
{
debugger
},
{
id
:
"
multicast
"
+
e
.
id
+
new
Date
().
getTime
()
});
this
.
stompClient
.
subscribe
(
'
/topic/multicast/
'
+
e
.
id
+
'
/
'
+
e
.
teamId
,
data
=>
{
this
.
stompClient
.
subscribe
(
'
/topic/multicast/
'
+
e
.
id
+
'
/
'
+
e
.
teamId
,
data
=>
{
this
.
chatMessageList
.
push
({
this
.
chatMessageList
.
push
({
content
:
JSON
.
parse
(
data
.
body
).
content
,
content
:
JSON
.
parse
(
data
.
body
).
content
,
...
@@ -131,7 +111,7 @@ export default {
...
@@ -131,7 +111,7 @@ export default {
},
},
getCurrentMessageList
(
item
)
{
getCurrentMessageList
(
item
)
{
//查询我方聊天记录
//查询我方聊天记录
getRecordsByPaging
(
item
.
id
,
1
,
100
,
'
2020-01-01 00:00:00
'
,
'
2023-10-01 00:00:00
'
,
null
,
item
.
teamId
).
then
(
res1
=>
{
getRecordsByPaging
Team
(
item
.
id
,
1
,
100
,
'
2020-01-01 00:00:00
'
,
'
2023-10-01 00:00:00
'
,
null
,
item
.
teamId
).
then
(
res1
=>
{
this
.
chatMessageList
=
res1
.
records
;
this
.
chatMessageList
=
res1
.
records
;
})
})
}
}
...
@@ -151,7 +131,9 @@ export default {
...
@@ -151,7 +131,9 @@ export default {
this
.
dialogVisible
=
this
.
$props
.
visible
;
this
.
dialogVisible
=
this
.
$props
.
visible
;
this
.
analogDataList
=
this
.
$props
.
analogData
;
this
.
analogDataList
=
this
.
$props
.
analogData
;
this
.
currentChatRoom
=
this
.
$props
.
currentChatRoomInfo
;
this
.
currentChatRoom
=
this
.
$props
.
currentChatRoomInfo
;
this
.
connect
();
this
.
myStompClient
=
this
.
$props
.
stompClient
;
//订阅
this
.
listChatroom
(
this
.
analogDataList
);
this
.
getCurrentMessageList
(
this
.
$props
.
currentChatRoomInfo
);
this
.
getCurrentMessageList
(
this
.
$props
.
currentChatRoomInfo
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
keepBottom
();
this
.
keepBottom
();
...
...
src/view/ddkz/components/noticeDialog.vue
View file @
11fdd99b
...
@@ -3,21 +3,21 @@
...
@@ -3,21 +3,21 @@
<div
class=
"notice"
>
<div
class=
"notice"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"80px"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"80px"
>
<el-form-item
label=
"标题"
>
<el-form-item
label=
"标题"
>
<el-input
v-model=
"form.
nam
e"
></el-input>
<el-input
v-model=
"form.
titl
e"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"内容"
>
<el-form-item
label=
"内容"
>
<el-input
type=
"textarea"
v-model=
"form.content"
></el-input>
<el-input
type=
"textarea"
v-model=
"form.content"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"附件"
>
<el-form-item
label=
"附件"
>
<el-upload
class=
"upload-demo"
drag
action=
"https://jsonplaceholder.typicode.com/posts/"
multiple
>
<el-upload
class=
"upload-demo"
action=
""
:on-change=
"handleChange"
:on-remove=
"handleRemove"
<i
class=
"el-icon-upload"
></i
>
:file-list=
"form.fileList"
:auto-upload=
"false"
multiple
:accept=
"formatFile"
>
<
div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em></div
>
<
el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button
>
<div
class=
"el-upload__tip"
slot=
"tip"
>
只能上传jpg/png文件,且不超过500kb
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
支持导入word,pdf,ppt,mlf,xls!!!
</div>
</el-upload>
</el-upload>
</el-form-item>
</el-form-item>
<el-form-item
style=
"text-align: center;"
>
<el-form-item
style=
"text-align: center;"
>
<el-button
type=
"default"
>
取消
</el-button>
<el-button
type=
"default"
>
取消
</el-button>
<el-button
type=
"success"
>
发送
</el-button>
<el-button
type=
"success"
@
click=
"sendNotice"
>
发送
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
...
@@ -26,27 +26,66 @@
...
@@ -26,27 +26,66 @@
<
script
>
<
script
>
import
{
upLoadFiles
}
from
'
../../../api/chat/chatRoom
'
;
import
{
format_file
}
from
'
../../../util/http_util
'
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
dialogVisible
:
false
,
dialogVisible
:
false
,
form
:
{
form
:
{
nam
e
:
''
,
titl
e
:
''
,
content
:
''
,
content
:
''
,
attachment
:
''
}
},
formatFile
:
format_file
(),
myStompClient
:
null
,
currentChatRoom
:
{},
analogDataList
:
[],
}
}
},
},
props
:
{
props
:
{
visible
:
Boolean
visible
:
Boolean
,
stompClient
:
Object
,
currentChatRoomInfo
:
Object
,
analogData
:
Array
},
},
methods
:
{
methods
:
{
handleClose
()
{
handleClose
()
{
this
.
$emit
(
'
handleCancel
'
);
this
.
$emit
(
'
handleCancel
'
);
}
},
handleChange
(
file
,
fileList
)
{
let
fd
=
new
FormData
();
fd
.
append
(
'
file
'
,
file
.
raw
);
upLoadFiles
(
'
CHAT
'
,
fd
).
then
(
res
=>
{
this
.
form
.
attachment
=
res
;
});
},
handleRemove
()
{
},
sendNotice
()
{
this
.
myStompClient
.
send
(
`/app/sendToChatRoom/
${
this
.
currentChatRoom
.
id
}
/
${
this
.
currentChatRoom
.
teamId
}
`
,
{},
JSON
.
stringify
(
this
.
form
));
},
listChatroom
(
data
)
{
//取消群聊的订阅
for
(
const
sub
in
this
.
stompClient
.
subscriptions
)
{
if
(
sub
.
startsWith
(
"
multicast
"
))
{
this
.
stompClient
.
unsubscribe
(
sub
);
}
}
data
.
forEach
(
e
=>
{
//订阅聊天室主题,订阅功能中设置ID:
this
.
stompClient
.
subscribe
(
'
/topic/multicast/
'
+
e
.
id
,
data
=>
{
this
.
$emit
(
'
handleCancel
'
);
this
.
$emit
(
'
showInfo
'
,
true
,
this
.
currentChatRoom
);
},
{
id
:
"
multicast
"
+
e
.
id
+
new
Date
().
getTime
()
});
})
},
},
},
mounted
()
{
mounted
()
{
this
.
dialogVisible
=
this
.
$props
.
visible
;
this
.
dialogVisible
=
this
.
$props
.
visible
;
this
.
myStompClient
=
this
.
$props
.
stompClient
;
this
.
currentChatRoom
=
this
.
$props
.
currentChatRoomInfo
;
this
.
analogDataList
=
this
.
$props
.
analogData
;
this
.
listChatroom
(
this
.
analogDataList
);
}
}
}
}
</
script
>
</
script
>
...
@@ -67,7 +106,8 @@ export default {
...
@@ -67,7 +106,8 @@ export default {
.el-dialog__header
{
.el-dialog__header
{
text-align
:
center
;
text-align
:
center
;
.el-dialog__headerbtn
{
.el-dialog__headerbtn
{
top
:
40px
;
top
:
40px
;
}
}
}
}
...
@@ -79,8 +119,12 @@ export default {
...
@@ -79,8 +119,12 @@ export default {
background-color
:
transparent
;
background-color
:
transparent
;
}
}
.el-upload-dragger
{
.el-upload-dragger
{
background-color
:
transparent
;
background-color
:
transparent
;
}
}
}
.el-upload-list__item-name
[
class
^=
"el-icon"
]
{
height
:
unset
!
important
;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/view/ddkz/ddkzzs.vue
View file @
11fdd99b
...
@@ -142,9 +142,10 @@
...
@@ -142,9 +142,10 @@
</div>
</div>
</div>
</div>
</transition>
</transition>
<noticeDialog-a
v-if=
"visible"
:visible=
"visible"
@
handleCancel=
"closeDialog"
></noticeDialog-a>
<NoticeDialog
v-if=
"visible"
:visible=
"visible"
@
handleCancel=
"closeDialog"
:stompClient=
"stompClient"
:currentChatRoomInfo=
"currentChatRoomInfo"
:analogData=
"analogData"
@
showInfo=
"showInfo"
></NoticeDialog>
<ChatRoomDialog
v-if=
"chatRoomVisible"
:visible=
"chatRoomVisible"
@
handleCancel=
"closeDialogChatRoom"
<ChatRoomDialog
v-if=
"chatRoomVisible"
:visible=
"chatRoomVisible"
@
handleCancel=
"closeDialogChatRoom"
:analogData=
"analogData"
:currentChatRoomInfo=
"currentChatRoomInfo
"
>
:analogData=
"analogData"
:currentChatRoomInfo=
"currentChatRoomInfo"
:stompClient=
"stompClient
"
>
</ChatRoomDialog>
</ChatRoomDialog>
<ChatRoomPeople
v-if=
"chatRoomPeopleVisible"
:visible=
"chatRoomPeopleVisible"
<ChatRoomPeople
v-if=
"chatRoomPeopleVisible"
:visible=
"chatRoomPeopleVisible"
@
handleCancel=
"closeDialogChatRoomPeople"
:peopleList=
"peopleList"
></ChatRoomPeople>
@
handleCancel=
"closeDialogChatRoomPeople"
:peopleList=
"peopleList"
></ChatRoomPeople>
...
@@ -177,6 +178,7 @@ import ChatRoomDialog from "./components/chatRoomDialog.vue";
...
@@ -177,6 +178,7 @@ import ChatRoomDialog from "./components/chatRoomDialog.vue";
import
ChatRoomPeople
from
"
./components/chatRoomPeople.vue
"
;
import
ChatRoomPeople
from
"
./components/chatRoomPeople.vue
"
;
import
{
getChatRoomList
,
getChatRoomInfo
}
from
"
../../api/chat/chatRoom
"
;
import
{
getChatRoomList
,
getChatRoomInfo
}
from
"
../../api/chat/chatRoom
"
;
import
{
getRecordsByPaging
}
from
'
../../api/chat/chatRecords
'
;
import
{
getRecordsByPaging
}
from
'
../../api/chat/chatRecords
'
;
import
'
../../util/stomp.min.js
'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -397,11 +399,13 @@ export default {
...
@@ -397,11 +399,13 @@ export default {
chatRoomPeopleVisible
:
false
,
chatRoomPeopleVisible
:
false
,
peopleList
:
[],
peopleList
:
[],
// chatMessageList: [],
// chatMessageList: [],
currentChatRoomInfo
:
{}
currentChatRoomInfo
:
{},
stompClient
:
''
,
ws
:
null
}
}
},
},
components
:
{
components
:
{
'
noticeDialog-a
'
:
NoticeDialog
,
NoticeDialog
:
NoticeDialog
,
ChatRoomDialog
:
ChatRoomDialog
,
ChatRoomDialog
:
ChatRoomDialog
,
ChatRoomPeople
:
ChatRoomPeople
ChatRoomPeople
:
ChatRoomPeople
},
},
...
@@ -416,7 +420,6 @@ export default {
...
@@ -416,7 +420,6 @@ export default {
//查询聊天组的人员
//查询聊天组的人员
getChatRoomInfo
(
item
.
id
,
this
.
userInfo
.
account
).
then
(
res
=>
{
getChatRoomInfo
(
item
.
id
,
this
.
userInfo
.
account
).
then
(
res
=>
{
this
.
peopleList
=
res
.
chatRoomMemberRelationBOList
;
this
.
peopleList
=
res
.
chatRoomMemberRelationBOList
;
});
});
//分页查询群聊天记录
//分页查询群聊天记录
getRecordsByPaging
(
item
.
id
,
1
,
100
,
'
2020-01-01 00:00:00
'
,
'
2023-10-01 00:00:00
'
).
then
(
res1
=>
{
getRecordsByPaging
(
item
.
id
,
1
,
100
,
'
2020-01-01 00:00:00
'
,
'
2023-10-01 00:00:00
'
).
then
(
res1
=>
{
...
@@ -483,6 +486,23 @@ export default {
...
@@ -483,6 +486,23 @@ export default {
},
},
sendEmail
()
{
sendEmail
()
{
alert
(
'
敬请期待
'
);
alert
(
'
敬请期待
'
);
},
connect
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ws
=
new
WebSocket
(
`ws://192.168.168.106:8081/websocket/my-websocket`
);
this
.
stompClient
&&
this
.
stompClient
.
connected
&&
this
.
stompClient
.
disconnect
();
this
.
stompClient
=
Stomp
.
over
(
this
.
ws
);
this
.
stompClient
.
heartbeat
.
outgoing
=
20000
;
//若使用STOMP 1.1 版本,默认开启了心跳检测机制(默认值都是10000ms)
this
.
stompClient
.
heartbeat
.
incoming
=
0
;
//客户端不从服务端接收心跳包
this
.
stompClient
.
connect
({
name
:
this
.
userInfo
.
account
},
frame
=>
{
resolve
(
"
连接成功
"
)
},
err
=>
{
console
.
log
(
typeof
err
==
"
string
"
?
err
:
err
.
headers
.
message
)
reject
(
typeof
err
==
"
string
"
?
err
:
err
.
headers
.
message
)
});
})
}
}
},
},
computed
:
{
computed
:
{
...
@@ -496,6 +516,7 @@ export default {
...
@@ -496,6 +516,7 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
queryChatRoomListFn
();
this
.
queryChatRoomListFn
();
this
.
connect
();
}
}
}
}
</
script
>
</
script
>
...
...
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