FEAT => 本次更新项目为:

This commit is contained in:
超级老白兔
2025-09-25 14:32:42 +08:00
parent 0159a246ac
commit 27dfb17e70
4 changed files with 608 additions and 37 deletions

View File

@@ -11,6 +11,7 @@
align-items: center;
min-height: 64px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
justify-content: space-between;
.headerLeft {
display: flex;

View File

@@ -13,6 +13,7 @@ export interface PowerNavigationProps {
onBackClick?: () => void;
className?: string;
style?: React.CSSProperties;
rightContent?: React.ReactNode;
}
const PowerNavigation: React.FC<PowerNavigationProps> = ({
@@ -23,6 +24,7 @@ const PowerNavigation: React.FC<PowerNavigationProps> = ({
onBackClick,
className,
style,
rightContent,
}) => {
const navigate = useNavigate();
@@ -57,6 +59,7 @@ const PowerNavigation: React.FC<PowerNavigationProps> = ({
{subtitle && <span className={styles.subtitle}>{subtitle}</span>}
</div>
</div>
<div className={styles.headerRight}>{rightContent}</div>
</div>
);
};

View File

@@ -1,43 +1,357 @@
.container {
padding: 24px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header {
margin-bottom: 24px;
h1 {
font-size: 24px;
font-weight: 600;
color: #262626;
margin: 0 0 8px 0;
}
p {
font-size: 14px;
color: #8c8c8c;
margin: 0;
}
.searchBar {
display: flex;
align-items: center;
gap: 8px;
padding: 16px 0 8px 0;
}
.content {
min-height: 400px;
}
.placeholder {
// 页面头部
.header {
display: flex;
align-items: center;
justify-content: center;
height: 300px;
background: #fafafa;
border: 1px dashed #d9d9d9;
border-radius: 6px;
p {
font-size: 16px;
color: #8c8c8c;
margin: 0;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 24px;
.headerLeft {
.title {
font-size: 24px;
font-weight: 600;
color: #262626;
margin: 0 0 8px 0;
}
.subtitle {
font-size: 14px;
color: #8c8c8c;
margin: 0;
}
}
}
.headerRight {
.addButton {
background: #1890ff;
color: white;
border: none;
border-radius: 6px;
padding: 8px 16px;
font-size: 14px;
cursor: pointer;
transition: background-color 0.3s;
&:hover {
background: #40a9ff;
}
}
}
}
// 搜索和筛选区域
.searchSection {
display: flex;
gap: 12px;
margin-bottom: 24px;
.searchBox {
flex: 1;
position: relative;
display: flex;
align-items: center;
.searchIcon {
position: absolute;
left: 12px;
color: #8c8c8c;
font-size: 16px;
}
.searchInput {
width: 100%;
height: 40px;
padding: 0 12px 0 40px;
border: 1px solid #d9d9d9;
border-radius: 6px;
font-size: 14px;
outline: none;
transition: border-color 0.3s;
&:focus {
border-color: #1890ff;
}
&::placeholder {
color: #8c8c8c;
}
}
}
.filterButton {
display: flex;
align-items: center;
gap: 6px;
height: 40px;
padding: 0 16px;
background: white;
border: 1px solid #d9d9d9;
border-radius: 6px;
font-size: 14px;
color: #262626;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #1890ff;
color: #1890ff;
}
}
}
// 标签页
.tabs {
display: flex;
gap: 0;
margin-bottom: 24px;
border-bottom: 1px solid #f0f0f0;
.tab {
padding: 12px 24px;
background: none;
border: none;
border-bottom: 2px solid transparent;
font-size: 14px;
color: #8c8c8c;
cursor: pointer;
transition: all 0.3s;
&:hover {
color: #1890ff;
}
&.activeTab {
color: #1890ff;
border-bottom-color: #1890ff;
}
}
}
// 联系人列表
.contactsList {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
gap: 20px;
}
// 联系人卡片
.contactCard {
background: white;
border: 1px solid #f0f0f0;
border-radius: 8px;
padding: 20px;
transition: all 0.3s;
height: 100%;
min-height: 380px;
display: flex;
flex-direction: column;
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border-color: #d9d9d9;
}
.cardHeader {
margin-bottom: 16px;
.contactInfo {
display: flex;
align-items: flex-start;
gap: 12px;
}
.nameSection {
flex: 1;
.contactName {
display: flex;
align-items: center;
gap: 8px;
font-size: 16px;
font-weight: 600;
color: #262626;
margin: 0 0 4px 0;
.starIcon {
color: #faad14;
font-size: 14px;
}
}
.roleCompany {
font-size: 14px;
color: #8c8c8c;
margin: 0;
}
}
}
// 头像样式
.avatar {
border-radius: 50%;
object-fit: cover;
border: 2px solid #f0f0f0;
}
.avatarPlaceholder {
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: 600;
border: 2px solid #f0f0f0;
}
.contactDetails {
margin-bottom: 16px;
flex: 1;
.contactItem {
display: flex;
margin: 0 0 8px 0;
font-size: 14px;
.label {
color: #8c8c8c;
margin-right: 8px;
min-width: 40px;
}
}
}
.tagsSection {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
.tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
.tag {
background: #f5f5f5;
color: #595959;
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
}
}
.source {
font-size: 12px;
color: #8c8c8c;
}
}
.lastContact {
font-size: 12px;
color: #8c8c8c;
margin-bottom: 12px;
}
.notes {
background: #f9f9f9;
padding: 8px 12px;
border-radius: 4px;
font-size: 12px;
color: #595959;
margin-bottom: 16px;
line-height: 1.4;
}
.actions {
display: flex;
gap: 12px;
margin-top: auto;
.actionButton {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 32px;
background: white;
border: 1px solid #d9d9d9;
border-radius: 4px;
font-size: 12px;
color: #595959;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #1890ff;
color: #1890ff;
}
&:first-child:hover {
background: #e6f7ff;
}
&:last-child:hover {
background: #f6ffed;
border-color: #52c41a;
color: #52c41a;
}
}
}
}
// 响应式设计
@media (max-width: 768px) {
.contactsList {
grid-template-columns: 1fr;
}
.contactCard {
min-height: 350px;
}
.header {
flex-direction: column;
gap: 16px;
align-items: flex-start;
.headerRight {
width: 100%;
.addButton {
width: 100%;
}
}
}
.searchSection {
flex-direction: column;
.filterButton {
width: 100%;
justify-content: center;
}
}
.tabs {
overflow-x: auto;
white-space: nowrap;
.tab {
flex-shrink: 0;
}
}
}

View File

@@ -1,20 +1,273 @@
import React from "react";
import React, { useState } from "react";
import PowerNavigation from "@/components/PowerNavtion";
import {
StarOutlined,
SearchOutlined,
FilterOutlined,
MessageOutlined,
PhoneOutlined,
} from "@ant-design/icons";
import styles from "./index.module.scss";
import { Button, Input, Row, Col } from "antd";
// 联系人数据类型
interface Contact {
id: string;
name: string;
avatar?: string;
role: string;
company: string;
phone: string;
email?: string;
location: string;
tags: string[];
source: string;
lastContact: string;
notes?: string;
isStarred?: boolean;
category: "customer" | "potential" | "partner" | "friend";
}
// 头像组件
const Avatar: React.FC<{ name: string; avatar?: string; size?: number }> = ({
name,
avatar,
size = 40,
}) => {
const getInitials = (name: string) => {
return name.charAt(0).toUpperCase();
};
const getAvatarColor = (name: string) => {
const colors = [
"#1890ff",
"#52c41a",
"#faad14",
"#f5222d",
"#722ed1",
"#13c2c2",
"#eb2f96",
"#fa8c16",
];
const index = name.charCodeAt(0) % colors.length;
return colors[index];
};
if (avatar) {
return (
<img
src={avatar}
alt={name}
className={styles.avatar}
style={{ width: size, height: size }}
/>
);
}
return (
<div
className={styles.avatarPlaceholder}
style={{
width: size,
height: size,
backgroundColor: getAvatarColor(name),
fontSize: size * 0.4,
}}
>
{getInitials(name)}
</div>
);
};
const CustomerManagement: React.FC = () => {
const [activeTab, setActiveTab] = useState("customer");
const [searchValue, setSearchValue] = useState("");
// 模拟数据
const contacts: Contact[] = [
{
id: "1",
name: "李先生",
avatar: "https://api.dicebear.com/7.x/avataaars/svg?seed=li",
role: "技术总监",
company: "某科技公司",
phone: "138****8888",
email: "li@company.com",
location: "北京",
tags: ["客户", "重要客户", "AI产品", "意向客户"],
source: "朋友推荐",
lastContact: "2024/3/5",
notes: "对AI产品很感兴趣,预算充足",
isStarred: true,
category: "customer",
},
{
id: "2",
name: "张总",
role: "CEO",
company: "大型企业集团",
phone: "139****9999",
email: "zhang@enterprise.com",
location: "上海",
tags: ["潜在客户", "决策者", "大客户"],
source: "展会获客",
lastContact: "2024/3/4",
notes: "需要详细的ROI分析报告",
category: "potential",
},
{
id: "3",
name: "王女士",
avatar: "https://api.dicebear.com/7.x/avataaars/svg?seed=wang",
role: "市场经理",
company: "中型贸易公司",
phone: "137****7777",
location: "深圳",
tags: ["客户", "中小企业", "价格敏感"],
source: "网络广告",
lastContact: "2024/3/3",
category: "customer",
},
];
const tabs = [
{ key: "customer", label: "客户", count: 2 },
{ key: "potential", label: "潜在客户", count: 1 },
{ key: "partner", label: "合作伙伴", count: 0 },
{ key: "friend", label: "朋友", count: 0 },
];
const filteredContacts = contacts.filter(
contact =>
contact.category === activeTab &&
(searchValue === "" ||
contact.name.includes(searchValue) ||
contact.company.includes(searchValue) ||
contact.tags.some(tag => tag.includes(searchValue))),
);
return (
<div className={styles.container}>
<PowerNavigation
title="客户好友管理"
subtitle="统一管理客户信息和好友关系,提升服务效率"
subtitle="管理客户关系,维护好友信息"
showBackButton={true}
backButtonText="返回功能中心"
rightContent={<Button></Button>}
/>
<div className={styles.content}>
{/* 功能内容待开发 */}
<div className={styles.placeholder}>
<p>...</p>
{/* 搜索和筛选 */}
<div className={styles.searchBar}>
<Input
placeholder="搜索计划名称"
value={searchValue}
onChange={e => setSearchValue(e.target.value)}
prefix={<SearchOutlined />}
allowClear
size="large"
/>
<Button
onClick={() => {}}
size="large"
className={styles["refresh-btn"]}
>
<FilterOutlined />
</Button>
</div>
{/* 标签页 */}
<div className={styles.tabs}>
{tabs.map(tab => (
<button
key={tab.key}
className={`${styles.tab} ${activeTab === tab.key ? styles.activeTab : ""}`}
onClick={() => setActiveTab(tab.key)}
>
{tab.label} ({tab.count})
</button>
))}
</div>
{/* 联系人卡片列表 */}
<div className={styles.contactsList}>
<Row gutter={16}>
{filteredContacts.map(contact => (
<Col span={8} key={contact.id}>
<div className={styles.contactCard}>
<div className={styles.cardHeader}>
<div className={styles.contactInfo}>
<Avatar
name={contact.name}
avatar={contact.avatar}
size={48}
/>
<div className={styles.nameSection}>
<h3 className={styles.contactName}>
{contact.name}
{contact.isStarred && (
<StarOutlined className={styles.starIcon} />
)}
</h3>
<p className={styles.roleCompany}>
{contact.role} {"·"} {contact.company}
</p>
</div>
</div>
</div>
<div className={styles.contactDetails}>
<div className={styles.contactInfo}>
<p className={styles.contactItem}>
<span className={styles.label}>:</span>{" "}
{contact.phone}
</p>
{contact.email && (
<p className={styles.contactItem}>
<span className={styles.label}>:</span>{" "}
{contact.email}
</p>
)}
<p className={styles.contactItem}>
<span className={styles.label}>:</span>{" "}
{contact.location}
</p>
</div>
</div>
<div className={styles.tagsSection}>
<div className={styles.tags}>
{contact.tags.map((tag, index) => (
<span key={index} className={styles.tag}>
{tag}
</span>
))}
</div>
<span className={styles.source}>{contact.source}</span>
</div>
<div className={styles.lastContact}>
: {contact.lastContact}
</div>
{contact.notes && (
<div className={styles.notes}>{contact.notes}</div>
)}
<div className={styles.actions}>
<button className={styles.actionButton}>
<MessageOutlined />
</button>
<button className={styles.actionButton}>
<PhoneOutlined />
</button>
</div>
</div>
</Col>
))}
</Row>
</div>
</div>
</div>