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
a971c771
Commit
a971c771
authored
Jul 01, 2021
by
卢均锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改调起im方法
parent
a2e06d5c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
im.tsx
src/utils/im.tsx
+22
-3
No files found.
src/utils/im.tsx
View file @
a971c771
import
React
from
'react'
;
import
{
Button
,
notification
,
message
}
from
'antd'
;
import
{
GlobalConfig
}
from
'@/global/config'
import
{
PublicApi
}
from
'@/services/api'
;
import
{
REQUEST_HEADER
,
TOP_DOMAIN
,
ENTERPRISE_CENTER_URL
,
ICHANNEL_CENTER_URL
}
from
'@/constants'
;
import
{
REQUEST_HEADER
,
TOP_DOMAIN
,
ENTERPRISE_CENTER_URL
,
CHANNEL_CENTER_URL
,
ICHANNEL_CENTER_URL
}
from
'@/constants'
;
import
{
getAuth
}
from
'@/utils/auth'
;
const
DOMAIN
=
`.
${
TOP_DOMAIN
}
`
;
//document.domain
...
...
@@ -11,14 +12,20 @@ const COOKIEPREFIX = 'CHATROOM_';
// 主动调起聊天室 mmeberId 为接收人的memberId
export
const
toChatRoom
=
(
memberId
:
string
=
''
,
shopType
:
number
=
1
)
=>
{
let
_curUserInfo
=
getAuth
();
let
_curUserInfo
:
any
=
getAuth
();
if
(
!
memberId
)
{
document
.
cookie
=
`
${
COOKIEPREFIX
}
userToken=
${
_curUserInfo
.
token
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
userMemberId=
${
_curUserInfo
.
memberId
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
userMemberType=
${
_curUserInfo
.
memberType
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
userUserId=
${
_curUserInfo
.
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
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
channelRootRoute=
${
GlobalConfig
.
channelRootRoute
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ichannelRootRoute=
${
GlobalConfig
.
ichannelRootRoute
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
shopRootRoute=shop;path=/;domain=
${
DOMAIN
}
`
;
window
.
open
(
CHATROOM_URL
);
return
;
}
...
...
@@ -39,10 +46,16 @@ export const toChatRoom = (memberId: string = '', shopType: number = 1) => {
document
.
cookie
=
`
${
COOKIEPREFIX
}
curUserId=
${
_userId
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
userToken=
${
_curUserInfo
.
token
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
userMemberId=
${
_curUserInfo
.
memberId
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
userMemberType=
${
_curUserInfo
.
memberType
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
userUserId=
${
_curUserInfo
.
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
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
channelRootRoute=
${
GlobalConfig
.
channelRootRoute
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
ichannelRootRoute=
${
GlobalConfig
.
ichannelRootRoute
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
shopRootRoute=shop;path=/;domain=
${
DOMAIN
}
`
;
window
.
open
(
CHATROOM_URL
);
}
else
{
message
.
error
(
'该会员底下没有客服!'
);
...
...
@@ -59,7 +72,7 @@ interface NotificationChatRoomProps {
// 被动从websocket调起聊天室
export
const
notificationChatRoom
=
(
props
:
NotificationChatRoomProps
)
=>
{
const
{
detail
}
=
props
const
_curUserInfo
=
getAuth
();
const
_curUserInfo
:
any
=
getAuth
();
const
close
=
()
=>
{
console
.
log
(
'Notification was closed. Either the close button was clicked or duration time elapsed.'
,
...
...
@@ -70,10 +83,16 @@ export const notificationChatRoom = (props: NotificationChatRoomProps) => {
<
Button
type=
"primary"
size=
"small"
onClick=
{
()
=>
{
document
.
cookie
=
`${COOKIEPREFIX}userToken=${_curUserInfo.token};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}userMemberId=${_curUserInfo.memberId};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}userMemberType=${_curUserInfo.memberType};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}userUserId=${_curUserInfo.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}`
;
document
.
cookie
=
`${COOKIEPREFIX}channelRootRoute=${GlobalConfig.channelRootRoute};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}ichannelRootRoute=${GlobalConfig.ichannelRootRoute};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}shopRootRoute=shop;path=/;domain=${DOMAIN}`
;
window
.
open
(
CHATROOM_URL
);
notification
.
close
(
key
)
}
}
>
...
...
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