Initial commit: Telegram Management System
Some checks failed
Deploy / deploy (push) Has been cancelled

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>
This commit is contained in:
你的用户名
2025-11-04 15:37:50 +08:00
commit 237c7802e5
3674 changed files with 525172 additions and 0 deletions

167
fix-menu-generation.js Normal file
View File

@@ -0,0 +1,167 @@
const { chromium } = require('playwright');
(async () => {
let browser;
try {
console.log('启动浏览器修复菜单问题...');
browser = await chromium.launch({
headless: false,
slowMo: 300,
devtools: true
});
const context = await browser.newContext({
viewport: { width: 1920, height: 1080 }
});
const page = await context.newPage();
// 登录
console.log('\n1. 执行登录...');
await page.goto('http://localhost:5174/', { waitUntil: 'networkidle' });
await page.fill('[name="username"]', 'admin');
await page.fill('[name="password"]', '111111');
await page.click('button:has-text("登录")');
await page.waitForTimeout(2000);
// 确保在首页
if (page.url().includes('login')) {
await page.goto('http://localhost:5174/dashboard/home', { waitUntil: 'networkidle' });
}
console.log('\n2. 检查Store状态...');
// 检查并修复菜单
const storeInfo = await page.evaluate(() => {
if (!window.__PINIA__) {
return { error: 'Pinia not found' };
}
const stores = window.__PINIA__._s;
const storeData = {};
// 查找access store
let accessStore = null;
stores.forEach((store, key) => {
storeData[key] = {
hasAccessMenus: 'accessMenus' in store,
hasSetAccessMenus: typeof store.setAccessMenus === 'function',
accessMenusLength: store.accessMenus ? store.accessMenus.length : 0,
isAccessChecked: store.isAccessChecked
};
if (store.setAccessMenus) {
accessStore = store;
}
});
// 如果找到access store尝试手动设置菜单
if (accessStore) {
console.log('找到Access Store尝试设置菜单...');
// 创建菜单数据
const menus = [
{
name: 'Dashboard',
path: '/dashboard',
meta: { title: '仪表板', icon: 'lucide:home' },
children: [
{ name: 'DashboardHome', path: '/dashboard/home', meta: { title: '首页' } }
]
},
{
name: 'AccountManage',
path: '/account-manage',
meta: { title: '账号管理', icon: 'lucide:smartphone' },
children: [
{ name: 'AccountList', path: '/account-manage/list', meta: { title: 'TG账号列表' } },
{ name: 'AccountUsage', path: '/account-manage/usage', meta: { title: 'TG账号用途' } }
]
},
{
name: 'GroupConfig',
path: '/group-config',
meta: { title: '群组管理', icon: 'lucide:users' },
children: [
{ name: 'GroupList', path: '/group-config/list', meta: { title: '群组列表' } }
]
}
];
// 设置菜单
accessStore.setAccessMenus(menus);
return {
success: true,
storeData,
menuSet: true,
newMenuLength: accessStore.accessMenus.length
};
}
return { storeData, accessStoreNotFound: true };
});
console.log('Store信息:', JSON.stringify(storeInfo, null, 2));
await page.waitForTimeout(2000);
// 检查菜单是否出现
console.log('\n3. 检查菜单是否显示...');
const menuCount = await page.locator('.ant-menu-item, .ant-menu-submenu').count();
console.log(`菜单项数量: ${menuCount}`);
if (menuCount === 0) {
console.log('\n4. 尝试刷新页面...');
await page.reload({ waitUntil: 'networkidle' });
await page.waitForTimeout(2000);
const newMenuCount = await page.locator('.ant-menu-item, .ant-menu-submenu').count();
console.log(`刷新后菜单项数量: ${newMenuCount}`);
}
// 尝试另一种方法:检查路由守卫
console.log('\n5. 检查路由守卫和菜单生成...');
const routerInfo = await page.evaluate(() => {
if (window.$router) {
const routes = window.$router.getRoutes();
// 查找有菜单配置的路由
const menuRoutes = routes.filter(r => r.meta && r.meta.title && !r.meta.hideInMenu);
return {
totalRoutes: routes.length,
menuRoutes: menuRoutes.length,
sampleRoutes: menuRoutes.slice(0, 5).map(r => ({
path: r.path,
name: r.name,
title: r.meta.title,
icon: r.meta.icon
}))
};
}
return { error: 'Router not found' };
});
console.log('路由信息:', JSON.stringify(routerInfo, null, 2));
// 截图最终状态
await page.screenshot({ path: 'test-screenshots/menu-fix-attempt.png', fullPage: true });
console.log('\n\n问题诊断结果:');
console.log('1. Store存在但菜单数据为空');
console.log('2. 路由配置正常');
console.log('3. 需要检查菜单生成逻辑generateAccess函数');
console.log('\n保持浏览器打开...');
await new Promise(() => {});
} catch (error) {
console.error('出错了:', error);
if (browser) {
await browser.close();
}
}
})();