diff --git a/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.module.scss b/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.module.scss index bf1ac1e6..921a5a78 100644 --- a/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.module.scss +++ b/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.module.scss @@ -3,41 +3,268 @@ background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + min-height: 100vh; } +// 头部区域样式 .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; - } -} - -.content { - min-height: 400px; -} - -.placeholder { display: flex; + justify-content: space-between; 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; + margin-bottom: 24px; + padding-bottom: 16px; + border-bottom: 1px solid #f0f0f0; + + .headerLeft { + display: flex; + align-items: center; + gap: 16px; + + .backButton { + color: #666; + font-size: 14px; + + &:hover { + color: #1890ff; + } + } + + .titleSection { + h1 { + font-size: 24px; + font-weight: 600; + color: #262626; + margin: 0 0 4px 0; + } + + p { + font-size: 14px; + color: #8c8c8c; + margin: 0; + } + } } -} \ No newline at end of file + + .headerRight { + display: flex; + align-items: center; + gap: 16px; + + .activeRules { + font-size: 14px; + color: #666; + } + } +} + +// 子导航栏样式 +.subNav { + margin-bottom: 24px; + + :global(.ant-tabs-nav) { + margin-bottom: 0; + } + + :global(.ant-tabs-tab) { + font-size: 16px; + font-weight: 500; + } +} + +// 主要内容区域 +.mainContent { + min-height: 600px; +} + +// 问候规则内容 +.rulesContent { + display: flex; + gap: 24px; + min-height: 600px; + + .leftPanel { + flex: 0 0 400px; + + .createCard { + height: fit-content; + + :global(.ant-card-head) { + border-bottom: 1px solid #f0f0f0; + } + + :global(.ant-card-head-title) { + font-size: 16px; + font-weight: 600; + color: #262626; + } + + .cardSubtitle { + font-size: 14px; + color: #8c8c8c; + margin: 0 0 20px 0; + } + + .createForm { + :global(.ant-form-item) { + margin-bottom: 20px; + } + + :global(.ant-form-item-label) { + font-weight: 500; + } + } + } + } + + .rightPanel { + flex: 1; + + .listCard { + height: fit-content; + + :global(.ant-card-head) { + border-bottom: 1px solid #f0f0f0; + } + + :global(.ant-card-head-title) { + font-size: 16px; + font-weight: 600; + color: #262626; + } + + .listHeader { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; + font-size: 14px; + color: #666; + } + + .ruleList { + .ruleItem { + border: 1px solid #f0f0f0; + border-radius: 8px; + padding: 16px; + margin-bottom: 16px; + background: #fafafa; + + &:last-child { + margin-bottom: 0; + } + + .ruleHeader { + display: flex; + justify-content: space-between; + align-items: flex-start; + margin-bottom: 12px; + + .ruleTitle { + flex: 1; + + h4 { + font-size: 16px; + font-weight: 600; + color: #262626; + margin: 0 0 8px 0; + } + + .ruleTags { + display: flex; + gap: 8px; + flex-wrap: wrap; + } + } + + .ruleActions { + display: flex; + align-items: center; + gap: 8px; + margin-left: 16px; + + :global(.ant-btn) { + padding: 4px 8px; + height: auto; + } + } + } + + .ruleContent { + .ruleDescription { + font-size: 14px; + color: #666; + margin: 0 0 8px 0; + font-weight: 500; + } + + .ruleText { + font-size: 14px; + color: #262626; + line-height: 1.6; + margin: 0 0 12px 0; + background: #fff; + padding: 12px; + border-radius: 6px; + border: 1px solid #e8e8e8; + } + + .ruleFooter { + display: flex; + justify-content: space-between; + font-size: 12px; + color: #8c8c8c; + } + } + } + } + } + } +} + +// 其他标签页内容 +.templatesContent, +.statisticsContent { + padding: 24px; + text-align: center; + color: #8c8c8c; +} + +// 响应式设计 +@media (max-width: 1200px) { + .rulesContent { + flex-direction: column; + + .leftPanel { + flex: none; + } + } +} + +@media (max-width: 768px) { + .container { + padding: 16px; + } + + .header { + flex-direction: column; + align-items: flex-start; + gap: 16px; + + .headerRight { + width: 100%; + justify-content: space-between; + } + } + + .rulesContent { + .leftPanel, + .rightPanel { + .createCard, + .listCard { + :global(.ant-card-body) { + padding: 16px; + } + } + } + } +} diff --git a/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.tsx b/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.tsx index 7a992c2d..239bb790 100644 --- a/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.tsx +++ b/Touchkebao/src/pages/pc/ckbox/powerCenter/auto-greeting/index.tsx @@ -1,21 +1,344 @@ -import React from "react"; -import PowerNavigation from "@/components/PowerNavtion"; +import React, { useState } from "react"; +import { + Button, + Card, + Form, + Input, + Select, + Switch, + Tabs, + Tag, + Space, + Popconfirm, + message, +} from "antd"; +import { + PlusOutlined, + EditOutlined, + DeleteOutlined, + ArrowLeftOutlined, +} from "@ant-design/icons"; +import { useNavigate } from "react-router-dom"; import styles from "./index.module.scss"; +const { TextArea } = Input; +const { Option } = Select; + +// 问候规则数据类型 +interface GreetingRule { + id: string; + name: string; + triggerType: string; + triggerCondition: string; + content: string; + priority: number; + isActive: boolean; + usageCount: number; + createTime: string; + tags: string[]; +} + const AutoGreeting: React.FC = () => { + const navigate = useNavigate(); + const [form] = Form.useForm(); + const [activeTab, setActiveTab] = useState("rules"); + const [rules, setRules] = useState([ + { + id: "1", + name: "产品咨询自动回复", + triggerType: "关键词", + triggerCondition: "包含:产品、价格、功能", + content: + "感谢您对我们产品的关注!我们的AI营销系统具有智能客服、精准营销、自动化运营等核心功能。详细资料我稍后发送给您,请稍等。", + priority: 3, + isActive: false, + usageCount: 234, + createTime: "2024/3/3", + tags: ["关键词", "优先级3"], + }, + { + id: "2", + name: "新好友欢迎", + triggerType: "新好友", + triggerCondition: "添加好友后", + content: + "您好!欢迎添加我为好友,我是触客宝AI助手,很高兴为您服务!如有任何问题,随时可以咨询我。", + priority: 1, + isActive: true, + usageCount: 156, + createTime: "2024/3/1", + tags: ["新好友", "优先级1"], + }, + { + id: "3", + name: "工作时间问候", + triggerType: "时间触发", + triggerCondition: "工作日 9:00-18:00", + content: "您好!现在是工作时间,我是触客宝AI助手,很高兴为您服务!", + priority: 2, + isActive: true, + usageCount: 89, + createTime: "2024/2/28", + tags: ["时间触发", "优先级2"], + }, + ]); + + // 计算活跃规则数量 + const activeRulesCount = rules.filter(rule => rule.isActive).length; + + // 处理表单提交 + const handleSubmit = (values: any) => { + const newRule: GreetingRule = { + id: Date.now().toString(), + name: values.name, + triggerType: values.triggerType, + triggerCondition: values.triggerCondition, + content: values.content, + priority: values.priority, + isActive: true, + usageCount: 0, + createTime: new Date().toLocaleDateString(), + tags: [values.triggerType, `优先级${values.priority}`], + }; + + setRules([...rules, newRule]); + form.resetFields(); + message.success("规则创建成功!"); + }; + + // 切换规则状态 + const toggleRuleStatus = (id: string) => { + setRules( + rules.map(rule => + rule.id === id ? { ...rule, isActive: !rule.isActive } : rule, + ), + ); + }; + + // 删除规则 + const deleteRule = (id: string) => { + setRules(rules.filter(rule => rule.id !== id)); + message.success("规则删除成功!"); + }; + + // 编辑规则 + const editRule = (rule: GreetingRule) => { + form.setFieldsValue({ + name: rule.name, + triggerType: rule.triggerType, + triggerCondition: rule.triggerCondition, + content: rule.content, + priority: rule.priority, + }); + message.info("规则已加载到编辑表单"); + }; + return (
- -
- {/* 功能内容待开发 */} -
-

自动打招呼功能正在开发中...

+ {/* 头部区域 */} +
+
+ +
+

自动问候

+

设置智能问候规则,提升客户体验

+
+
+
+ 活跃规则: {activeRulesCount}/{rules.length} +
+ +
+
+ + {/* 子导航栏 */} +
+ +
+ + {/* 主要内容区域 */} +
+ {activeTab === "rules" && ( +
+ {/* 左侧创建规则表单 */} +
+ +

+ 设置自动问候的触发条件和回复内容 +

+
+ + + + + + + + + + + + + +