开发: 修改页面, 修改引入录音js

This commit is contained in:
zhengw
2023-04-19 15:30:29 +08:00
parent 079739223a
commit 21c1790dc4
15 changed files with 423 additions and 545 deletions

View File

@@ -136,6 +136,7 @@ export default defineConfig({
headScripts: [
// 解决首次加载时白屏的问题
{ src: '/scripts/loading.js', async: true },
{ src: '/scripts/amrnb.js', async: true },
],
//================ pro 插件配置 =================
presets: ['umi-presets-pro'],

View File

@@ -54,10 +54,17 @@ export interface ICustFollow {
state: number;
sync_time: string;
tags: string;
add_way: number;
create_time: string;
user_id: string;
}
export interface IGroup {
admin_list: string;
adminUserIDs: string[];
create_time: string;
group_id: string;
name: string;

View File

@@ -60,6 +60,27 @@ export const adminList = (data: any, groupMembers: any) => {
return <></>;
};
/**
* 返回群管理员 userid 数组
* @param data
* @returns
*/
export const getAdminList = (data: any) => {
if (data) {
try {
const msg = JSON.parse(data);
if (Array.isArray(msg)) {
let arr: string[] = [];
msg.forEach((item) => {
arr.push(item.userid);
});
return arr;
}
} catch (e) {}
}
return [];
};
/**
* 客户等级等信息

View File

@@ -7,28 +7,34 @@ export const Gender: React.FC<IProps> = (props) => {
{props?.gender ? (
<>
{props?.gender == 1 ? (
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M828.875 765.657c-191.159-16.86-202.516-102.922-202.516-102.922v-85.997c111.656-43.063 145.76-207.699 145.76-207.699 0-65.457-32.153-67.281-32.153-67.281V195.093c7.486-177.753-100.33-136.61-102.25-136.61-1.791 0-60.466-46.774-60.466-46.774-41.751-31.8-134.499 11.262-134.499 11.262l-3.839 0.064c-104.937 2.751-132.387 78.479-132.387 78.479l1.92 196.437c-54.804 0-47.35 76.719-47.35 76.719 0 84.142 147.616 200.148 147.616 200.148 9.47 110.472-49.174 166.46-49.174 166.46s-100.266 3.711-213.84 37.432c-2.72 0.863-5.344 1.6-7.967 2.463C30.617 817.421 0 920.855 0 920.855v101.033l463.579 1.888 68.465-1.92h491.732V943.25c1.92-115.815-194.901-177.593-194.901-177.593z m-244.65 129.22l-71.25 128.675-69.616-128.676-16.124-64.05 30.68-136.354h111.656l29.178 136.354-14.525 64.05z"
fill="#1890ff"
></path>
</svg>
<span title="男" style={{ display: 'inline-flex', alignItems: 'center' }}>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M828.875 765.657c-191.159-16.86-202.516-102.922-202.516-102.922v-85.997c111.656-43.063 145.76-207.699 145.76-207.699 0-65.457-32.153-67.281-32.153-67.281V195.093c7.486-177.753-100.33-136.61-102.25-136.61-1.791 0-60.466-46.774-60.466-46.774-41.751-31.8-134.499 11.262-134.499 11.262l-3.839 0.064c-104.937 2.751-132.387 78.479-132.387 78.479l1.92 196.437c-54.804 0-47.35 76.719-47.35 76.719 0 84.142 147.616 200.148 147.616 200.148 9.47 110.472-49.174 166.46-49.174 166.46s-100.266 3.711-213.84 37.432c-2.72 0.863-5.344 1.6-7.967 2.463C30.617 817.421 0 920.855 0 920.855v101.033l463.579 1.888 68.465-1.92h491.732V943.25c1.92-115.815-194.901-177.593-194.901-177.593z m-244.65 129.22l-71.25 128.675-69.616-128.676-16.124-64.05 30.68-136.354h111.656l29.178 136.354-14.525 64.05z"
fill="#1890ff"
></path>
</svg>
</span>
) : (
<svg viewBox="0 0 1025 1024" width="16" height="16">
<path
d="M613.312 626.496v-11.2h151.296V318.08c0-124.736-113.152-225.856-252.608-225.856S259.392 193.344 259.392 318.08v297.216h151.36v11.072h-0.256L115.648 820.16v107.136H908.48v-105.92l-295.168-194.88z m7.68 186.752c-72.192 69.824-109.504-36.416-109.504-36.416s-37.312 106.24-109.568 36.416c0 0-31.744-20.544-35.136-158.208l144.704 121.728L656.192 655.04c-3.392 137.6-35.2 158.208-35.2 158.208z"
fill="#1890ff"
></path>
</svg>
<span title="女" style={{ display: 'inline-flex', alignItems: 'center' }}>
<svg viewBox="0 0 1025 1024" width="16" height="16">
<path
d="M613.312 626.496v-11.2h151.296V318.08c0-124.736-113.152-225.856-252.608-225.856S259.392 193.344 259.392 318.08v297.216h151.36v11.072h-0.256L115.648 820.16v107.136H908.48v-105.92l-295.168-194.88z m7.68 186.752c-72.192 69.824-109.504-36.416-109.504-36.416s-37.312 106.24-109.568 36.416c0 0-31.744-20.544-35.136-158.208l144.704 121.728L656.192 655.04c-3.392 137.6-35.2 158.208-35.2 158.208z"
fill="#1890ff"
></path>
</svg>
</span>
)}
</>
) : (
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#1890ff"
></path>
</svg>
<span title="未知" style={{ display: 'inline-flex', alignItems: 'center' }}>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#1890ff"
></path>
</svg>
</span>
)}
</>
);

View File

@@ -0,0 +1,43 @@
export const OwnerSvg = () => {
return (
<span
title="创建者"
style={{
display: 'inline-flex',
alignItems: 'center',
position: 'absolute',
top: 0,
right: 0,
}}
>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#f4ea2a"
></path>
</svg>
</span>
);
};
export const AdminSvg = () => {
return (
<span
title="管理员"
style={{
display: 'inline-flex',
alignItems: 'center',
position: 'absolute',
top: 0,
right: 0,
}}
>
<svg viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M880.864 704.346c-56.813-25.397-141.118-90.818-265.945-113.298 31.924-34.36 56.084-88.097 80.937-151.754 14.403-36.893 11.935-68.343 11.935-113.121 0-33.073 6.193-86.156-1.97-115.329-27.533-98.59-97.1-125.79-178.61-125.79-81.577 0-151.229 27.328-178.71 126.087-8.097 29.083-1.888 82.044-1.888 115.037 0 44.875-2.422 76.432 12.019 113.383 25.044 63.984 48.854 117.644 80.655 151.86-123.826 22.89-207.498 87.822-263.95 113.138C58.523 756.945 57.95 814.296 57.95 814.296v97.42l940.724-0.112v-97.308s-0.547-57.548-117.809-109.95z"
fill="#1890ff"
></path>
</svg>
</span>
);
};

View File

@@ -66,6 +66,19 @@
border-radius: 4px;
}
.inGroupAvatar {
position: relative;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 56px;
height: 56px;
line-height: 1;
background-color: #69b1ff;
border-radius: 4px;
}
.chatBBox {
position: relative;
height: calc(100vh - 212px - 164px);
@@ -82,8 +95,8 @@
transition: top 0.3s, height 0.3s;
&.delFollowListShow {
top: 0;
height: calc(100% - 34px);
top: 164px;
height: calc(100% - 164px);
}
}

View File

@@ -5,12 +5,13 @@ import { Drawer, Form, Input, Tabs } from 'antd';
import Spin from 'antd/lib/spin';
import { stringify } from 'qs';
import React, { useEffect, useRef, useState } from 'react';
import { CustDetailContent } from '../CustomList/components/CustDetailContent';
import { DepartmentMembersDetail } from '../DepartmentsList/components/DepartmentMemberDetail';
import { IChat, ICustFollow, IGroup, IGroupMembers, IStaffsItem } from './ChatLogsType';
import { adminList, formatTags, groupMembersCount, groupMembersCount2 } from './ChatUtils';
import { adminList, getAdminList, groupMembersCount, groupMembersCount2 } from './ChatUtils';
import { ChatBar } from './components/ChatBar';
import { ChatTime } from './components/ChatTime';
import { Gender } from './components/Gender';
import { AdminSvg, OwnerSvg } from './components/Svgs';
import styles from './index.module.scss';
const ChatLogs: React.FC = () => {
@@ -187,11 +188,22 @@ const ChatLogs: React.FC = () => {
if (res.err_code == 0) {
if (Array.isArray(res.data)) {
groupMembersObjRef.current = {};
let owner: IGroupMembers[] = [];
let admin_list: IGroupMembers[] = [];
let other: IGroupMembers[] = [];
res.data.forEach((item: IGroupMembers) => {
item.avatar = item.staff_avatar || item.avatar;
groupMembersObjRef.current[item.user_id] = item;
if (item.user_id == selectGroupRef.current?.owner) {
owner.push(item);
} else if (selectGroupRef.current?.adminUserIDs.includes(item.user_id)) {
admin_list.push(item);
} else {
other.push(item);
}
});
setGroupMembersList(res.data);
// 对群员 创建者 > 管理员 > 普通成员 排序
setGroupMembersList([...owner, ...admin_list, ...other]);
page(1);
}
}
@@ -256,18 +268,79 @@ const ChatLogs: React.FC = () => {
getStaffsList();
observer.observe(chatBoxRef.current, { childList: true });
const myScript = document.createElement('script');
myScript.src = '/public/scripts/amrnb.js';
myScript.async = false;
document.body.appendChild(myScript);
return () => {
document.removeEventListener('click', show, false);
observer.disconnect();
document.body.removeChild(myScript);
};
}, []);
// 外部联系人Item
const custFollowsListItem = (item: ICustFollow) => {
return (
<div
key={item.cust_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectCustFollow?.cust_id == item.cust_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(undefined);
selectGroupRef.current = undefined;
setSelectCustFollow(item);
selectCustFollowRef.current = item;
page(1);
}}
style={{ display: item.name.includes(searchWord['1']) ? '' : 'none' }}
>
<div className={styles.avatar} style={{ background: item?.avatar ? '#fff' : '' }}>
<img src={item.avatar} alt="" style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'cover' }} />
</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name}
</div>
<div>{item.remark}</div>
</div>
</div>
);
};
// 客户群聊列表项
const groupListItem = (item: IGroup) => {
return (
<div
key={item.group_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${selectGroup?.group_id == item.group_id ? styles.active : ''}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectCustFollow(undefined);
selectCustFollowRef.current = undefined;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(item);
selectGroupRef.current = item;
selectGroupRef.current.adminUserIDs = getAdminList(item.admin_list);
getGroupMembersList();
}}
style={{ display: item.name.includes(searchWord['2']) ? '' : 'none' }}
>
<div className={styles.avatar}>{item.name ? item.name[0] : '群'}</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name || '未定义群名'}
</div>
<div style={{ color: '#999' }}>{groupStatus[item.status]}</div>
</div>
</div>
);
};
// const { notification } = App.useApp();
const tabContent = () => {
if (tabKey == '0') {
@@ -282,9 +355,7 @@ const ChatLogs: React.FC = () => {
return (
<div
key={`${item.user_id}_${item.name}`}
className={`${styles.chatB} ${
selectInnerStaff?.user_id == item.user_id ? styles.active : ''
}`}
className={`${styles.chatB} ${selectInnerStaff?.user_id == item.user_id ? styles.active : ''}`}
onClick={() => {
tabKeyRef.current = tabKey;
@@ -324,9 +395,7 @@ const ChatLogs: React.FC = () => {
);
})
) : (
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}>
</div>
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}></div>
)}
</>
);
@@ -335,53 +404,12 @@ const ChatLogs: React.FC = () => {
<>
{custFollowsList.length ? (
custFollowsList.map((item) => {
if (item.state == 0) return null;
return (
<div
key={item.cust_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectCustFollow?.cust_id == item.cust_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(undefined);
selectGroupRef.current = undefined;
setSelectCustFollow(item);
selectCustFollowRef.current = item;
page(1);
}}
style={{ display: item.name.includes(searchWord['1']) ? '' : 'none' }}
>
<div className={styles.avatar} style={{ background: item?.avatar ? '#fff' : '' }}>
<img
src={item.avatar}
alt=""
style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'cover' }}
/>
</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name}
</div>
<div>{item.remark}</div>
</div>
</div>
);
return item.state == 0 ? null : custFollowsListItem(item);
})
) : (
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}>
</div>
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}></div>
)}
<div
className={`${styles.delFollowList} ${
delFollowListShow ? styles.delFollowListShow : ''
}`}
>
<div className={`${styles.delFollowList} ${delFollowListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
@@ -391,51 +419,9 @@ const ChatLogs: React.FC = () => {
<span></span>
{delFollowListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div
className={`${styles.delFollowListBox} ${
delFollowListShow ? styles.delFollowListBoxShow : ''
}`}
>
<div className={`${styles.delFollowListBox} ${delFollowListShow ? styles.delFollowListBoxShow : ''}`}>
{custFollowsList.map((item) => {
if (item.state == 1) return null;
return (
<div
key={item.cust_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectCustFollow?.cust_id == item.cust_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(undefined);
selectGroupRef.current = undefined;
setSelectCustFollow(item);
selectCustFollowRef.current = item;
page(1);
}}
style={{ display: item.name.includes(searchWord['1']) ? '' : 'none' }}
>
<div
className={styles.avatar}
style={{ background: item?.avatar ? '#fff' : '' }}
>
<img
src={item.avatar}
alt=""
style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'cover' }}
/>
</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name}
</div>
<div>{item.remark}</div>
</div>
</div>
);
return item.state == 1 ? null : custFollowsListItem(item);
})}
</div>
</div>
@@ -446,45 +432,12 @@ const ChatLogs: React.FC = () => {
<>
{groupList.length ? (
groupList.map((item) => {
if (item.state == 0) return null;
return (
<div
key={item.group_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectGroup?.group_id == item.group_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectCustFollow(undefined);
selectCustFollowRef.current = undefined;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(item);
selectGroupRef.current = item;
getGroupMembersList();
}}
style={{ display: item.name.includes(searchWord['2']) ? '' : 'none' }}
>
<div className={styles.avatar}>{item.name ? item.name[0] : '群'}</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name || '未定义群名'}
</div>
<div style={{ color: '#999' }}>{groupStatus[item.status]}</div>
</div>
</div>
);
return item.state == 0 ? null : groupListItem(item);
})
) : (
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}>
</div>
<div style={{ lineHeight: '44px', textAlign: 'center', color: '#999' }}></div>
)}
<div
className={`${styles.delFollowList} ${
delGroupListShow ? styles.delFollowListShow : ''
}`}
>
<div className={`${styles.delFollowList} ${delGroupListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
@@ -494,40 +447,9 @@ const ChatLogs: React.FC = () => {
<span></span>
{delGroupListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div
className={`${styles.delFollowListBox} ${
delGroupListShow ? styles.delFollowListBoxShow : ''
}`}
>
<div className={`${styles.delFollowListBox} ${delGroupListShow ? styles.delFollowListBoxShow : ''}`}>
{groupList.map((item) => {
if (item.state == 1) return null;
return (
<div
key={item.group_id}
className={`${styles.chatB} ${item.state == 0 ? styles.state0 : ''} ${
selectGroup?.group_id == item.group_id ? styles.active : ''
}`}
onClick={() => {
tabKeyRef.current = tabKey;
setSelectCustFollow(undefined);
selectCustFollowRef.current = undefined;
setSelectInnerStaff(undefined);
selectInnerStaffRef.current = undefined;
setSelectGroup(item);
selectGroupRef.current = item;
getGroupMembersList();
}}
style={{ display: item.name.includes(searchWord['2']) ? '' : 'none' }}
>
<div className={styles.avatar}>{item.name ? item.name[0] : '群'}</div>
<div className={styles.chatAMsg} style={{ flexDirection: 'column' }}>
<div className={styles.chatAName} title={item.name}>
{item.name || '未定义群名'}
</div>
<div style={{ color: '#999' }}>{groupStatus[item.status]}</div>
</div>
</div>
);
return item.state == 1 ? null : groupListItem(item);
})}
</div>
</div>
@@ -536,6 +458,104 @@ const ChatLogs: React.FC = () => {
}
};
// 删除的联系人/群
const tabContentDel = () => {
if (tabKey == '0') {
return <></>;
} else if (tabKey == '1') {
return (
<div className={`${styles.delFollowList} ${delFollowListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
setDelFollowListShow(!delFollowListShow);
}}
>
<span></span>
{delFollowListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div className={`${styles.delFollowListBox} ${delFollowListShow ? styles.delFollowListBoxShow : ''}`}>
{custFollowsList.map((item) => {
return item.state == 1 ? null : custFollowsListItem(item);
})}
</div>
</div>
);
} else {
return (
<div className={`${styles.delFollowList} ${delGroupListShow ? styles.delFollowListShow : ''}`}>
<div
className={styles.delFollowListBar}
onClick={() => {
setDelGroupListShow(!delGroupListShow);
}}
>
<span></span>
{delGroupListShow ? <UpOutlined /> : <DownOutlined />}
</div>
<div className={`${styles.delFollowListBox} ${delGroupListShow ? styles.delFollowListBoxShow : ''}`}>
{groupList.map((item) => {
return item.state == 1 ? null : groupListItem(item);
})}
</div>
</div>
);
}
};
// 群 Drawer 群员
const groupMembersListItem = (item: IGroupMembers) => {
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.inGroupAvatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
{item.user_id == selectGroupRef.current?.owner ? <OwnerSvg /> : null}
{selectGroupRef.current?.adminUserIDs?.includes(item.user_id) ? <AdminSvg /> : null}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
};
return (
<PageContainer>
<div className={styles.box}>
@@ -646,6 +666,7 @@ const ChatLogs: React.FC = () => {
}}
/>
<div className={styles.chatBBox}>{tabContent()}</div>
{tabContentDel()}
</div>
<div style={{ flex: 1 }}>
<div className={styles.logTop}>
@@ -687,53 +708,15 @@ const ChatLogs: React.FC = () => {
{tabKeyRef.current == '0' ? (
<DepartmentMembersDetail record={selectInnerStaff as IStaffsItem} />
) : tabKeyRef.current == '1' ? (
<div>
<div
style={{
display: 'flex',
borderBottom: '1px solid #ddd',
paddingBottom: 12,
marginBottom: 12,
}}
>
<div className={styles.modalAvatar}>
<img src={selectCustFollow?.avatar} alt="" />
</div>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div style={{ fontSize: 16 }}>
<span style={{ marginRight: 8 }}>{selectCustFollow?.name}</span>
<Gender gender={selectCustFollow?.gender} />
</div>
<div style={{ color: '#666' }}>{selectCustFollow?.description}</div>
</div>
</div>
<div>{selectCustFollow?.remark}</div>
<div
style={{
paddingTop: 12,
marginBottom: 12,
paddingBottom: 12,
borderBottom: '1px solid #ddd',
fontSize: 16,
fontWeight: 'bold',
}}
>
</div>
{formatTags(selectCustFollow?.tags)}
</div>
<CustDetailContent record={selectCustFollow as ICustFollow} />
) : (
<div>
<div style={{ marginBottom: 8, textIndent: '2em' }}>
{groupMembersObjRef.current[selectGroupRef.current?.owner as string]?.name}
</div>
<div style={{ marginBottom: 8 }}>
{adminList(selectGroupRef.current?.admin_list, groupMembersObjRef.current)}
</div>
<div style={{ marginBottom: 8 }}>
{selectGroupRef.current?.create_time}
</div>
<div style={{ marginBottom: 8 }}>{adminList(selectGroupRef.current?.admin_list, groupMembersObjRef.current)}</div>
<div style={{ marginBottom: 8 }}>{selectGroupRef.current?.create_time}</div>
<div style={{ textIndent: '1em' }}>{selectGroupRef.current?.notice}</div>
<div
style={{
@@ -747,54 +730,7 @@ const ChatLogs: React.FC = () => {
{groupMembersList.length}
</div>
{groupMembersList.map((item) => {
if (item.group_members_type == '2' || item.state == 0) return null;
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.avatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
return item.group_members_type == '2' || item.state == 0 ? null : groupMembersListItem(item);
})}
{groupMembersCount2(groupMembersList, '2', 1) != 0 ? (
<div
@@ -810,54 +746,7 @@ const ChatLogs: React.FC = () => {
</div>
) : null}
{groupMembersList.map((item) => {
if (item.group_members_type == '1' || item.state == 0) return null;
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.avatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
return item.group_members_type == '1' || item.state == 0 ? null : groupMembersListItem(item);
})}
{groupMembersCount(groupMembersList, 0) != 0 ? (
<div
@@ -873,54 +762,7 @@ const ChatLogs: React.FC = () => {
</div>
) : null}
{groupMembersList.map((item) => {
if (item.state == 1) return null;
return (
<div
key={item.user_id}
style={{
display: 'inline-flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: 80,
flexDirection: 'column',
verticalAlign: 'top',
marginTop: 12,
}}
>
<div className={styles.avatar}>
{item.avatar ? (
<img
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'cover',
borderRadius: 4,
}}
src={item.avatar}
alt=""
/>
) : item.name ? (
item.name[0]
) : (
''
)}
</div>
<div
style={{
padding: '0 4px',
whiteSpace: 'nowrap',
minWidth: 0,
textOverflow: 'ellipsis',
overflow: 'hidden',
width: 72,
textAlign: 'center',
}}
title={item.name}
>
{item.name}
</div>
</div>
);
return item.state == 1 ? null : groupMembersListItem(item);
})}
</div>
)}
@@ -931,48 +773,26 @@ const ChatLogs: React.FC = () => {
className={styles.chatLogBox}
ref={chatBoxRef}
onScroll={(e: any) => {
if (
e.target?.scrollTop == 0 &&
!isAllChatRef.current &&
!chatLogLoadingRef.current
) {
if (e.target?.scrollTop == 0 && !isAllChatRef.current && !chatLogLoadingRef.current) {
page(param.curr_page + 1);
}
}}
>
{isAllChatRef.current ? (
<div style={{ marginBottom: 12, textAlign: 'center', color: '#999' }}>
</div>
) : null}
{isAllChatRef.current ? <div style={{ marginBottom: 12, textAlign: 'center', color: '#999' }}></div> : null}
{chatLogs.map((item) => {
if (item.curr_page) {
return (
<div
key={item.curr_page}
className={`curr_page${param.curr_page}`}
style={{ height: 0 }}
/>
);
return <div key={item.curr_page} className={`curr_page${param.curr_page}`} style={{ height: 0 }} />;
} else {
return (
<div key={item.msg_id}>
{/* {item.show_time ? <ChatTime msgtime={item.msg_time}></ChatTime> : null} */}
<ChatTime msgtime={item.msg_time} />
{tabKey == '2' ? (
<ChatBar
from={selectStaff}
to={groupMembersObjRef.current[item.msg_from]}
chat={item}
/>
<ChatBar from={selectStaff} to={groupMembersObjRef.current[item.msg_from]} chat={item} />
) : (
<ChatBar
from={selectStaff}
to={
tabKeyRef.current == '0'
? selectInnerStaffRef.current
: selectCustFollowRef.current
}
to={tabKeyRef.current == '0' ? selectInnerStaffRef.current : selectCustFollowRef.current}
chat={item}
/>
)}

View File

@@ -0,0 +1,61 @@
import { ICustFollow } from '@/pages/ChatLogs/ChatLogsType';
import { formatTags } from '@/pages/ChatLogs/ChatUtils';
import { Gender } from '@/pages/ChatLogs/components/Gender';
import { AddWay, CustType } from '@/services/config';
import React from 'react';
import styles from './index.module.scss';
type IProps = {
record: ICustFollow;
};
/**
* 客户抽屉内容
* @param props IProps
* @returns
*/
export const CustDetailContent: React.FC<IProps> = (props) => {
const { record } = props;
return (
<div>
<div
style={{
display: 'flex',
borderBottom: '1px solid #ddd',
paddingBottom: 12,
marginBottom: 12,
}}
>
<div className={styles.modalAvatar}>
<img src={record?.avatar} alt="" />
</div>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div style={{ fontSize: 16, display: 'flex', alignItems: 'center' }}>
<span style={{ marginRight: 8 }}>
{record?.name}[{record?.remark}]
</span>
<Gender gender={record?.gender} />
</div>
<span style={{ color: '#389e0d' }}>@{record ? CustType[record?.type] : ''}</span>
<div style={{ color: '#666' }}>{record?.description}</div>
</div>
</div>
<div>{record ? AddWay[record?.add_way] : ''}</div>
<div>{record?.user_id}</div>
<div>{record?.create_time}</div>
<div
style={{
paddingTop: 12,
marginBottom: 12,
paddingBottom: 12,
borderBottom: '1px solid #ddd',
fontSize: 16,
fontWeight: 'bold',
}}
>
</div>
{formatTags(record?.tags)}
</div>
);
};

View File

@@ -2,56 +2,16 @@ import { SearchBarPlugin, SearchBottonsCardPlugin } from '@/components/SearchBar
import { post } from '@/services/ajax';
import { AddWay, CustType } from '@/services/config';
import { PageContainer } from '@ant-design/pro-components';
import {
Button,
Col,
DatePicker,
Drawer,
Form,
Image,
Input,
Pagination,
Popover,
Row,
Select,
Table,
Tag,
} from 'antd';
import { Button, Col, DatePicker, Drawer, Form, Image, Input, Pagination, Popover, Row, Select, Table, Tag } from 'antd';
import { stringify } from 'qs';
import React, { useEffect, useState } from 'react';
import { formatTags } from '../ChatLogs/ChatUtils';
import { ICustFollow } from '../ChatLogs/ChatLogsType';
import { Gender } from '../ChatLogs/components/Gender';
import styles from './index.module.scss';
interface ICustItem {
add_way: number;
avatar: string;
create_time: string;
cust_id: string;
description: string;
gender: number;
name: string;
oper_user_id: string;
remark: string;
remark_mobiles: string;
state: number;
tags: string;
type: number;
user_id: string;
}
type Param = {
curr_page: number;
page_count: number;
type?: number | string;
name?: string;
add_way?: string;
create_timeL?: string;
create_timeU?: string;
};
import { CustDetailContent } from './components/CustDetailContent';
const CustomList: React.FC = () => {
const [param] = useState<Param>({
const [param] = useState({
curr_page: 1,
page_count: 20,
type: '',
@@ -61,15 +21,15 @@ const CustomList: React.FC = () => {
create_timeU: '',
});
const [custsList, setCustsList] = useState<ICustItem[]>([]);
const [custsList, setCustsList] = useState<ICustFollow[]>([]);
const [count, setCount] = useState(0);
const [loading, setLoading] = useState(false);
const [open, setOpen] = useState(false);
const [record, setRecord] = useState<ICustItem>();
const [record, setRecord] = useState<ICustFollow>();
const getCustsList = () => {
setLoading(true);
post({ url: '/CustFollows/CustsList', data: stringify(param) }).then((res) => {
post({ url: '/CustFollows/List', data: stringify(param) }).then((res) => {
setLoading(false);
if (res.err_code == 0) {
if (Array.isArray(res.data)) {
@@ -192,7 +152,7 @@ const CustomList: React.FC = () => {
title="客户"
width={200}
dataIndex={'name'}
render={(value, record: ICustItem) => {
render={(value, record: ICustFollow) => {
return (
<div
onClick={() => {
@@ -221,9 +181,7 @@ const CustomList: React.FC = () => {
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Gender gender={record.gender}></Gender>
<span style={{ marginLeft: 4, color: '#389e0d' }}>
@{CustType[record.type]}
</span>
<span style={{ marginLeft: 4, color: '#389e0d' }}>@{CustType[record.type]}</span>
</div>
</div>
</div>
@@ -267,19 +225,11 @@ const CustomList: React.FC = () => {
);
}}
>
<Tag
color="green"
title={`${arr[0]?.group_name}${arr[0]?.tag_name}`}
style={{ marginBottom: 4 }}
>
<Tag color="green" title={`${arr[0]?.group_name}${arr[0]?.tag_name}`} style={{ marginBottom: 4 }}>
{arr[0]?.tag_name}
</Tag>
{arr[1] ? (
<Tag
color="green"
title={`${arr[1]?.group_name}${arr[1]?.tag_name}`}
style={{ marginBottom: 4 }}
>
<Tag color="green" title={`${arr[1]?.group_name}${arr[1]?.tag_name}`} style={{ marginBottom: 4 }}>
{arr[1]?.tag_name}
</Tag>
) : null}
@@ -289,19 +239,11 @@ const CustomList: React.FC = () => {
</Popover>
) : (
<>
<Tag
color="green"
title={`${arr[0]?.group_name}${arr[0]?.tag_name}`}
style={{ marginBottom: 4 }}
>
<Tag color="green" title={`${arr[0]?.group_name}${arr[0]?.tag_name}`} style={{ marginBottom: 4 }}>
{arr[0]?.tag_name}
</Tag>
{arr[1] ? (
<Tag
color="green"
title={`${arr[1]?.group_name}${arr[1]?.tag_name}`}
style={{ marginBottom: 4 }}
>
<Tag color="green" title={`${arr[1]?.group_name}${arr[1]?.tag_name}`} style={{ marginBottom: 4 }}>
{arr[1]?.tag_name}
</Tag>
) : null}
@@ -328,53 +270,8 @@ const CustomList: React.FC = () => {
<Table.Column title="添加时间" width={140} dataIndex={'create_time'} />
{/* <Table.Column title="操作" width={160} dataIndex={'position'} /> */}
</Table>
<Drawer
title={`${record?.name} 客户详情`}
open={open}
onClose={() => setOpen(false)}
width={800}
>
<div>
<div
style={{
display: 'flex',
borderBottom: '1px solid #ddd',
paddingBottom: 12,
marginBottom: 12,
}}
>
<div className={styles.modalAvatar}>
<img src={record?.avatar} alt="" />
</div>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div style={{ fontSize: 16 }}>
<span style={{ marginRight: 8 }}>{record?.name}</span>
<Gender gender={record?.gender} />
</div>
<span style={{ marginLeft: 4, color: '#389e0d' }}>
@{record ? CustType[record?.type] : ''}
</span>
<div style={{ color: '#666' }}>{record?.description}</div>
</div>
</div>
<div>{record?.remark}</div>
<div>{record ? AddWay[record?.add_way] : ''}</div>
<div>{record?.user_id}</div>
<div>{record?.create_time}</div>
<div
style={{
paddingTop: 12,
marginBottom: 12,
paddingBottom: 12,
borderBottom: '1px solid #ddd',
fontSize: 16,
fontWeight: 'bold',
}}
>
</div>
{formatTags(record?.tags)}
</div>
<Drawer title={`${record?.name} 客户详情`} open={open} onClose={() => setOpen(false)} width={800}>
<CustDetailContent record={record as ICustFollow} />
</Drawer>
<Pagination
style={{

View File

@@ -42,7 +42,7 @@ export const DepartmentMembersDetail: React.FC<IProps> = (props) => {
)}
</div>
<div style={{ marginRight: 32 }}>
<div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span style={{ marginRight: 8, fontSize: 18 }}>{record?.name}</span>
<Gender gender={record?.gender}></Gender>
</div>

View File

@@ -34,6 +34,7 @@ const Login: React.FC = () => {
const [userLoginState, setUserLoginState] = useState<API.LoginResult>({});
const [type, setType] = useState<string>('account');
const { initialState, setInitialState } = useModel('@@initialState');
const [loading, setLoading] = useState(false);
const containerClassName = useEmotionCss(() => {
return {
@@ -52,12 +53,14 @@ const Login: React.FC = () => {
window.NotificationCF = notification;
const handleSubmit = async (values: API.LoginParams) => {
setLoading(true);
const data = {
user: values.username,
password: values.password,
};
post({ url: '/User/Login', data: qsStringify(data) }).then((res: IAjaxReturn) => {
setLoading(false);
if (res && res.err_code == 0) {
notification.success({
message: '登录成功',
@@ -91,6 +94,7 @@ const Login: React.FC = () => {
}}
>
<LoginForm
loading={loading}
contentStyle={{
minWidth: 280,
maxWidth: '75vw',

View File

@@ -35,7 +35,8 @@
}
.dataCount {
font-size: 24px;
font-size: 26px;
font-weight: 500;
}
.dataCardBox {

View File

@@ -102,19 +102,19 @@ const Workbench: React.FC = () => {
<div style={{ display: 'flex' }}>
<DataSumItemCard
title="客户数量"
content="当前员工权限范围内的全部客户数量(含重复)"
content="全部客户数量(含重复)"
icon={<TeamOutlined className={styles.icon} />}
count={data.overView.custs_total}
/>
<DataSumItemCard
title="客群数量"
content="当前员工权限范围内的全部客群数量"
content="全部客群数量"
icon={<CommentOutlined className={styles.icon} />}
count={data.overView.groups_total}
/>
<DataSumItemCard
title="客群成员总数"
content="当前员工权限范围内客群成员的总数(含员工)(含重复)"
content="客群成员的总数(含员工)(含重复)"
icon={<BarChartOutlined className={styles.icon} />}
count={data.overView.groups_members_total}
/>
@@ -125,31 +125,31 @@ const Workbench: React.FC = () => {
<div className={styles.dataCardBox}>
<DataItemCard
title="今日新增客户"
content="当前员工权限范围内今日添加的客户数(含重复及流失)"
content="今日添加的客户数(含重复及流失)"
count={data.custsInfo.today_custs}
/>
<span style={{ width: 16 }} />
{/* <DataItemCard
title="今日跟进客户"
content="当前员工权限范围内今日处于跟进中状态的客户数(含重复)"
content="今日处于跟进中状态的客户数(含重复)"
count={11}
/> */}
{/* <span style={{ width: 16 }} /> */}
<DataItemCard
title="今日净增客户"
content="当前员工权限范围内今日添加的客户数(不含重复及流失)"
content="今日添加的客户数(不含重复及流失)"
count={data.custsInfo.today_net_growth}
/>
<span style={{ width: 16 }} />
<DataItemCard
title="今日流失客户"
content="当前员工权限范围内的流失的全部客户数量"
content="今日流失的全部客户数量"
count={data.custsInfo.today_loss}
/>
<span style={{ width: 16 }} />
<DataItemCard
title="本月新增客户"
content="当前员工权限范围内本月添加的客户数(含重复及流失)"
content="本月添加的客户数(含重复及流失)"
count={data.custsInfo.month_custs}
/>
{/* <DataItemCard
@@ -186,25 +186,25 @@ const Workbench: React.FC = () => {
<div className={styles.dataCardBox}>
<DataItemCard
title="今日新增客群"
content="当前员工权限范围内今日创建的客群数"
content="今日创建的客群数"
count={data.groupsInfo.today_groups}
/>
<span style={{ width: 16 }} />
<DataItemCard
title="今日解散客群"
content="当前员工权限范围内今日解散的客群数"
content="今日解散的客群数"
count={data.groupsInfo.today_diss_groups}
/>
<span style={{ width: 16 }} />
<DataItemCard
title="今日新增成员"
content="当前员工权限范围内今日新增客群成员数(含员工)"
content="今日新增客群成员数(含员工)"
count={data.groupsInfo.today_groups_members}
/>
<span style={{ width: 16 }} />
<DataItemCard
title="今日退出成员"
content="当前员工权限范围内今日退出客群成员数(含员工)"
content="今日退出客群成员数(含员工)"
count={data.groupsInfo.today_diss_groups_members}
/>
</div>

View File

@@ -18,13 +18,17 @@ export const post = async (param: IPost) => {
const { url, data, showError = true } = param;
return await request('/api' + url, {
data: data,
}).then((res: IAjaxReturn) => {
if (res.err_code != 0 && showError) {
notificationError({
message: `${res.err_msg}`,
description: `${res.err_code}${res.err_msg}`,
});
}
return res;
});
})
.then((res: IAjaxReturn) => {
if (res.err_code != 0 && showError) {
notificationError({
message: `${res.err_msg}`,
description: `${res.err_code}${res.err_msg}`,
});
}
return res;
})
.catch((res) => {
return res;
});
};