mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
feat: 完成布局/仪表板/用户相关组件国际化与语言切换优化(TabBar/MainLayout/AppHeader、UsageTrend/ModelDistribution、User*、Common 组件、i18n/locale 增强)
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
@click="userMenuOpen = !userMenuOpen"
|
||||
>
|
||||
<i class="fas fa-user-circle text-sm sm:text-base" />
|
||||
<span class="hidden sm:inline">{{ currentUser.username || 'Admin' }}</span>
|
||||
<span class="hidden sm:inline">{{ currentUser.username || t('common.admin') }}</span>
|
||||
<i
|
||||
class="fas fa-chevron-down ml-1 text-xs transition-transform duration-200"
|
||||
:class="{ 'rotate-180': userMenuOpen }"
|
||||
@@ -191,7 +191,7 @@
|
||||
class="form-input w-full cursor-not-allowed bg-gray-100 dark:bg-gray-700 dark:text-gray-300"
|
||||
disabled
|
||||
type="text"
|
||||
:value="currentUser.username || 'Admin'"
|
||||
:value="currentUser.username || t('common.admin')"
|
||||
/>
|
||||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-400">
|
||||
{{ t('header.changePasswordModal.currentUsernameHint') }}
|
||||
@@ -298,7 +298,7 @@ const authStore = useAuthStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
// 当前用户信息
|
||||
const currentUser = computed(() => authStore.user || { username: 'Admin' })
|
||||
const currentUser = computed(() => authStore.user || {})
|
||||
|
||||
// OEM设置
|
||||
const oemSettings = computed(() => authStore.oemSettings || {})
|
||||
|
||||
@@ -22,10 +22,13 @@
|
||||
<script setup>
|
||||
import { ref, watch, nextTick, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import AppHeader from './AppHeader.vue'
|
||||
import TabBar from './TabBar.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
@@ -124,7 +127,7 @@ const handleTabChange = async (tabKey) => {
|
||||
} catch (err) {
|
||||
// 如果路由切换失败,恢复activeTab状态
|
||||
if (err.name !== 'NavigationDuplicated') {
|
||||
console.error('路由切换失败:', err)
|
||||
console.error(t('layout.mainLayout.routing.routeChangeError'), err)
|
||||
// 恢复到当前路由对应的tab
|
||||
initActiveTab()
|
||||
}
|
||||
|
||||
@@ -38,8 +38,11 @@
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
defineProps({
|
||||
activeTab: {
|
||||
type: String,
|
||||
@@ -54,24 +57,49 @@ const authStore = useAuthStore()
|
||||
// 根据 LDAP 配置动态生成 tabs
|
||||
const tabs = computed(() => {
|
||||
const baseTabs = [
|
||||
{ key: 'dashboard', name: '仪表板', shortName: '仪表板', icon: 'fas fa-tachometer-alt' },
|
||||
{ key: 'apiKeys', name: 'API Keys', shortName: 'API', icon: 'fas fa-key' },
|
||||
{ key: 'accounts', name: '账户管理', shortName: '账户', icon: 'fas fa-user-circle' }
|
||||
{
|
||||
key: 'dashboard',
|
||||
name: t('layout.tabBar.tabs.dashboard.name'),
|
||||
shortName: t('layout.tabBar.tabs.dashboard.shortName'),
|
||||
icon: 'fas fa-tachometer-alt'
|
||||
},
|
||||
{
|
||||
key: 'apiKeys',
|
||||
name: t('layout.tabBar.tabs.apiKeys.name'),
|
||||
shortName: t('layout.tabBar.tabs.apiKeys.shortName'),
|
||||
icon: 'fas fa-key'
|
||||
},
|
||||
{
|
||||
key: 'accounts',
|
||||
name: t('layout.tabBar.tabs.accounts.name'),
|
||||
shortName: t('layout.tabBar.tabs.accounts.shortName'),
|
||||
icon: 'fas fa-user-circle'
|
||||
}
|
||||
]
|
||||
|
||||
// 只有在 LDAP 启用时才显示用户管理
|
||||
if (authStore.oemSettings?.ldapEnabled) {
|
||||
baseTabs.push({
|
||||
key: 'userManagement',
|
||||
name: '用户管理',
|
||||
shortName: '用户',
|
||||
name: t('layout.tabBar.tabs.userManagement.name'),
|
||||
shortName: t('layout.tabBar.tabs.userManagement.shortName'),
|
||||
icon: 'fas fa-users'
|
||||
})
|
||||
}
|
||||
|
||||
baseTabs.push(
|
||||
{ key: 'tutorial', name: '使用教程', shortName: '教程', icon: 'fas fa-graduation-cap' },
|
||||
{ key: 'settings', name: '系统设置', shortName: '设置', icon: 'fas fa-cogs' }
|
||||
{
|
||||
key: 'tutorial',
|
||||
name: t('layout.tabBar.tabs.tutorial.name'),
|
||||
shortName: t('layout.tabBar.tabs.tutorial.shortName'),
|
||||
icon: 'fas fa-graduation-cap'
|
||||
},
|
||||
{
|
||||
key: 'settings',
|
||||
name: t('layout.tabBar.tabs.settings.name'),
|
||||
shortName: t('layout.tabBar.tabs.settings.shortName'),
|
||||
icon: 'fas fa-cogs'
|
||||
}
|
||||
)
|
||||
|
||||
return baseTabs
|
||||
|
||||
Reference in New Issue
Block a user