Files
telegram-management-system/verify-export-fix.js
你的用户名 237c7802e5
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit: Telegram Management System
Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 15:37:50 +08:00

78 lines
2.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 验证导出功能修复是否成功的脚本
const http = require('http');
console.log('=== TG账号导出功能验证 ===\n');
// 步骤1: 测试后端API是否正常
console.log('步骤1: 测试后端API...');
const testAPI = () => {
return new Promise((resolve, reject) => {
const options = {
hostname: 'localhost',
port: 3000,
path: '/tgAccount/test-all',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
};
const req = http.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
const result = JSON.parse(data);
resolve(result);
} catch (e) {
reject(e);
}
});
});
req.on('error', reject);
req.end();
});
};
// 运行测试
testAPI()
.then(result => {
if (result.success) {
console.log(`✅ API测试成功获取到 ${result.data.length} 条账号数据`);
console.log(` 第一条数据示例: 手机号=${result.data[0].phone}`);
} else {
console.log('❌ API返回失败');
}
console.log('\n步骤2: 前端修复总结');
console.log('已完成的修复:');
console.log(' 1. ✅ 添加了 exportModal ref 引用');
console.log(' 2. ✅ 修改了 showExportModal 函数,添加了多种显示模态框的方式');
console.log(' 3. ✅ 添加了 nextTick 确保DOM更新后再访问refs');
console.log(' 4. ✅ 添加了详细的控制台日志用于调试');
console.log(' 5. ✅ 在return语句中导出了exportModal');
console.log('\n步骤3: 用户操作指南');
console.log('请按以下步骤测试:');
console.log(' 1. 访问 http://localhost:8891/#/tgAccountManage/tgAccountList');
console.log(' 2. 点击"导出"按钮');
console.log(' 3. 观察浏览器控制台,应该看到以下日志:');
console.log(' - "showExportModal被调用"');
console.log(' - "使用xxx方式显示模态框"');
console.log(' 4. 如果模态框显示,选择"全部导出"并点击"提交"');
console.log(' 5. 文件应该会自动下载');
console.log('\n如果仍有问题请查看浏览器控制台的错误信息。');
console.log('\n备用方案:');
console.log('如果Excel导出失败系统会自动降级到CSV导出。');
console.log('CSV文件可以用Excel打开功能相同。');
})
.catch(error => {
console.error('❌ 测试失败:', error.message);
console.log('\n请确保后端服务器正在运行在 http://localhost:3000');
});