From 079739223a5276f21be6e294bb267f00a39c2082 Mon Sep 17 00:00:00 2001 From: zhengw <247276359@qq.com> Date: Tue, 18 Apr 2023 17:28:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ChatLogs/ChatUtils.tsx | 8 +- src/pages/ChatLogs/components/Gender.tsx | 9 +- src/pages/ChatLogs/index.module.scss | 2 +- src/pages/ChatLogs/index.tsx | 16 +- src/pages/CustomList/index.module.scss | 17 + src/pages/CustomList/index.tsx | 379 ++++++++++++++++------- src/pages/DepartmentsList/index.tsx | 30 +- src/pages/User/Login/index.tsx | 86 +---- src/pages/Workbench/index.tsx | 147 ++++++--- src/services/config.ts | 31 ++ 10 files changed, 456 insertions(+), 269 deletions(-) create mode 100644 src/services/config.ts diff --git a/src/pages/ChatLogs/ChatUtils.tsx b/src/pages/ChatLogs/ChatUtils.tsx index dfd22b6..e7e286c 100644 --- a/src/pages/ChatLogs/ChatUtils.tsx +++ b/src/pages/ChatLogs/ChatUtils.tsx @@ -69,7 +69,7 @@ export const formatTags = (data: any) => { if (data) { try { const tags = JSON.parse(data); - if (Array.isArray(tags)) { + if (Array.isArray(tags) && tags.length) { return ( <> {tags.map((item) => { @@ -82,11 +82,9 @@ export const formatTags = (data: any) => { ); } - } catch (e) { - return <>; - } + } catch (e) {} } - return <>; + return
无标签
; }; type IGroupIcon = { diff --git a/src/pages/ChatLogs/components/Gender.tsx b/src/pages/ChatLogs/components/Gender.tsx index 1ef9beb..20bfaeb 100644 --- a/src/pages/ChatLogs/components/Gender.tsx +++ b/src/pages/ChatLogs/components/Gender.tsx @@ -22,7 +22,14 @@ export const Gender: React.FC = (props) => { )} - ) : null} + ) : ( + + + + )} ); }; diff --git a/src/pages/ChatLogs/index.module.scss b/src/pages/ChatLogs/index.module.scss index 3764b9e..1d41167 100644 --- a/src/pages/ChatLogs/index.module.scss +++ b/src/pages/ChatLogs/index.module.scss @@ -150,7 +150,7 @@ pointer-events: none; &.show { - z-index: 1; + z-index: 11; transform: translateY(0px); visibility: visible; opacity: 1; diff --git a/src/pages/ChatLogs/index.tsx b/src/pages/ChatLogs/index.tsx index 6bc2015..3e4bdf6 100644 --- a/src/pages/ChatLogs/index.tsx +++ b/src/pages/ChatLogs/index.tsx @@ -109,8 +109,8 @@ const ChatLogs: React.FC = () => { setChatLogLoading(false); isAllChatRef.current = count < param.page_count * param.curr_page; if (res.err_code == 0) { + let arr: IChat[] = []; if (Array.isArray(res.data) && res.data.length) { - let arr: IChat[] = []; const temp = res.data.reverse(); const mark = { curr_page: param.curr_page, msg_time: temp[temp.length - 1].msg_time }; if (param.curr_page == 1) { @@ -140,8 +140,8 @@ const ChatLogs: React.FC = () => { // } // }); // } - setChatLogs(arr); } + setChatLogs(arr); } }); }; @@ -708,6 +708,18 @@ const ChatLogs: React.FC = () => {
备注名称:{selectCustFollow?.remark}
+
+ 标签 +
{formatTags(selectCustFollow?.tags)} ) : ( diff --git a/src/pages/CustomList/index.module.scss b/src/pages/CustomList/index.module.scss index e69de29..11d2fbf 100644 --- a/src/pages/CustomList/index.module.scss +++ b/src/pages/CustomList/index.module.scss @@ -0,0 +1,17 @@ +.modalAvatar { + display: flex; + align-items: center; + justify-content: center; + width: 60px; + height: 60px; + margin-right: 12px; + overflow: hidden; + background-color: #69b1ff; + border-radius: 6px; + + img { + max-width: 100%; + max-height: 100%; + object-fit: cover; + } +} diff --git a/src/pages/CustomList/index.tsx b/src/pages/CustomList/index.tsx index 886ddc0..86d051f 100644 --- a/src/pages/CustomList/index.tsx +++ b/src/pages/CustomList/index.tsx @@ -1,85 +1,92 @@ import { SearchBarPlugin, SearchBottonsCardPlugin } from '@/components/SearchBarPlugin'; import { post } from '@/services/ajax'; +import { AddWay, CustType } from '@/services/config'; import { PageContainer } from '@ant-design/pro-components'; -import { Button, Col, DatePicker, Drawer, Form, Input, Pagination, Row, Table } 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 { IStaffsItem } from '../ChatLogs/ChatLogsType'; +import { formatTags } from '../ChatLogs/ChatUtils'; +import { Gender } from '../ChatLogs/components/Gender'; +import styles from './index.module.scss'; -interface IDepartment { - children: null | IDepartment[]; - department_leader: string; - id: number; +interface ICustItem { + add_way: number; + avatar: string; + create_time: string; + cust_id: string; + description: string; + gender: number; name: string; - parent_id: number; - sort: number; -} - -interface IStaffsData { - count: number; - data?: IStaffsItem[]; + 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; - dep_id: number; + type?: number | string; name?: string; - position?: string; - telephone?: string; - mobile?: string; + add_way?: string; + create_timeL?: string; + create_timeU?: string; }; const CustomList: React.FC = () => { const [param] = useState({ curr_page: 1, page_count: 20, - dep_id: 0, + type: '', + name: '', + add_way: '', + create_timeL: '', + create_timeU: '', }); - const [departmentID, setDepartmentsID] = useState(0); - const [departmentsList, setDepartmentsList] = useState([]); - const [staffsData, setStaffsData] = useState({ count: 0, data: [] }); - const [loadingL, setLoadingL] = useState(false); + const [custsList, setCustsList] = useState([]); + const [count, setCount] = useState(0); const [loading, setLoading] = useState(false); const [open, setOpen] = useState(false); - const [record, setRecord] = useState(); + const [record, setRecord] = useState(); - const getStaffsList = () => { + const getCustsList = () => { setLoading(true); - post({ url: '/Staffs/List', data: stringify(param) }).then((res) => { + post({ url: '/CustFollows/CustsList', data: stringify(param) }).then((res) => { setLoading(false); if (res.err_code == 0) { - if (!Array.isArray(res.data)) { - res.data = []; - } - setStaffsData(res as IStaffsData); - } - }); - }; - - const getDepartmentsList = () => { - setLoadingL(true); - post({ url: '/Departments/List' }).then((res) => { - setLoadingL(false); - if (res.err_code == 0) { - if (Array.isArray(res.data) && res.data.length) { - param.dep_id = res.data[0].id; - setDepartmentsID(param.dep_id); - setDepartmentsList(res.data); - getStaffsList(); + if (Array.isArray(res.data)) { + setCustsList(res.data); } + setCount(res.count || 0); } }); }; const page = (page: number) => { param.curr_page = page; - getStaffsList(); + getCustsList(); }; useEffect(() => { - getDepartmentsList(); + getCustsList(); }, []); return ( @@ -88,9 +95,10 @@ const CustomList: React.FC = () => {
- + { param.name = e.target.value.trim(); @@ -100,54 +108,58 @@ const CustomList: React.FC = () => { /> - - 职务}> - { - param.position = e.target.value.trim(); + + 客户类型}> + - - 手机号}> - { - param.mobile = e.target.value.trim(); + + 添加方式}> + - - 手机号}> + + 添加日期}> { - console.log(dates, dateStrings); + // console.log(dateStrings); + param.create_timeL = dateStrings[0]; + param.create_timeU = dateStrings[1]; }} /> - {/* - - { /> - + 职务}> { /> - + { /> - {/* - -