Commit 236271f6 authored by 卢均锐's avatar 卢均锐

feat: 修改im工具类,缓存信息增加memberType

parent 89551314
......@@ -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 })
......
......@@ -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)
}}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment