提交 da2a257f 作者: ZhangLingKun

功能:消息管理-客服消息切换客服

上级 5ac9498e
流水线 #9045 已通过 于阶段
in 1 分 3 秒
...@@ -5,9 +5,10 @@ import HeaderView from './header'; ...@@ -5,9 +5,10 @@ import HeaderView from './header';
import { MenuView } from './menu'; import { MenuView } from './menu';
import './index.scss'; import './index.scss';
import { TitleView } from './title'; import { TitleView } from './title';
import React from 'react';
const { Content } = Layout; const { Content } = Layout;
function LayoutView() { const LayoutView: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
return ( return (
<Layout className='layout-view'> <Layout className='layout-view'>
<TitleView /> <TitleView />
...@@ -17,10 +18,11 @@ function LayoutView() { ...@@ -17,10 +18,11 @@ function LayoutView() {
<HeaderView /> <HeaderView />
<Content className='layout-content'> <Content className='layout-content'>
<Outlet /> <Outlet />
{children}
</Content> </Content>
</Layout> </Layout>
</Layout> </Layout>
</Layout> </Layout>
); );
} };
export default LayoutView; export default LayoutView;
...@@ -100,7 +100,7 @@ export function MenuView() { ...@@ -100,7 +100,7 @@ export function MenuView() {
// 设置侧边栏数据 // 设置侧边栏数据
authRouterList().then(async (value) => { authRouterList().then(async (value) => {
// 除了数据看板,其他没有子项的菜单全部过滤掉 // 除了数据看板,其他没有子项的菜单全部过滤掉
const arr = getItem(value)?.filter((i: any) => i?.key === 100) || []; const arr = getItem(value)?.filter((i: any) => [100, 1400]?.includes(i?.key)) || [];
const brr = getItem(value)?.filter((i: any) => i?.children?.length) || []; const brr = getItem(value)?.filter((i: any) => i?.children?.length) || [];
// 设置要展示的菜单列表 // 设置要展示的菜单列表
setItems([...arr, ...brr]); setItems([...arr, ...brr]);
......
import React from 'react';
import { InterDataType } from '~/api/interface';
import { listUserAndRoleByCompanyIdType } from '~/api/interface/systemManageType';
// 角色列表
type RoleType = InterDataType<listUserAndRoleByCompanyIdType>;
const MessageChatRole: React.FC<{
roleList: RoleType;
userAccountId?: number;
onSelect: (data: RoleType[0]) => void;
}> = ({ roleList, userAccountId, onSelect }) => {
// 选择事件
const handleSelect = (data: RoleType[0]) => {
onSelect?.(data);
};
return (
<div className={'message-chat-role'}>
{roleList?.map((i, j) => (
<div
className={`role-item flex-start ${userAccountId === i?.userAccountId && 'item-active'}`}
key={j}
onClick={() => handleSelect(i)}
>
<img className={'image'} src={i?.userAccountVO?.userImg} alt={i?.roleName} />
<div className='content flex-start'>
<div
className='title text-ellipsis'
title={i?.userAccountVO?.nickName || i?.userAccountVO?.userName}
>
{i?.userAccountVO?.nickName || i?.userAccountVO?.userName}
</div>
<div className='role'>{i?.roleName}</div>
</div>
</div>
))}
</div>
);
};
export default MessageChatRole;
...@@ -4,6 +4,73 @@ ...@@ -4,6 +4,73 @@
box-sizing: border-box; box-sizing: border-box;
align-items: flex-start !important; align-items: flex-start !important;
&-role{
position: relative;
width: 58px;
box-sizing: border-box;
overflow: hidden;
transform: translateX(-6px);
transition: all 168ms ease-in-out;
min-height: 84vh;
background: #F6F6F6;
border-radius: 8px;
&:hover {
width: 160px;
}
.role-item{
position: relative;
box-sizing: border-box;
padding: 10px;
border-radius: 8px;
cursor: pointer;
flex-wrap: nowrap;
transition: all 100ms ease-in-out;
&:hover {
background: rgba(233, 240, 254, 0.5);
}
.image {
width: 40px;
height: 40px;
border-radius: 50%;
object-fit: fill;
margin-right: 8px;
}
.content{
position: relative;
box-sizing: border-box;
width: 86px;
flex-direction: column;
align-items: flex-start;
.title{
max-width: 86px;
color: #000000;
font-weight: bold;
margin-bottom: 8px;
}
.role{
position: relative;
box-sizing: border-box;
height: 16px;
background: linear-gradient(270deg, #fff1ec 0%, #ffffff 54%, #ffe5db 100%);
border-radius: 4px;
border: 1px solid #ffb099;
padding: 0 4px;
line-height: 14px;
text-align: center;
font-weight: 500;
font-size: 10px;
color: #ff521e;
}
}
}
.item-active{
background: #E9F0FE;
&:hover {
background: #E9F0FE;
}
}
}
&-list { &-list {
position: relative; position: relative;
width: 300px; width: 300px;
...@@ -21,6 +88,7 @@ ...@@ -21,6 +88,7 @@
padding: 10px; padding: 10px;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
transition: all 100ms ease-in-out;
&:hover { &:hover {
background: rgba(233, 240, 254, 0.35); background: rgba(233, 240, 254, 0.35);
...@@ -193,6 +261,11 @@ ...@@ -193,6 +261,11 @@
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
line-height: 16px; line-height: 16px;
.text{
img{
max-width: 100% !important;
}
}
} }
} }
} }
...@@ -228,14 +301,14 @@ ...@@ -228,14 +301,14 @@
padding: 30px 0 0 0; padding: 30px 0 0 0;
.qrcode-view{ .qrcode-view{
position: relative; position: relative;
width: 140px; width: 128px;
box-sizing: border-box; box-sizing: border-box;
margin: 0 auto; margin: 0 auto;
} }
.qrcode-text{ .qrcode-text{
width: 100%; width: 100%;
font-weight: 400; font-weight: 400;
font-size: 14px; font-size: 13px;
color: #666666; color: #666666;
text-align: center; text-align: center;
margin-top: 30px; margin-top: 30px;
......
...@@ -5,13 +5,19 @@ import MessageChatListView from '~/pages/messageManage/messageChat/comp/messageC ...@@ -5,13 +5,19 @@ import MessageChatListView from '~/pages/messageManage/messageChat/comp/messageC
import { SystemManageAPI } from '~/api'; import { SystemManageAPI } from '~/api';
import { isNull } from 'lodash'; import { isNull } from 'lodash';
import { InterDataType } from '~/api/interface'; import { InterDataType } from '~/api/interface';
import { selectUserListType } from '~/api/interface/systemManageType'; import {
listUserAndRoleByCompanyIdType,
selectUserListType,
} from '~/api/interface/systemManageType';
import MessageChatContentView from 'src/pages/messageManage/messageChat/comp/messageChatContent'; import MessageChatContentView from 'src/pages/messageManage/messageChat/comp/messageChatContent';
import QrcodeView from '~/components/qrcodeView'; import QrcodeView from '~/components/qrcodeView';
import MessageChatSystemView from '~/pages/messageManage/messageChat/comp/messageChatSystem'; import MessageChatSystemView from '~/pages/messageManage/messageChat/comp/messageChatSystem';
import MessageChatRole from '~/pages/messageManage/messageChat/comp/MessageChatRole';
// 消息类型 // 消息类型
type MessageType = InterDataType<selectUserListType>; type MessageType = InterDataType<selectUserListType>;
// 角色列表
type RoleType = InterDataType<listUserAndRoleByCompanyIdType>;
// 定时任务 // 定时任务
let intervalTimer: NodeJS.Timer; let intervalTimer: NodeJS.Timer;
...@@ -21,6 +27,8 @@ const MessageChatPage: React.FC = () => { ...@@ -21,6 +27,8 @@ const MessageChatPage: React.FC = () => {
const { userInfo } = useSelector((state: any) => state.UserInfo); const { userInfo } = useSelector((state: any) => state.UserInfo);
// 用户id // 用户id
const [userAccountId, setUserAccountId] = useState<number>(); const [userAccountId, setUserAccountId] = useState<number>();
// 角色列表
const [roleList, setRoleList] = useState<RoleType>([]);
// 获取用户id // 获取用户id
const getUserAccountId = async () => { const getUserAccountId = async () => {
const res = await SystemManageAPI.listUserAndRoleByCompanyId({ const res = await SystemManageAPI.listUserAndRoleByCompanyId({
...@@ -28,6 +36,7 @@ const MessageChatPage: React.FC = () => { ...@@ -28,6 +36,7 @@ const MessageChatPage: React.FC = () => {
}); });
if (res && res.code === '200') { if (res && res.code === '200') {
if (res.result?.[0]?.userAccountId) { if (res.result?.[0]?.userAccountId) {
setRoleList(res.result || []);
setUserAccountId(res.result?.[0]?.userAccountId); setUserAccountId(res.result?.[0]?.userAccountId);
} else { } else {
// message.error('获取用户id失败'); // message.error('获取用户id失败');
...@@ -104,6 +113,13 @@ const MessageChatPage: React.FC = () => { ...@@ -104,6 +113,13 @@ const MessageChatPage: React.FC = () => {
}, [userAccountId]); }, [userAccountId]);
return ( return (
<div className='message-chat flex-start'> <div className='message-chat flex-start'>
{!!userAccountId && (
<MessageChatRole
roleList={roleList}
userAccountId={userAccountId}
onSelect={(data) => setUserAccountId(data?.userAccountId)}
/>
)}
<MessageChatListView <MessageChatListView
messageList={messageList} messageList={messageList}
current={currentIndex} current={currentIndex}
...@@ -121,16 +137,16 @@ const MessageChatPage: React.FC = () => { ...@@ -121,16 +137,16 @@ const MessageChatPage: React.FC = () => {
userAccountId={userAccountId} userAccountId={userAccountId}
/> />
) : null} ) : null}
{isSystem ? <MessageChatSystemView /> : null} {isSystem && <MessageChatSystemView />}
</div> </div>
<div className='message-chat-qrcode'> {!!getQrcodePathQuery()?.id && (
<div className='qrcode-view'> <div className='message-chat-qrcode'>
{getQrcodePathQuery()?.id ? ( <div className='qrcode-view'>
<QrcodeView path={getQrcodePathQuery()?.path} scene={getQrcodePathQuery()?.scene} /> <QrcodeView path={getQrcodePathQuery()?.path} scene={getQrcodePathQuery()?.scene} />
) : null} </div>
<div className='qrcode-text'>扫码进入小程序店铺</div>
</div> </div>
<div className='qrcode-text'>扫码进入小程序店铺</div> )}
</div>
</div> </div>
); );
}; };
......
...@@ -1455,25 +1455,17 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -1455,25 +1455,17 @@ export const routerList: Array<RouteObjectType> = [
], ],
}, },
{ {
path: '/messageManage', path: '/messageManage/messageChat',
element: <LayoutView />, element: (
<LayoutView>
<MessageChatPage />
</LayoutView>
),
errorElement: <ErrorPage />, errorElement: <ErrorPage />,
meta: { meta: {
id: 1400, id: 1400,
icon: <CommentOutlined />, icon: <CommentOutlined />,
title: '消息管理', title: '消息管理',
}, },
children: [
{
path: '/messageManage/messageChat',
element: withLoadingComponent(<MessageChatPage />),
errorElement: <ErrorPage />,
meta: {
id: 1410,
title: '客服消息',
icon: <CommentOutlined />,
},
},
],
}, },
]; ];
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论