This commit is contained in:
2025-12-05 00:09:32 +08:00
parent bb3d22eabf
commit 3d1dbb3f97
214 changed files with 113060 additions and 1232 deletions
+48
View File
@@ -0,0 +1,48 @@
// 临时刷新路由脚本 - 在浏览器控制台执行
// 用于开发调试,修改数据库后快速刷新菜单
console.log('🔄 开始刷新路由...');
// 1. 清除本地缓存
localStorage.removeItem('sidebar_menu_cache');
sessionStorage.clear();
console.log('✅ 已清除本地缓存');
// 2. 获取当前 JWT
const jwt = localStorage.getItem('access_token');
if (!jwt) {
console.error('❌ 未找到 JWT token,请先登录');
} else {
console.log('✅ 找到 JWT token');
// 3. 直接调用后端 API
const apiBaseUrl = 'http://10.79.97.17:8000'; // 根据实际情况修改
fetch(`${apiBaseUrl}/rbac/user/routes`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${jwt}`,
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
console.log('📥 后端返回数据:', data);
if (data.code === 0 || data.code === 200) {
console.log('✅ 路由数据获取成功');
console.log('📋 路由列表:', data.data.routes);
// 4. 强制刷新页面
console.log('🔄 正在刷新页面...');
setTimeout(() => {
window.location.reload(true);
}, 1000);
} else {
console.error('❌ 后端返回错误:', data.msg);
}
})
.catch(error => {
console.error('❌ API 调用失败:', error);
});
}