fix: 修复仪表盘和API统计页面的多个问题

- 修复仪表盘天粒度下7天/30天快捷选择无数据的问题
- 修复API Keys页面统计按钮链接路由错误(admin -> admin-next)
- 改进统计页面限制展示,使用3个进度条更直观显示使用情况
- 后端API响应增加当前使用量数据(currentWindowRequests/Tokens/DailyCost)
- 修复教程页面window.location.origin为空的兼容性问题
- 无限制时使用无穷符号(∞)展示,提升用户体验

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
shaw
2025-08-04 11:58:26 +08:00
parent 4e3c826b6c
commit fce6d8e1ac
5 changed files with 253 additions and 58 deletions

View File

@@ -1132,7 +1132,42 @@ const tutorialSystems = [
// 当前基础URL
const currentBaseUrl = computed(() => {
return window.location.origin
// 更健壮的获取 origin 的方法,兼容旧版浏览器和特殊环境
let origin = ''
if (window.location.origin) {
// 现代浏览器直接支持 origin
origin = window.location.origin
} else {
// 旧版浏览器或特殊环境的兼容处理
const protocol = window.location.protocol
const hostname = window.location.hostname
const port = window.location.port
origin = protocol + '//' + hostname
// 只有在非默认端口时才添加端口号
if (port &&
((protocol === 'http:' && port !== '80') ||
(protocol === 'https:' && port !== '443'))) {
origin += ':' + port
}
}
// 如果还是获取不到,使用当前页面的 URL 推导
if (!origin) {
const currentUrl = window.location.href
const pathStart = currentUrl.indexOf('/', 8) // 跳过 http:// 或 https://
if (pathStart !== -1) {
origin = currentUrl.substring(0, pathStart)
} else {
// 最后的降级方案,使用相对路径
console.warn('无法获取完整的 origin将使用相对路径')
return '/api'
}
}
return origin + '/api'
})
</script>