123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- import { RouterModule } from '@angular/router';
- import { Component, OnInit } from '@angular/core';
- import { CommonModule } from '@angular/common';
- import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
- import {
- faBrain, faBell, faUser, faRobot, faComments,
- faDatabase, faUserTie, faTimes, faHistory, faStar,
- faChartLine, faFileAlt, faBullhorn, faUserCircle,
- faFire, faTrophy, faCheck
- } from '@fortawesome/free-solid-svg-icons';
- @Component({
- imports: [RouterModule, CommonModule, FontAwesomeModule],
- templateUrl: './page-crm-home.html',
- styleUrl: './page-crm-home.scss',
- selector: 'page-crm-home',
- standalone: true,
- })
- export class PageCrmHome implements OnInit {
- // Font Awesome 图标
- icons = {
- faBrain, faBell, faUser, faRobot, faComments,
- faDatabase, faUserTie, faTimes, faHistory, faStar,
- faChartLine, faFileAlt, faBullhorn, faUserCircle,
- faFire, faTrophy, faCheck
- };
- // 弹窗状态
- showMessagePopup: boolean = false;
- showProfilePopup: boolean = false;
- selectedMessage: any = null;
- unreadMessagesCount: number = 0;
- // 数据
- motivationalText: string = '每一次对话都是展现专业的机会,每一次练习都在提升成功的概率!今天,让AI成为您最强大的销售伙伴';
-
- features = [
- {
- id: 'virtual-practice',
- title: '虚拟陪练',
- description: '与AI客户进行真实销售对话练习,提升沟通技巧',
- icon: 'fas fa-robot',
- statIcon: 'fas fa-history',
- stat1: '86次练习',
- stat2: '92%得分',
- hasNotification: true
- },
- {
- id: 'speech-strategy',
- title: '话术决策',
- description: '智能生成最佳沟通策略,应对各种销售场景',
- icon: 'fas fa-comments',
- statIcon: 'fas fa-star',
- stat1: '34个策略',
- stat2: '89%有效'
- },
- {
- id: 'data-training',
- title: '数据训练',
- description: '上传销售数据训练AI模型,优化决策能力',
- icon: 'fas fa-database',
- statIcon: 'fas fa-chart-line',
- stat1: '1.2GB',
- stat2: '95%准确'
- },
- {
- id: 'customer-profile',
- title: '客户画像',
- description: '生成详细客户分析报告,洞察客户需求',
- icon: 'fas fa-user-tie',
- statIcon: 'fas fa-file-alt',
- stat1: '28份',
- stat2: '更新中'
- }
- ];
- messages = [
- {
- id: 1,
- title: '新的陪练挑战',
- content: '您有一个新的虚拟陪练挑战等待完成,主题:高端客户价格谈判。请尽快完成以获得最佳学习效果。',
- time: '10分钟前',
- unread: true
- },
- {
- id: 2,
- title: '话术策略更新',
- content: '您收藏的"投诉处理"话术策略已更新至3.2版本,包含了最新的客户反馈数据。',
- time: '1小时前',
- unread: true
- },
- {
- id: 3,
- title: '系统维护通知',
- content: '系统将于本周六凌晨2:00-4:00进行维护升级,期间将无法使用服务。',
- time: '昨天',
- unread: true
- },
- {
- id: 4,
- title: '陪练成绩通知',
- content: '您最近的虚拟陪练成绩为92分,超过89%的销售同事,继续保持!',
- time: '2天前',
- unread: true
- },
- {
- id: 5,
- title: '团队周报',
- content: '本周团队陪练报告已生成,点击查看详细分析。',
- time: '3天前',
- unread: true
- }
- ];
-
- user = {
- name: '张明',
- role: '高级销售经理',
- age: 32,
- birthDate: '1991-05-15',
- trainingCount: 86
- };
- motivationalPhrases = [
- "每一次对话都是展现专业的机会,每一次练习都在提升成功的概率!今天,让AI成为您最强大的销售伙伴",
- "每一次拒绝都是离成功更近一步!",
- "卓越的销售不是推销产品,而是解决问题!",
- "今天的练习,明天的签约!",
- "客户的需求是您成功的地图,AI是您的导航仪!",
- "专业来自准备,成功源于坚持!",
- "您不是一个人在战斗,AI是您最强大的后援!"
- ];
- ngOnInit(): void {
- this.updateUnreadCount();
- this.updateMotivationalText();
-
- // 每10秒更新一次激励语句
- setInterval(() => this.updateMotivationalText(), 10000);
- }
- updateMotivationalText(): void {
- const randomIndex = Math.floor(Math.random() * this.motivationalPhrases.length);
- this.motivationalText = this.motivationalPhrases[randomIndex];
- }
- toggleMessagePopup(): void {
- this.showMessagePopup = !this.showMessagePopup;
- if (this.showMessagePopup) {
- this.updateUnreadCount();
- }
- }
- toggleProfilePopup(): void {
- this.showProfilePopup = !this.showProfilePopup;
- }
- showMessageDetail(message: any, event?: Event): void {
- if (event) event.stopPropagation();
-
- this.selectedMessage = message;
-
- // 如果消息未读,则标记为已读
- if (message.unread) {
- message.unread = false;
- this.updateUnreadCount();
- }
- }
- closeMessageDetail(): void {
- this.selectedMessage = null;
- }
- markMessageAsRead(message: any, event: Event): void {
- event.stopPropagation();
- if (message.unread) {
- message.unread = false;
- this.updateUnreadCount();
- }
- }
- markAllAsRead(): void {
- this.messages.forEach(message => message.unread = false);
- this.updateUnreadCount();
- }
- markAsRead(message: any): void {
- if (message.unread) {
- message.unread = false;
- this.updateUnreadCount();
- }
- }
- updateUnreadCount(): void {
- this.unreadMessagesCount = this.messages.filter(m => m.unread).length;
- }
- navigateTo(featureId: string): void {
- console.log('导航至:', featureId);
- // 实际项目中这里会有路由导航逻辑
- // this.router.navigate([`/${featureId}`]);
- }
- }
|