| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>会话激活功能 - 测试工具</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
-
- body {
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 20px;
- }
-
- .container {
- max-width: 800px;
- width: 100%;
- background: white;
- border-radius: 20px;
- box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
- padding: 40px;
- }
-
- h1 {
- font-size: 32px;
- font-weight: 700;
- color: #1a1a1a;
- margin-bottom: 10px;
- text-align: center;
- }
-
- .subtitle {
- font-size: 16px;
- color: #666;
- text-align: center;
- margin-bottom: 40px;
- }
-
- .section {
- margin-bottom: 30px;
- padding: 20px;
- background: #f8f9fa;
- border-radius: 12px;
- border-left: 4px solid #667eea;
- }
-
- .section-title {
- font-size: 18px;
- font-weight: 600;
- color: #1a1a1a;
- margin-bottom: 15px;
- display: flex;
- align-items: center;
- gap: 10px;
- }
-
- .section-title::before {
- content: '';
- width: 6px;
- height: 6px;
- background: #667eea;
- border-radius: 50%;
- }
-
- .button-group {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
- gap: 12px;
- margin-bottom: 15px;
- }
-
- .btn {
- padding: 14px 24px;
- border: none;
- border-radius: 10px;
- font-size: 15px;
- font-weight: 600;
- cursor: pointer;
- transition: all 0.3s ease;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- text-decoration: none;
- color: white;
- }
-
- .btn:hover {
- transform: translateY(-2px);
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
- }
-
- .btn:active {
- transform: translateY(0);
- }
-
- .btn-primary {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- }
-
- .btn-success {
- background: linear-gradient(135deg, #34c759 0%, #28a745 100%);
- }
-
- .btn-danger {
- background: linear-gradient(135deg, #ff3b30 0%, #dc3545 100%);
- }
-
- .btn-info {
- background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
- }
-
- .btn-warning {
- background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
- }
-
- .status {
- padding: 15px;
- background: white;
- border-radius: 8px;
- margin-top: 15px;
- font-size: 14px;
- line-height: 1.6;
- color: #333;
- border: 1px solid #e0e0e0;
- }
-
- .status-item {
- display: flex;
- justify-content: space-between;
- padding: 8px 0;
- border-bottom: 1px solid #f0f0f0;
- }
-
- .status-item:last-child {
- border-bottom: none;
- }
-
- .status-label {
- font-weight: 600;
- color: #666;
- }
-
- .status-value {
- color: #1a1a1a;
- }
-
- .status-value.success {
- color: #34c759;
- }
-
- .status-value.error {
- color: #ff3b30;
- }
-
- .console-output {
- background: #1a1a1a;
- color: #00ff00;
- padding: 15px;
- border-radius: 8px;
- font-family: 'Courier New', monospace;
- font-size: 13px;
- max-height: 200px;
- overflow-y: auto;
- margin-top: 15px;
- white-space: pre-wrap;
- word-break: break-all;
- }
-
- .steps {
- list-style: none;
- counter-reset: step-counter;
- }
-
- .steps li {
- counter-increment: step-counter;
- padding: 12px 0 12px 40px;
- position: relative;
- font-size: 15px;
- line-height: 1.6;
- color: #333;
- }
-
- .steps li::before {
- content: counter(step-counter);
- position: absolute;
- left: 0;
- top: 12px;
- width: 28px;
- height: 28px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: 700;
- font-size: 14px;
- }
-
- .alert {
- padding: 15px;
- border-radius: 8px;
- margin-top: 15px;
- font-size: 14px;
- line-height: 1.6;
- }
-
- .alert-info {
- background: #e3f2fd;
- color: #1565c0;
- border: 1px solid #90caf9;
- }
-
- .alert-success {
- background: #e7f4e4;
- color: #2e7d32;
- border: 1px solid #81c784;
- }
-
- .alert-warning {
- background: #fff3cd;
- color: #856404;
- border: 1px solid #ffc107;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>🧪 会话激活功能测试工具</h1>
- <p class="subtitle">快速设置测试数据,开始本地测试</p>
-
- <!-- 快速开始 -->
- <div class="section">
- <div class="section-title">🚀 快速开始</div>
- <div class="button-group">
- <button class="btn btn-primary" onclick="setupData()">
- ⚡ 一键设置测试数据
- </button>
- <button class="btn btn-success" onclick="openTestPage()">
- 🔗 打开测试页面
- </button>
- </div>
- <div class="alert alert-info">
- <strong>💡 提示:</strong> 点击"一键设置测试数据"后,再点击"打开测试页面"即可开始测试。
- </div>
- </div>
-
- <!-- 数据管理 -->
- <div class="section">
- <div class="section-title">📊 数据管理</div>
- <div class="button-group">
- <button class="btn btn-info" onclick="viewData()">
- 👁️ 查看当前数据
- </button>
- <button class="btn btn-danger" onclick="clearData()">
- 🗑️ 清除测试数据
- </button>
- </div>
- <div id="dataStatus" class="status" style="display: none;"></div>
- </div>
-
- <!-- 高级功能 -->
- <div class="section">
- <div class="section-title">🔧 高级功能</div>
- <div class="button-group">
- <button class="btn btn-warning" onclick="addOverdue()">
- ⏰ 添加超时消息
- </button>
- <button class="btn btn-success" onclick="markIntroSent()">
- ✅ 标记群介绍已发送
- </button>
- </div>
- <div class="alert alert-warning">
- <strong>⚠️ 注意:</strong> 这些功能用于测试特定场景,使用前请先设置基础数据。
- </div>
- </div>
-
- <!-- 使用说明 -->
- <div class="section">
- <div class="section-title">📖 使用说明</div>
- <ol class="steps">
- <li>点击"一键设置测试数据"按钮</li>
- <li>等待数据设置完成(查看控制台)</li>
- <li>点击"打开测试页面"按钮</li>
- <li>在新页面中测试各项功能</li>
- <li>测试完成后点击"清除测试数据"</li>
- </ol>
- </div>
-
- <!-- 控制台输出 -->
- <div class="section">
- <div class="section-title">💻 控制台输出</div>
- <div id="consoleOutput" class="console-output">
- 等待操作...
- </div>
- </div>
- </div>
-
- <script src="/test-setup.js"></script>
- <script>
- // 重写 console.log 以显示在页面上
- const originalLog = console.log;
- const outputDiv = document.getElementById('consoleOutput');
-
- console.log = function(...args) {
- originalLog.apply(console, args);
- const message = args.map(arg =>
- typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)
- ).join(' ');
- outputDiv.textContent += message + '\n';
- outputDiv.scrollTop = outputDiv.scrollHeight;
- };
-
- // 清空控制台输出
- function clearConsole() {
- outputDiv.textContent = '';
- }
-
- // 设置测试数据
- function setupData() {
- clearConsole();
- console.log('开始设置测试数据...\n');
- const result = setupTestData();
- if (result.success) {
- showAlert('success', '✅ 测试数据设置成功!现在可以打开测试页面了。');
- }
- }
-
- // 查看数据
- function viewData() {
- clearConsole();
- const result = viewTestData();
-
- const statusDiv = document.getElementById('dataStatus');
- statusDiv.style.display = 'block';
-
- let html = '';
- for (const [key, value] of Object.entries(result.data)) {
- const status = value ? 'success' : 'error';
- const icon = value ? '✅' : '❌';
- const text = value ? '已设置' : '未设置';
- html += `
- <div class="status-item">
- <span class="status-label">${key}</span>
- <span class="status-value ${status}">${icon} ${text}</span>
- </div>
- `;
- }
-
- statusDiv.innerHTML = html;
-
- if (result.allSet) {
- showAlert('success', '✅ 所有数据已设置,可以开始测试!');
- } else {
- showAlert('warning', '⚠️ 部分数据未设置,请先执行"一键设置测试数据"。');
- }
- }
-
- // 清除数据
- function clearData() {
- if (confirm('确定要清除所有测试数据吗?')) {
- clearConsole();
- const result = clearTestData();
- if (result.success) {
- showAlert('success', '✅ 测试数据已清除!');
- document.getElementById('dataStatus').style.display = 'none';
- }
- }
- }
-
- // 添加超时消息
- function addOverdue() {
- clearConsole();
- const result = addOverdueMessages();
- if (result.success) {
- showAlert('success', '✅ 超时消息已添加!刷新测试页面查看效果。');
- }
- }
-
- // 标记群介绍已发送
- function markIntroSent() {
- clearConsole();
- const result = simulateSendIntro();
- if (result.success) {
- showAlert('success', '✅ 群介绍已标记为已发送!刷新测试页面查看效果。');
- }
- }
-
- // 打开测试页面
- function openTestPage() {
- const url = 'http://localhost:4200/wxwork/test-company-001/project/project-001/chat-activation';
- window.open(url, '_blank');
- showAlert('info', '🔗 测试页面已在新标签页中打开!');
- }
-
- // 显示提示
- function showAlert(type, message) {
- const alertDiv = document.createElement('div');
- alertDiv.className = `alert alert-${type}`;
- alertDiv.textContent = message;
- alertDiv.style.position = 'fixed';
- alertDiv.style.top = '20px';
- alertDiv.style.right = '20px';
- alertDiv.style.zIndex = '9999';
- alertDiv.style.minWidth = '300px';
- alertDiv.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.15)';
- alertDiv.style.animation = 'slideIn 0.3s ease';
-
- document.body.appendChild(alertDiv);
-
- setTimeout(() => {
- alertDiv.style.animation = 'slideOut 0.3s ease';
- setTimeout(() => {
- document.body.removeChild(alertDiv);
- }, 300);
- }, 3000);
- }
-
- // 添加动画样式
- const style = document.createElement('style');
- style.textContent = `
- @keyframes slideIn {
- from {
- transform: translateX(400px);
- opacity: 0;
- }
- to {
- transform: translateX(0);
- opacity: 1;
- }
- }
-
- @keyframes slideOut {
- from {
- transform: translateX(0);
- opacity: 1;
- }
- to {
- transform: translateX(400px);
- opacity: 0;
- }
- }
- `;
- document.head.appendChild(style);
-
- // 页面加载时检查数据状态
- window.addEventListener('load', () => {
- console.log('🧪 会话激活功能测试工具已就绪!');
- console.log('💡 点击按钮开始测试\n');
- });
- </script>
- </body>
- </html>
|