在线浏览器

网站图标 新标签页 ×

书签

历史记录

快捷网站

12%
0
今日访问
8%
0
注册用户
25%
0
总下载量
18%
0
工具使用
constructor() { this.components = {}; } // 创建模态框 createModal(options) { const modal = document.createElement('div'); modal.className = 'advanced-modal'; modal.innerHTML = ` `; // 添加事件监听器 modal.querySelector('.modal-close').addEventListener('click', () => { this.closeModal(modal); }); modal.querySelector('.modal-overlay').addEventListener('click', () => { this.closeModal(modal); }); // 按钮事件 if (options.buttons) { options.buttons.forEach(btn => { if (btn.action && btn.handler) { const button = modal.querySelector(`[data-action="${btn.action}"]`); button.addEventListener('click', () => { btn.handler(); this.closeModal(modal); }); } }); } document.body.appendChild(modal); return modal; } // 关闭模态框 closeModal(modal) { if (modal && modal.parentNode) { modal.parentNode.removeChild(modal); } } // 创建通知 toast showToast(message, type = 'info', duration = 3000) { const toast = document.createElement('div'); toast.className = `advanced-toast toast-${type}`; toast.innerHTML = `
${message}
`; document.body.appendChild(toast); // 自动消失 setTimeout(() => { if (toast.parentNode) { toast.parentNode.removeChild(toast); } }, duration); // 手动关闭 toast.querySelector('.toast-close').addEventListener('click', () => { if (toast.parentNode) { toast.parentNode.removeChild(toast); } }); return toast; } // 创建加载指示器 createLoader(text = '加载中...') { const loader = document.createElement('div'); loader.className = 'advanced-loader'; loader.innerHTML = `
${text}
`; return loader; } // 创建分页组件 createPagination(totalItems, itemsPerPage, currentPage, onPageChange) { const totalPages = Math.ceil(totalItems / itemsPerPage); const pagination = document.createElement('div'); pagination.className = 'advanced-pagination'; let html = ''; // 上一页 if (currentPage > 1) { html += ``; } // 页码 for (let i = 1; i <= totalPages; i++) { if (i === 1 || i === totalPages || (i >= currentPage - 2 && i <= currentPage + 2)) { html += ``; } else if (i === currentPage - 3 || i === currentPage + 3) { html += '...'; } } // 下一页 if (currentPage < totalPages) { html += ``; } pagination.innerHTML = html; // 添加事件监听器 pagination.querySelectorAll('.page-btn').forEach(btn => { btn.addEventListener('click', () => { const page = parseInt(btn.dataset.page); onPageChange(page); }); }); return pagination; } } // 实例化高级UI组件 window.advancedUI = new AdvancedUIComponents(); this.transactions = [ { id: 1, type: 'income', amount: 299, description: '钻石会员订阅', date: '2024-01-15', category: 'subscription' }, { id: 2, type: 'expense', amount: 1500, description: '服务器费用', date: '2024-01-10', category: 'infrastructure' }, { id: 3, type: 'income', amount: 129, description: '黄金会员订阅', date: '2024-01-12', category: 'subscription' } ]; this.invoices = [ { id: 'INV-2024-001', client: '企业客户A', amount: 5000, status: 'paid', dueDate: '2024-02-01' }, { id: 'INV-2024-002', client: '企业客户B', amount: 3000, status: 'pending', dueDate: '2024-02-15' } ]; this.budgets = [ { category: 'development', allocated: 20000, spent: 15000 }, { category: 'marketing', allocated: 10000, spent: 7500 }, { category: 'infrastructure', allocated: 5000, spent: 3000 } ]; } // 获取财务概览 getFinancialOverview() { const income = this.transactions .filter(t => t.type === 'income') .reduce((sum, t) => sum + t.amount, 0); const expenses = this.transactions .filter(t => t.type === 'expense') .reduce((sum, t) => sum + t.amount, 0); const netIncome = income - expenses; return { income, expenses, netIncome, profitMargin: income > 0 ? ((netIncome / income) * 100).toFixed(1) : 0 }; } // 添加交易 addTransaction(transaction) { const newTransaction = { id: this.transactions.length + 1, ...transaction, date: new Date().toISOString().split('T')[0] }; this.transactions.push(newTransaction); return newTransaction; } // 获取预算使用情况 getBudgetUsage() { return this.budgets.map(budget => ({ ...budget, remaining: budget.allocated - budget.spent, usagePercentage: (budget.spent / budget.allocated) * 100 })); } // 生成财务报表 generateFinancialReport(period = 'monthly') { const overview = this.getFinancialOverview(); const budgetUsage = this.getBudgetUsage(); const pendingInvoices = this.invoices.filter(i => i.status === 'pending'); return { period, generatedAt: new Date().toISOString(), overview, budgetUsage, pendingInvoices, recommendations: this.generateRecommendations(overview, budgetUsage) }; } generateRecommendations(overview, budgetUsage) { const recommendations = []; if (overview.netIncome < 0) { recommendations.push('考虑优化成本结构或增加收入来源'); } budgetUsage.forEach(budget => { if (budget.usagePercentage > 90) { recommendations.push(`${budget.category}预算即将用完,考虑调整或追加预算`); } }); return recommendations; } } const financialManager = new FinancialManagementSystem(); constructor() { this.customers = []; this.leads = []; this.supportTickets = []; this.initializeSampleData(); } initializeSampleData() { this.customers = [ { id: 1, name: '张三科技有限公司', email: 'zhang@tech.com', phone: '13800138000', industry: '科技', status: 'active', membershipLevel: 5, joinDate: '2023-12-01', lastContact: '2024-01-15' }, { id: 2, name: '李四设计工作室', email: 'li@design.com', phone: '13900139000', industry: '设计', status: 'active', membershipLevel: 3, joinDate: '2024-01-05', lastContact: '2024-01-18' } ]; this.leads = [ { id: 1, name: '王五教育机构', email: 'wang@edu.com', phone: '13700137000', source: '官网咨询', status: 'contacted', interestLevel: 'high' } ]; this.supportTickets = [ { id: 1, customerId: 1, subject: 'API使用问题', description: '调用API时遇到认证错误', status: 'resolved', priority: 'high', createdAt: '2024-01-16' } ]; } // 获取客户统计 getCustomerStats() { const totalCustomers = this.customers.length; const activeCustomers = this.customers.filter(c => c.status === 'active').length; const premiumCustomers = this.customers.filter(c => c.membershipLevel >= 3).length; return { totalCustomers, activeCustomers, premiumCustomers, premiumRate: totalCustomers > 0 ? ((premiumCustomers / totalCustomers) * 100).toFixed(1) : 0, activeLeads: this.leads.length, openTickets: this.supportTickets.filter(t => t.status !== 'resolved').length }; } // 添加新客户 addCustomer(customerData) { const customer = { id: this.customers.length + 1, ...customerData, joinDate: new Date().toISOString().split('T')[0], status: 'active' }; this.customers.push(customer); return customer; } // 创建支持工单 createSupportTicket(ticketData) { const ticket = { id: this.supportTickets.length + 1, ...ticketData, createdAt: new Date().toISOString().split('T')[0], status: 'open' }; this.supportTickets.push(ticket); return ticket; } // 获取客户满意度分析 getCustomerSatisfaction() { const resolvedTickets = this.supportTickets.filter(t => t.status === 'resolved'); const totalResponseTime = resolvedTickets.reduce((sum, ticket) => { // 模拟响应时间分析 return sum + Math.random() * 24; // 小时 }, 0); const avgResponseTime = resolvedTickets.length > 0 ? totalResponseTime / resolvedTickets.length : 0; return { totalTickets: this.supportTickets.length, resolvedTickets: resolvedTickets.length, resolutionRate: this.supportTickets.length > 0 ? (resolvedTickets.length / this.supportTickets.length * 100).toFixed(1) : 0, avgResponseTime: avgResponseTime.toFixed(1), satisfactionScore: this.calculateSatisfactionScore() }; } calculateSatisfactionScore() { // 模拟满意度计算 const baseScore = 85; const resolutionBonus = this.supportTickets.filter(t => t.status === 'resolved').length * 0.5; const responsePenalty = Math.random() * 10; return Math.min(100, Math.max(60, baseScore + resolutionBonus - responsePenalty)); } } window.crmSystem = new CustomerRelationshipManagement(); constructor() { this.campaigns = []; this.emailTemplates = []; this.analytics = {}; this.initializeSampleData(); } initializeSampleData() { this.campaigns = [ { id: 1, name: '新年促销活动', type: 'promotion', status: 'active', startDate: '2024-01-01', endDate: '2024-01-31', targetAudience: 'all_users', budget: 5000, metrics: { impressions: 15000, clicks: 1200, conversions: 85, roi: 3.2 } } ]; this.emailTemplates = [ { id: 1, name: '欢迎邮件', subject: '欢迎加入智能导航中心!', content: '感谢您注册智能导航中心...', type: 'welcome' }, { id: 2, name: '促销通知', subject: '新年特惠:会员8折优惠', content: '亲爱的用户,新年快乐!...', type: 'promotion' } ]; } // 创建营销活动 createCampaign(campaignData) { const campaign = { id: this.campaigns.length + 1, ...campaignData, metrics: { impressions: 0, clicks: 0, conversions: 0, roi: 0 } }; this.campaigns.push(campaign); return campaign; } // 获取营销效果分析 getMarketingAnalytics() { const totalImpressions = this.campaigns.reduce((sum, c) => sum + c.metrics.impressions, 0); const totalClicks = this.campaigns.reduce((sum, c) => sum + c.metrics.clicks, 0); const totalConversions = this.campaigns.reduce((sum, c) => sum + c.metrics.conversions, 0); const totalBudget = this.campaigns.reduce((sum, c) => sum + c.budget, 0); return { totalCampaigns: this.campaigns.length, activeCampaigns: this.campaigns.filter(c => c.status === 'active').length, totalImpressions, totalClicks, totalConversions, clickThroughRate: totalImpressions > 0 ? (totalClicks / totalImpressions * 100).toFixed(2) : 0, conversionRate: totalClicks > 0 ? (totalConversions / totalClicks * 100).toFixed(2) : 0, totalBudget, averageROI: this.campaigns.length > 0 ? this.campaigns.reduce((sum, c) => sum + c.metrics.roi, 0) / this.campaigns.length : 0 }; } // 发送营销邮件 sendMarketingEmail(templateId, recipients, customData = {}) { const template = this.emailTemplates.find(t => t.id === templateId); if (!template) { throw new Error('邮件模板不存在'); } // 模拟邮件发送 const email = { id: 'email_' + Date.now(), templateId, recipients, subject: this.customizeTemplate(template.subject, customData), content: this.customizeTemplate(template.content, customData), sentAt: new Date(), status: 'sent' }; return email; } // 模板定制 customizeTemplate(template, data) { return template.replace(/\{\{([^}]+)\}\}/g, (match, key) => { return data[key.trim()] || match; }); } // 获取营销建议 getMarketingRecommendations() { const analytics = this.getMarketingAnalytics(); const recommendations = []; if (analytics.clickThroughRate < 2) { recommendations.push('点击率较低,建议优化广告创意和目标受众定位'); } if (analytics.conversionRate < 5) { recommendations.push('转化率有待提升,考虑优化落地页和用户引导流程'); } if (analytics.averageROI < 2) { recommendations.push('投资回报率偏低,建议调整营销预算分配'); } return recommendations; } } window.marketingTools = new MarketingAutomationTools(); constructor() { this.projects = new Map(); this.tasks = new Map(); this.teams = new Map(); this.milestones = new Map(); this.initializeSampleData(); } initializeSampleData() { // 模拟项目数据 const sampleProjects = [ { id: 'proj_001', name: '腾讯云短信集成', description: '集成腾讯云短信服务到主系统', status: 'active', priority: 'high', startDate: new Date('2024-01-15'), endDate: new Date('2024-03-15'), budget: 50000, progress: 75, teamMembers: ['user_001', 'user_002', 'user_003'], tags: ['API集成', '短信', '腾讯云'] }, { id: 'proj_002', name: '用户参与度提升', description: '用户参与度增长需要提升', status: 'active', priority: 'medium', startDate: new Date('2024-01-28'), endDate: new Date('2024-02-28'), budget: 20000, progress: 40, teamMembers: ['user_004', 'user_005'], tags: ['用户体验', '数据分析', '优化'] } ]; sampleProjects.forEach(project => this.projects.set(project.id, project)); // 模拟任务数据 const sampleTasks = [ { id: 'task_001', projectId: 'proj_001', title: 'API接口开发', description: '开发短信发送API接口', assignee: 'user_001', dueDate: new Date('2024-02-15'), estimatedHours: 40, actualHours: 35, status: 'completed', priority: 'high' }, { id: 'task_002', projectId: 'proj_001', title: '用户参与度增长缓慢', description: '分析用户参与度数据', assignee: 'user_004', dueDate: new Date('2024-02-15'), estimatedHours: 20, actualHours: 18, status: 'in_progress', priority: 'medium' } ]; sampleTasks.forEach(task => this.tasks.set(task.id, task)); } // 创建新项目 createProject(projectData) { const projectId = 'proj_' + Date.now(); const project = { id: projectId, ...projectData, createdAt: new Date(), updatedAt: new Date(), progress: 0, teamMembers: [] }; this.projects.set(projectId, project); return project; } // 获取项目统计 getProjectStats() { const projects = Array.from(this.projects.values()); const completed = projects.filter(p => p.status === 'completed').length; const total = projects.length; const totalBudget = projects.reduce((sum, p) => sum + p.budget, 0); const avgProgress = projects.reduce((sum, p) => sum + p.progress, 0) / projects.length; return { total, completed, completionRate: Math.round((completed / total) * 100), totalBudget: this.formatCurrency(totalBudget), avgProgress: Math.round(avgProgress) }; } // 格式化货币 formatCurrency(amount) { return '¥' + amount.toLocaleString(); } // 更新项目进度 updateProjectProgress(projectId, progress) { const project = this.projects.get(projectId); if (project) { project.progress = Math.max(0, Math.min(100, progress)); project.updatedAt = new Date(); return true; } return false; } // 获取项目任务 getProjectTasks(projectId) { return Array.from(this.tasks.values()) .filter(task => task.projectId === projectId) .sort((a, b) => new Date(a.dueDate) - new Date(b.dueDate)); } // 项目成本分析 analyzeProjectCost(projectId) { const project = this.projects.get(projectId); if (!project) return null; const tasks = this.getProjectTasks(projectId); const totalEstimatedHours = tasks.reduce((sum, task) => sum + task.estimatedHours, 0); const totalActualHours = tasks.reduce((sum, task) => sum + (task.actualHours || 0), 0); const hourlyRate = 150; // 假设每小时成本 const estimatedCost = totalEstimatedHours * hourlyRate; const actualCost = totalActualHours * hourlyRate; const budgetRemaining = project.budget - actualCost; return { budget: project.budget, budgetUtilization: (actualCost / project.budget) * 100, estimatedCost, actualCost, budgetRemaining, costVariance: actualCost - estimatedCost }; } } // 实例化项目管理系统 const projectManager = new ProjectManagementSystem();