From 2156976a8c5bed46049ea2270364c2473af0f575 Mon Sep 17 00:00:00 2001 From: zhengw <247276359@qq.com> Date: Thu, 20 Apr 2023 17:38:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=A1=A8=E6=83=85=E5=8C=B9=E9=85=8D,=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AE=A2=E7=BE=A4=E4=B8=AD=E5=BF=83=E9=A1=B5=E9=9D=A2,?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=B9=E6=A1=86=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.ts | 10 +- public/avatar.svg | 1 + src/app.tsx | 5 +- .../RightContent/AvatarDropdown.tsx | 24 +- src/components/RightContent/EditPassWord.tsx | 184 +++++++++++++ src/components/RightContent/index.module.scss | 46 ++++ src/pages/ChatLogs/ChatLogsType.ts | 2 + src/pages/ChatLogs/ChatUtils.tsx | 68 +++++ src/pages/ChatLogs/components/ChatRecord.tsx | 5 +- src/pages/ChatLogs/components/ChatText.tsx | 3 +- src/pages/ChatLogs/components/EmojiFormat.tsx | 32 +++ src/pages/ChatLogs/index.module.scss | 13 - src/pages/ChatLogs/index.tsx | 200 ++++++++------ src/pages/CustomList/index.tsx | 101 ++++++- src/pages/DepartmentsList/index.tsx | 2 + .../components/GroupDetailContent.tsx | 128 +++++++++ src/pages/GroupList/index.module.scss | 51 ++++ src/pages/GroupList/index.tsx | 260 ++++++++++++++++++ src/services/config.ts | 123 +++++++++ 19 files changed, 1135 insertions(+), 123 deletions(-) create mode 100644 public/avatar.svg create mode 100644 src/components/RightContent/EditPassWord.tsx create mode 100644 src/components/RightContent/index.module.scss create mode 100644 src/pages/ChatLogs/components/EmojiFormat.tsx create mode 100644 src/pages/GroupList/components/GroupDetailContent.tsx create mode 100644 src/pages/GroupList/index.module.scss create mode 100644 src/pages/GroupList/index.tsx diff --git a/config/routes.ts b/config/routes.ts index 0df567e..c44aa4c 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -40,7 +40,7 @@ export default [ }, { path: '/scrm/custom', - name: '客户管理', + name: '客群管理', routes: [ { path: '/scrm/custom', @@ -53,11 +53,17 @@ export default [ component: './Workbench', }, { - name: '客户列表', + name: '客户中心', icon: 'table', path: '/scrm/custom/list', component: './CustomList', }, + { + name: '客群中心', + icon: 'table', + path: '/scrm/custom/grouplist', + component: './GroupList', + }, ], }, { diff --git a/public/avatar.svg b/public/avatar.svg new file mode 100644 index 0000000..2ea1b77 --- /dev/null +++ b/public/avatar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app.tsx b/src/app.tsx index 2ec8b21..13759f6 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -6,6 +6,7 @@ import { history, Link } from '@umijs/max'; import { App } from 'antd'; import React from 'react'; import defaultSettings from '../config/defaultSettings'; +import AvatarSvg from '../public/avatar.svg'; import { AvatarDropdown, AvatarName } from './components/RightContent/AvatarDropdown'; import { errorConfig } from './requestErrorConfig'; import { post } from './services/ajax'; @@ -57,9 +58,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) = // actionsRender: () => [, ], actionsRender: () => [], avatarProps: { - src: initialState?.currentUser?.avatar - ? '/api/' + initialState?.currentUser?.avatar - : 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', + src: initialState?.currentUser?.avatar ? '/api/' + initialState?.currentUser?.avatar : AvatarSvg, title: , render: (_, avatarChildren) => { return {avatarChildren}; diff --git a/src/components/RightContent/AvatarDropdown.tsx b/src/components/RightContent/AvatarDropdown.tsx index 4c47480..3c93a72 100644 --- a/src/components/RightContent/AvatarDropdown.tsx +++ b/src/components/RightContent/AvatarDropdown.tsx @@ -8,6 +8,7 @@ import type { MenuInfo } from 'rc-menu/lib/interface'; import React, { useCallback, useState } from 'react'; import { flushSync } from 'react-dom'; import HeaderDropdown from '../HeaderDropdown'; +import { EditPassword } from './EditPassWord'; export type GlobalHeaderRightProps = { menu?: boolean; @@ -17,7 +18,7 @@ export type GlobalHeaderRightProps = { export const AvatarName = () => { const { initialState } = useModel('@@initialState'); const { currentUser } = initialState || {}; - return {currentUser?.login_name}; + return {currentUser?.user_name}; }; export const AvatarDropdown: React.FC = ({ menu, children }) => { @@ -65,6 +66,7 @@ export const AvatarDropdown: React.FC = ({ menu, childre }); const { initialState, setInitialState } = useModel('@@initialState'); const [visible, setVisible] = useState(false); + const [visiblePwd, setVisiblePwd] = useState(false); const onMenuClick = useCallback( (event: MenuInfo) => { @@ -72,6 +74,9 @@ export const AvatarDropdown: React.FC = ({ menu, childre if (key === 'logout') { setVisible(true); return; + } else if (key === 'editPassword') { + setVisiblePwd(true); + return; } history.push(`/account/${key}`); }, @@ -118,6 +123,11 @@ export const AvatarDropdown: React.FC = ({ menu, childre }, ] : []), + { + key: 'editPassword', + icon: , + label: '修改密码', + }, { key: 'logout', icon: , @@ -151,6 +161,18 @@ export const AvatarDropdown: React.FC = ({ menu, childre > 确认退出账号? + setVisiblePwd(false)} + footer={false} + maskClosable={false} + destroyOnClose={true} + > + setVisiblePwd(false)} /> + ); }; diff --git a/src/components/RightContent/EditPassWord.tsx b/src/components/RightContent/EditPassWord.tsx new file mode 100644 index 0000000..c5332f4 --- /dev/null +++ b/src/components/RightContent/EditPassWord.tsx @@ -0,0 +1,184 @@ +import { post } from '@/services/ajax'; +import { App, Button, Input, Spin } from 'antd'; +import { stringify } from 'qs'; +import React, { useEffect, useRef, useState } from 'react'; +import styles from './index.module.scss'; + +type IProps = { + close: () => void; +}; + +type IProps2 = { + value: string; +}; +const StrokeCheck: React.FC = (props) => { + const { value } = props; + const strokeColor = ['#e74242', '#ffa500', '#EFBD47', '#1bbf1b', '#008000']; + const [strong, setStrong] = useState(0); + useEffect(() => { + let s = 0; + if (value.length >= 6) { + if (value.length >= 6) { + s++; + } + let pattern = new RegExp( + "[`~!@#$%^&?*()_\\-\\+=|{}':;',\\[\\].<>《》./~!@#¥……&*()——|{}【】‘;:”“'。,、? ]", + ); + if (value.match(/\d/g)) { + s++; + } + if (value.match(/[a-z]/g)) { + s++; + } + if (value.match(/[A-Z]/g)) { + s++; + } + if (pattern.test(value)) { + s++; + } + } + setStrong(s); + }, [value]); + + return ( +
+
+
+
+
+
+ {strokeColor.map((item) => { + return
; + })} +
+ ); +}; +export const EditPassword: React.FC = (props) => { + const [param, setParam] = useState({ + old_pass: '', + new_pass: '', + new_pass1: '', + }); + + const [loading, setLoading] = useState(false); + + const pwdFocusRef = useRef([0, 0, 0]); + const { notification } = App.useApp(); + + const save = () => { + if ( + param.old_pass.length < 6 || + param.new_pass.length < 6 || + param.new_pass1 !== param.new_pass || + param.new_pass == param.old_pass + ) { + pwdFocusRef.current = [1, 1, 1]; + setParam({ ...param }); + } else { + setLoading(true); + post({ url: '/User/ChangePass', data: stringify(param) }).then((res) => { + setLoading(false); + if (res.err_code == 0) { + notification.success({ + message: '密码修改成功', + }); + props.close(); + } + }); + } + }; + + return ( + +
+ { + param.old_pass = e.target.value; + pwdFocusRef.current[0] = 1; + setParam({ ...param }); + }} + status={ + (pwdFocusRef.current[0] == 1 && param.old_pass.length < 6) || + (param.old_pass.length >= 6 && param.new_pass == param.old_pass) + ? 'error' + : '' + } + /> +
+ {pwdFocusRef.current[0] == 1 ? ( + <> + {param.old_pass.length < 6 ? '密码长度不能小于6位' : ''} + {param.old_pass == '' ? ',该字段是必填字段' : ''} + {param.old_pass.length >= 6 && param.new_pass == param.old_pass + ? '新密码和旧密码不能一样' + : ''} + + ) : null} +
+ { + param.new_pass = e.target.value; + pwdFocusRef.current[1] = 1; + setParam({ ...param }); + }} + status={pwdFocusRef.current[1] == 1 && param.new_pass.length < 6 ? 'error' : ''} + /> + +
+ {pwdFocusRef.current[1] == 1 ? ( + <> + {param.new_pass.length < 6 ? '密码长度不能小于6位' : ''} + {param.new_pass == '' ? ',该字段是必填字段' : ''} + + ) : null} +
+ + { + param.new_pass1 = e.target.value; + pwdFocusRef.current[2] = 1; + setParam({ ...param }); + }} + status={pwdFocusRef.current[2] == 1 && param.new_pass1 !== param.new_pass ? 'error' : ''} + /> +
+ {pwdFocusRef.current[2] == 1 ? ( + <>{param.new_pass1 !== param.new_pass ? '新密码与确认密码输入不一致' : ''} + ) : null} +
+
+ + +
+
+
+ ); +}; diff --git a/src/components/RightContent/index.module.scss b/src/components/RightContent/index.module.scss new file mode 100644 index 0000000..afdc139 --- /dev/null +++ b/src/components/RightContent/index.module.scss @@ -0,0 +1,46 @@ +.errMsg { + margin-bottom: 16px; + color: red; +} + +.passwordStrong { + position: relative; + display: flex; + width: 100%; + height: 8px; + margin-top: 12px; +} + +.strokeColorMask { + position: absolute; + right: 0; + z-index: 1; + width: 100%; + height: 100%; + background-color: #ddd; + transition: width 0.3s; +} + +.mark { + position: absolute; + left: 20%; + z-index: 3; + width: 4px; + height: 100%; + background-color: #fff; + transform: translateX(-50%); + &:nth-child(2n) { + left: 40%; + } + &:nth-child(3n) { + left: 60%; + } + &:nth-child(4n) { + left: 80%; + } +} + +.strokeColor { + flex: 1; + height: 100%; +} diff --git a/src/pages/ChatLogs/ChatLogsType.ts b/src/pages/ChatLogs/ChatLogsType.ts index 4b9511f..c65ca34 100644 --- a/src/pages/ChatLogs/ChatLogsType.ts +++ b/src/pages/ChatLogs/ChatLogsType.ts @@ -44,6 +44,7 @@ export interface ICustFollow { gender: number; name: string; + staff_name?: string; type: number; @@ -69,6 +70,7 @@ export interface IGroup { group_id: string; name: string; owner: string; + staff_name?: string; state: number; status: number; sync_time: string; diff --git a/src/pages/ChatLogs/ChatUtils.tsx b/src/pages/ChatLogs/ChatUtils.tsx index 0bca79d..59fdf51 100644 --- a/src/pages/ChatLogs/ChatUtils.tsx +++ b/src/pages/ChatLogs/ChatUtils.tsx @@ -6,6 +6,8 @@ */ import React, { useEffect, useState } from 'react'; +import { IGroup, IGroupMembers } from './ChatLogsType'; +import { AdminSvg, OwnerSvg } from './components/Svgs'; export const groupMembersCount = (data: any[], state: any) => { let count = 0; @@ -36,6 +38,72 @@ export const groupMembersCount2 = (data: any[], group_members_type: any, state: return count; }; +// 群 Drawer 群员 +export const groupMembersListItem = (item: IGroupMembers, selectGroup: IGroup) => { + return ( +
+
+ {item.avatar ? ( + + ) : item.name ? ( + item.name[0] + ) : ( + '' + )} + {item.user_id == selectGroup?.owner ? : null} + {selectGroup?.adminUserIDs?.includes(item.user_id) ? : null} +
+
+ {item.name} +
+
+ ); +}; + /** * 群管理者: * @param data diff --git a/src/pages/ChatLogs/components/ChatRecord.tsx b/src/pages/ChatLogs/components/ChatRecord.tsx index 63df2e8..70c263e 100644 --- a/src/pages/ChatLogs/components/ChatRecord.tsx +++ b/src/pages/ChatLogs/components/ChatRecord.tsx @@ -1,6 +1,7 @@ import { Modal } from 'antd'; import { useEffect, useState } from 'react'; import { IChatItem } from '../ChatLogsType'; +import { EmojiFormat } from './EmojiFormat'; export const ChatRecord: React.FC = (props) => { const [visible, setVisible] = useState(false); @@ -8,6 +9,7 @@ export const ChatRecord: React.FC = (props) => { function chatRecordContent(data: any, type: string) { if (data.type == 'ChatRecordText') { const content = JSON.parse(data.content); + return (
= (props) => { textOverflow: type == 'ellipsis' ? 'ellipsis' : 'inherit', }} > - {content.content} + {type == 'ellipsis' ? content.content : }
); } else if (data.type == 'ChatRecordImage') { @@ -97,6 +99,7 @@ export const ChatRecord: React.FC = (props) => { setVisible(false); }} centered + destroyOnClose >
{record ? ( diff --git a/src/pages/ChatLogs/components/ChatText.tsx b/src/pages/ChatLogs/components/ChatText.tsx index 497ac81..c78479a 100644 --- a/src/pages/ChatLogs/components/ChatText.tsx +++ b/src/pages/ChatLogs/components/ChatText.tsx @@ -1,5 +1,6 @@ import { IChatItem } from '../ChatLogsType'; +import { EmojiFormat } from './EmojiFormat'; export const ChatText: React.FC = (props) => { - return <>{props.chat?.content}; + return ; }; diff --git a/src/pages/ChatLogs/components/EmojiFormat.tsx b/src/pages/ChatLogs/components/EmojiFormat.tsx new file mode 100644 index 0000000..ea907a2 --- /dev/null +++ b/src/pages/ChatLogs/components/EmojiFormat.tsx @@ -0,0 +1,32 @@ +import { emoji } from '@/services/config'; +import React from 'react'; + +type IProps = { + content: string; +}; +export const EmojiFormat: React.FC = (props) => { + const format = () => { + let txt = props.content; + emoji.forEach((item) => { + const reg = new RegExp(`\\[${item}\\]`, 'g'); + txt = txt.replace( + reg, + ``, + ); + }); + return txt; + }; + + return ( + <> + {typeof props.content === 'string' ? ( + + ) : ( + props.content + )} + + ); +}; diff --git a/src/pages/ChatLogs/index.module.scss b/src/pages/ChatLogs/index.module.scss index 25307c4..f0d30db 100644 --- a/src/pages/ChatLogs/index.module.scss +++ b/src/pages/ChatLogs/index.module.scss @@ -66,19 +66,6 @@ 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); diff --git a/src/pages/ChatLogs/index.tsx b/src/pages/ChatLogs/index.tsx index e248aeb..dd7cfcb 100644 --- a/src/pages/ChatLogs/index.tsx +++ b/src/pages/ChatLogs/index.tsx @@ -1,4 +1,5 @@ import { post } from '@/services/ajax'; +import { groupStatus } from '@/services/config'; import { DownOutlined, UpOutlined } from '@ant-design/icons'; import { PageContainer } from '@ant-design/pro-components'; import { Drawer, Form, Input, Tabs } from 'antd'; @@ -8,10 +9,15 @@ 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, getAdminList, groupMembersCount, groupMembersCount2 } from './ChatUtils'; +import { + adminList, + getAdminList, + groupMembersCount, + groupMembersCount2, + groupMembersListItem, +} from './ChatUtils'; import { ChatBar } from './components/ChatBar'; import { ChatTime } from './components/ChatTime'; -import { AdminSvg, OwnerSvg } from './components/Svgs'; import styles from './index.module.scss'; const ChatLogs: React.FC = () => { @@ -70,13 +76,6 @@ const ChatLogs: React.FC = () => { }, ]); - const groupStatus: any = { - '0': '跟进人正常', - '1': '跟进人离职', - '2': '离职继承中', - '3': '离职继承完成', - }; - const [searchWord, setSearchWord] = useState({ '0': '', '1': '', @@ -163,7 +162,7 @@ const ChatLogs: React.FC = () => { const getGroupList = () => { post({ - url: '/Groups/GroupsList', + url: '/Groups/ChatGroups', data: stringify({ user_id: selectStaffRef.current?.user_id }), }).then((res) => { if (res.err_code == 0) { @@ -298,7 +297,11 @@ const ChatLogs: React.FC = () => { style={{ display: item.name.includes(searchWord['1']) ? '' : 'none' }} >
- +
@@ -315,7 +318,9 @@ const ChatLogs: React.FC = () => { return (
{ tabKeyRef.current = tabKey; setSelectCustFollow(undefined); @@ -333,7 +338,7 @@ const ChatLogs: React.FC = () => {
{item.name ? item.name[0] : '群'}
- {item.name || '未定义群名'} + {item.name || '未知群名'}
{groupStatus[item.status]}
@@ -355,7 +360,9 @@ const ChatLogs: React.FC = () => { return (
{ tabKeyRef.current = tabKey; @@ -395,7 +402,9 @@ const ChatLogs: React.FC = () => { ); }) ) : ( -
暂无内部联系人
+
+ 暂无内部联系人 +
)} ); @@ -407,9 +416,15 @@ const ChatLogs: React.FC = () => { return item.state == 0 ? null : custFollowsListItem(item); }) ) : ( -
暂无外部联系人
+
+ 暂无外部联系人 +
)} -
+
{ @@ -419,7 +434,11 @@ const ChatLogs: React.FC = () => { 已删联系人 {delFollowListShow ? : }
-
+
{custFollowsList.map((item) => { return item.state == 1 ? null : custFollowsListItem(item); })} @@ -435,9 +454,15 @@ const ChatLogs: React.FC = () => { return item.state == 0 ? null : groupListItem(item); }) ) : ( -
暂无客户群聊
+
+ 暂无客户群聊 +
)} -
+
{ @@ -447,7 +472,11 @@ const ChatLogs: React.FC = () => { 已解散的群 {delGroupListShow ? : }
-
+
{groupList.map((item) => { return item.state == 1 ? null : groupListItem(item); })} @@ -464,7 +493,9 @@ const ChatLogs: React.FC = () => { return <>; } else if (tabKey == '1') { return ( -
+
{ @@ -474,7 +505,11 @@ const ChatLogs: React.FC = () => { 已删联系人 {delFollowListShow ? : }
-
+
{custFollowsList.map((item) => { return item.state == 1 ? null : custFollowsListItem(item); })} @@ -483,7 +518,9 @@ const ChatLogs: React.FC = () => { ); } else { return ( -
+
{ @@ -493,7 +530,11 @@ const ChatLogs: React.FC = () => { 已解散的群 {delGroupListShow ? : }
-
+
{groupList.map((item) => { return item.state == 1 ? null : groupListItem(item); })} @@ -503,59 +544,6 @@ const ChatLogs: React.FC = () => { } }; - // 群 Drawer 群员 - const groupMembersListItem = (item: IGroupMembers) => { - return ( -
-
- {item.avatar ? ( - - ) : item.name ? ( - item.name[0] - ) : ( - '' - )} - {item.user_id == selectGroupRef.current?.owner ? : null} - {selectGroupRef.current?.adminUserIDs?.includes(item.user_id) ? : null} -
-
- {item.name} -
-
- ); - }; - return (
@@ -682,7 +670,7 @@ const ChatLogs: React.FC = () => { <>{selectCustFollowRef.current?.name} ) : ( <> - {selectGroupRef.current ? selectGroupRef.current?.name || '未定义群名' : ''} + {selectGroupRef.current ? selectGroupRef.current?.name || '未知群名' : ''} {selectGroupRef.current ? <>({groupMembersList.length}) : null} )} @@ -695,7 +683,7 @@ const ChatLogs: React.FC = () => { <>{selectCustFollowRef.current?.name} 详细信息 ) : ( <> - {selectGroupRef.current?.name || '未定义群名'} ({groupMembersList.length} + {selectGroupRef.current?.name || '未知群名'} ({groupMembersList.length} )详细信息 ) @@ -715,8 +703,12 @@ const ChatLogs: React.FC = () => { 群主: {groupMembersObjRef.current[selectGroupRef.current?.owner as string]?.name}
-
{adminList(selectGroupRef.current?.admin_list, groupMembersObjRef.current)}
-
创建时间:{selectGroupRef.current?.create_time}
+
+ {adminList(selectGroupRef.current?.admin_list, groupMembersObjRef.current)} +
+
+ 创建时间:{selectGroupRef.current?.create_time} +
群公告:{selectGroupRef.current?.notice}
{ 群成员 • {groupMembersList.length}
{groupMembersList.map((item) => { - return item.group_members_type == '2' || item.state == 0 ? null : groupMembersListItem(item); + return item.group_members_type == '2' || item.state == 0 + ? null + : groupMembersListItem(item, selectGroupRef.current); })} {groupMembersCount2(groupMembersList, '2', 1) != 0 ? (
{
) : null} {groupMembersList.map((item) => { - return item.group_members_type == '1' || item.state == 0 ? null : groupMembersListItem(item); + return item.group_members_type == '1' || item.state == 0 + ? null + : groupMembersListItem(item, selectGroupRef.current); })} {groupMembersCount(groupMembersList, 0) != 0 ? (
{
) : null} {groupMembersList.map((item) => { - return item.state == 1 ? null : groupMembersListItem(item); + return item.state == 1 + ? null + : groupMembersListItem(item, selectGroupRef.current); })}
)} @@ -773,26 +771,48 @@ 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 ?
没有更多聊天记录了
: null} + {isAllChatRef.current ? ( +
+ 没有更多聊天记录了 +
+ ) : null} {chatLogs.map((item) => { if (item.curr_page) { - return
; + return ( +
+ ); } else { return (
{/* {item.show_time ? : null} */} {tabKey == '2' ? ( - + ) : ( )} diff --git a/src/pages/CustomList/index.tsx b/src/pages/CustomList/index.tsx index 245d30d..d6404aa 100644 --- a/src/pages/CustomList/index.tsx +++ b/src/pages/CustomList/index.tsx @@ -2,11 +2,25 @@ 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 { ICustFollow } from '../ChatLogs/ChatLogsType'; +import { ICustFollow, IStaffsItem } from '../ChatLogs/ChatLogsType'; import { Gender } from '../ChatLogs/components/Gender'; import { CustDetailContent } from './components/CustDetailContent'; @@ -19,9 +33,11 @@ const CustomList: React.FC = () => { add_way: '', create_timeL: '', create_timeU: '', + user_id: '', }); const [custsList, setCustsList] = useState([]); + const [staffsList, setStaffsList] = useState([]); const [count, setCount] = useState(0); const [loading, setLoading] = useState(false); const [open, setOpen] = useState(false); @@ -29,7 +45,7 @@ const CustomList: React.FC = () => { const getCustsList = () => { setLoading(true); - post({ url: '/CustFollows/List', data: stringify(param) }).then((res) => { + post({ url: '/Cust/CustList', data: stringify(param) }).then((res) => { setLoading(false); if (res.err_code == 0) { if (Array.isArray(res.data)) { @@ -45,7 +61,18 @@ const CustomList: React.FC = () => { getCustsList(); }; + const getStaffsList = () => { + post({ url: '/Staffs/Data' }).then((res) => { + if (res.err_code == 0) { + if (Array.isArray(res.data)) { + setStaffsList(res.data); + } + } + }); + }; + useEffect(() => { + getStaffsList(); getCustsList(); }, []); @@ -53,13 +80,12 @@ const CustomList: React.FC = () => {
-
+ { param.name = e.target.value.trim(); }} @@ -88,6 +114,27 @@ const CustomList: React.FC = () => { + + + + + 添加方式}> { + param.name = e.target.value.trim(); + }} + allowClear + onPressEnter={() => page(1)} + /> + + + + 创建者}> + { + param.owner = e.target.value.trim(); + }} + allowClear + onPressEnter={() => page(1)} + /> + + + + 状态}> + + + + + + 是否解散}> + + + + + 创建时间}> + { + // console.log(dateStrings); + param.create_timeL = dateStrings[0]; + param.create_timeU = dateStrings[1]; + }} + /> + + + +
+
+ + + + + + { + return `${record.group_id}_${record.name}`; + }} + loading={loading} + > + { + return ( +
{ + setRecord(record); + setOpen(true); + }} + style={{ cursor: 'pointer', display: 'flex' }} + > + {/*
{ + e.stopPropagation(); + }} + > + +
*/} +
+
+ {value || '未知群名'} +
+
+
+ ); + }} + /> + { + return <>{r?.staff_name}; + }} + dataIndex={'owner'} + /> + { + return <>{groupStatus[v]}; + }} + dataIndex={'status'} + /> + + { + return <>{v == 1 ? '正常' : '已解散'}; + }} + dataIndex={'state'} + /> + + {/* */} +
+ setOpen(false)} + width={800} + > + + + { + param.page_count = size; + page(1); + }} + showTotal={(total) => { + return 共{total}条; + }} + onChange={(curr) => { + page(curr); + }} + /> +
+
+ ); +}; + +export default GroupList; diff --git a/src/services/config.ts b/src/services/config.ts index 3102669..b405ff1 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -29,3 +29,126 @@ export const CustType: any = { 1: '微信', 2: '企业微信', }; + +/** + * 群状态 + */ +export const groupStatus: any = { + '0': '跟进人正常', + '1': '跟进人离职', + '2': '离职继承中', + '3': '离职继承完成', +}; + +export const emoji = [ + '666', + 'Emm', + 'OK', + '亲亲', + '便便', + '偷笑', + '傲慢', + '再见', + '凋谢', + '加油', + '勾引', + '发呆', + '发怒', + '发抖', + '发财', + '發', + '可怜', + '右哼哼', + '叹气', + '吃瓜', + '合十', + '吐', + '呲牙', + '咒骂', + '咖啡', + '哇', + '啤酒', + '嘘', + '嘴唇', + '嘿哈', + '囧', + '困', + '坏笑', + '大哭', + '天啊', + '太阳', + '失望', + '奸笑', + '好的', + '委屈', + '害羞', + '尴尬', + '庆祝', + '弱', + '强', + '得意', + '微笑', + '心碎', + '快哭了', + '恐惧', + '悠闲', + '惊恐', + '惊讶', + '愉快', + '憨笑', + '打脸', + '抓狂', + '抠鼻', + '抱拳', + '拥抱', + '拳头', + '捂脸', + '握手', + '撇嘴', + '擦汗', + '敲打', + '无语', + '旺柴', + '晕', + '月亮', + '机智', + '汗', + '流泪', + '炸弹', + '烟花', + '爆竹', + '爱心', + '猪头', + '玫瑰', + '生病', + '疑问', + '白眼', + '皱眉', + '睡', + '破涕为笑', + '礼物', + '社会社会', + '福', + '笑脸', + '红包', + '翻白眼', + '耶', + '胜利', + '脸红', + '色', + '苦涩', + '菜刀', + '蛋糕', + '衰', + '裂开', + '让我看看', + '调皮', + '跳跳', + '转圈', + '鄙视', + '闭嘴', + '阴险', + '难过', + '骷髅', + '鼓掌', +];