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
236271f6
Commit
236271f6
authored
Jul 08, 2021
by
卢均锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改im工具类,缓存信息增加memberType
parent
89551314
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
26 deletions
+4
-26
auth.ts
src/utils/auth.ts
+3
-1
im.tsx
src/utils/im.tsx
+1
-25
No files found.
src/utils/auth.ts
View file @
236271f6
...
...
@@ -8,6 +8,7 @@ export interface AuthInfo {
urls
:
string
[]
userId
:
number
,
memberId
:
number
,
memberType
:
number
,
name
:
string
,
token
:
string
,
logo
:
string
,
...
...
@@ -30,7 +31,8 @@ export const setAuth = (info: AuthInfo) => {
levelTag
:
info
.
levelTag
,
creditPoint
:
info
.
creditPoint
,
memberRoleType
:
info
.
memberRoleType
,
memberRoleId
:
info
.
memberRoleId
memberRoleId
:
info
.
memberRoleId
,
memberType
:
info
.
memberType
,
}
setCookie
(
AUTH_KEY
,
JSON
.
stringify
(
auth
),
{
domain
:
TOP_DOMAIN
})
setCookie
(
AUTH_ROLES_KEY
,
JSON
.
stringify
(
info
.
roles
),
{
domain
:
TOP_DOMAIN
})
...
...
src/utils/im.tsx
View file @
236271f6
...
...
@@ -14,19 +14,11 @@ const COOKIEPREFIX = 'CHATROOM_';
export
const
toChatRoom
=
(
memberId
:
string
=
''
,
shopType
:
number
=
1
)
=>
{
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
}
userMemberRoleId=
${
_curUserInfo
.
memberRoleId
}
;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
;
}
...
...
@@ -43,21 +35,13 @@ export const toChatRoom = (memberId: string = '', shopType: number = 1) => {
}
}
if
(
_userId
)
{
document
.
cookie
=
`
${
COOKIEPREFIX
}
curMemberId=
${
70
}
;path=/;domain=
${
DOMAIN
}
`
;
document
.
cookie
=
`
${
COOKIEPREFIX
}
curMemberId=
${
memberId
}
;path=/;domain=
${
DOMAIN
}
`
;
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
}
userMemberRoleId=
${
_curUserInfo
.
memberRoleId
}
;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
(
'该会员底下没有客服!'
);
...
...
@@ -80,19 +64,11 @@ export const notificationChatRoom = (content: any) => {
<
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}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}userMemberRoleId=${_curUserInfo.memberRoleId};path=/;domain=${DOMAIN}`
;
document
.
cookie
=
`${COOKIEPREFIX}userUserId=${_curUserInfo.userId};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}`
;
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