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
黄庭坚
jinfa-platform
Commits
5806a28f
Commit
5806a28f
authored
Sep 18, 2021
by
前端-黄佳鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into v2
parents
d4ec8de0
155a3d61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
73 deletions
+76
-73
im.tsx
src/utils/im.tsx
+76
-73
No files found.
src/utils/im.tsx
View file @
5806a28f
...
@@ -12,90 +12,93 @@ const COOKIEPREFIX = 'CHATROOM_';
...
@@ -12,90 +12,93 @@ const COOKIEPREFIX = 'CHATROOM_';
// 主动调起聊天室 mmeberId 为接收人的memberId
// 主动调起聊天室 mmeberId 为接收人的memberId
export
const
toChatRoom
=
(
memberId
:
string
=
''
,
shopType
:
number
=
1
)
=>
{
export
const
toChatRoom
=
(
memberId
:
string
=
''
,
shopType
:
number
=
1
)
=>
{
if
(
!
memberId
)
{
if
(
!
memberId
)
{
document
.
cookie
=
`
${
COOKIEPREFIX
}
curMemberId="";path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
curMemberId="";path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
curUserId="";path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
curUserId="";path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
shopType=
${
shopType
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ENTERPRISE_CENTER_URL=
${
ENTERPRISE_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
CHANNEL_CENTER_URL=
${
CHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ICHANNEL_CENTER_URL=
${
ICHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
origin=
${
window
.
location
.
origin
}
;path=/;domain=
${
DOMAIN
}
`
;
window
.
open
(
CHATROOM_URL
);
return
;
}
const
_params
:
any
=
{
memberId
}
PublicApi
.
getMessageImHistorySession
(
_params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
let
_userId
=
''
;
const
_list
=
res
.
data
;
if
(
_list
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
_list
.
length
;
i
++
)
{
if
(
_list
[
i
].
userList
.
length
>
0
)
{
_userId
=
_list
[
i
].
userList
[
0
].
userId
;
break
;
}
}
}
if
(
_userId
)
{
document
.
cookie
=
`
${
COOKIEPREFIX
}
curMemberId=
${
memberId
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
curUserId=
${
_userId
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
shopType=
${
shopType
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
shopType=
${
shopType
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ENTERPRISE_CENTER_URL=
${
ENTERPRISE_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ENTERPRISE_CENTER_URL=
${
ENTERPRISE_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
CHANNEL_CENTER_URL=
${
CHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
CHANNEL_CENTER_URL=
${
CHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ICHANNEL_CENTER_URL=
${
ICHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ICHANNEL_CENTER_URL=
${
ICHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
origin=
${
window
.
location
.
origin
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
origin=
${
window
.
location
.
origin
}
;path=/;domain=
${
DOMAIN
}
`
;
window
.
open
(
CHATROOM_URL
);
window
.
open
(
CHATROOM_URL
);
return
;
}
else
{
message
.
error
(
'该会员底下没有客服!'
);
}
}
}
PublicApi
.
getMessageImHistorySession
({
memberId
:
memberId
}).
then
(
res
=>
{
})
if
(
res
.
code
===
1000
)
{
let
_userId
=
''
;
const
_list
=
res
.
data
;
if
(
_list
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
_list
.
length
;
i
++
)
{
if
(
_list
[
i
].
userList
.
length
>
0
)
{
_userId
=
_list
[
i
].
userList
[
0
].
userId
;
break
;
}
}
}
if
(
_userId
)
{
document
.
cookie
=
`
${
COOKIEPREFIX
}
curMemberId=
${
memberId
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
curUserId=
${
_userId
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
shopType=
${
shopType
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ENTERPRISE_CENTER_URL=
${
ENTERPRISE_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
CHANNEL_CENTER_URL=
${
CHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ICHANNEL_CENTER_URL=
${
ICHANNEL_CENTER_URL
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
origin=
${
window
.
location
.
origin
}
;path=/;domain=
${
DOMAIN
}
`
;
window
.
open
(
CHATROOM_URL
);
}
else
{
message
.
error
(
'该会员底下没有客服!'
);
}
}
})
}
}
// 被动从websocket调起聊天室
// 被动从websocket调起聊天室
export
const
notificationChatRoom
=
(
content
:
any
)
=>
{
export
const
notificationChatRoom
=
(
content
:
any
)
=>
{
const
_curUserInfo
:
any
=
getAuth
();
const
_curUserInfo
:
any
=
getAuth
();
const
close
=
()
=>
{
const
close
=
()
=>
{
console
.
log
(
console
.
log
(
'Notification was closed. Either the close button was clicked or duration time elapsed.'
,
'Notification was closed. Either the close button was clicked or duration time elapsed.'
,
);
};
const
key
=
`open
${
Date
.
now
()}
`
;
const
btn
=
(
<
Button
type=
"primary"
size=
"small"
onClick=
{
()
=>
{
document
.
cookie
=
`${COOKIEPREFIX}curMemberId=${content.desc.fromMemberId};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}curUserId=${content.desc.fromUserId};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}shopType=${content.desc.shopType};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}ENTERPRISE_CENTER_URL=${ENTERPRISE_CENTER_URL};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}CHANNEL_CENTER_URL=${CHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}ICHANNEL_CENTER_URL=${ICHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}origin=${window.location.origin};path=/;domain=${DOMAIN}`
;
window
.
open
(
CHATROOM_URL
);
notification
.
close
(
key
)
}
}
>
查看
</
Button
>
);
);
let
_text
=
''
;
};
if
(
content
.
data
.
text
)
{
const
key
=
`open
${
Date
.
now
()}
`
;
_text
=
content
.
data
.
text
;
const
btn
=
(
}
else
if
(
content
.
data
.
img
)
{
<
Button
type=
"primary"
size=
"small"
onClick=
{
()
=>
{
_text
=
'[图片]'
;
document
.
cookie
=
`${COOKIEPREFIX}curMemberId=${content.desc.fromMemberId};path=/;domain=${DOMAIN}`
;
}
else
if
(
content
.
data
.
file
)
{
document
.
cookie
=
`${COOKIEPREFIX}curUserId=${content.desc.fromUserId};path=/;domain=${DOMAIN}`
;
_text
=
'[文件]'
;
document
.
cookie
=
`${COOKIEPREFIX}shopType=${content.desc.shopType};path=/;domain=${DOMAIN}`
;
}
else
if
(
content
.
data
.
order
)
{
document
.
cookie
=
`${COOKIEPREFIX}ENTERPRISE_CENTER_URL=${ENTERPRISE_CENTER_URL};path=/;domain=${DOMAIN}`
;
_text
=
'[订单]'
;
document
.
cookie
=
`${COOKIEPREFIX}CHANNEL_CENTER_URL=${CHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`
;
}
else
if
(
content
.
data
.
goods
)
{
document
.
cookie
=
`${COOKIEPREFIX}ICHANNEL_CENTER_URL=${ICHANNEL_CENTER_URL};path=/;domain=${DOMAIN}`
;
_text
=
'[商品]'
;
document
.
cookie
=
`${COOKIEPREFIX}origin=${window.location.origin};path=/;domain=${DOMAIN}`
;
}
else
if
(
content
.
data
.
sale
)
{
window
.
open
(
CHATROOM_URL
);
_text
=
'[售后]'
;
notification
.
close
(
key
)
}
}
}
>
notification
.
open
({
查看
message
:
'你收到一条消息'
,
</
Button
>
description
:
<
Typography
.
Text
ellipsis
>
{
_text
}
</
Typography
.
Text
>,
);
btn
,
let
_text
=
''
;
key
,
if
(
content
.
data
.
text
)
{
duration
:
10
,
_text
=
content
.
data
.
text
;
onClose
:
close
,
}
else
if
(
content
.
data
.
img
)
{
});
_text
=
'[图片]'
;
}
else
if
(
content
.
data
.
file
)
{
_text
=
'[文件]'
;
}
else
if
(
content
.
data
.
order
)
{
_text
=
'[订单]'
;
}
else
if
(
content
.
data
.
goods
)
{
_text
=
'[商品]'
;
}
else
if
(
content
.
data
.
sale
)
{
_text
=
'[售后]'
;
}
notification
.
open
({
message
:
'你收到一条消息'
,
description
:
<
Typography
.
Text
style=
{
{
width
:
200
}
}
ellipsis
>
{
_text
}
</
Typography
.
Text
>,
btn
,
key
,
duration
:
10
,
onClose
:
close
,
});
}
}
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