完成授权页面样式重设计、云端数据权限功能、修复代理后台页面问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { Boxes, CreditCard, Gauge, Key, LogOut, User, Users } from 'lucide-vue-next'
|
||||
import { Boxes, Cloud, CreditCard, Gauge, Key, LogOut, User, Users } from 'lucide-vue-next'
|
||||
import { computed, onMounted, reactive } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
@@ -18,6 +18,7 @@ const user = reactive({
|
||||
email: 'agent@example.com',
|
||||
avatar: '/avatars/agent.jpg',
|
||||
role: 'agent',
|
||||
can_view_cloud_data: false,
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@@ -29,6 +30,7 @@ onMounted(() => {
|
||||
user.email = parsedUser.email || user.email
|
||||
user.avatar = parsedUser.avatar || user.avatar
|
||||
user.role = parsedUser.role || user.role
|
||||
user.can_view_cloud_data = parsedUser.can_view_cloud_data || false
|
||||
}
|
||||
catch (e) {
|
||||
console.error('Failed to parse user from localStorage', e)
|
||||
@@ -44,28 +46,39 @@ const teams = [
|
||||
},
|
||||
]
|
||||
|
||||
const navMain = computed(() => [
|
||||
{
|
||||
title: t('nav.mainFeatures'),
|
||||
items: [
|
||||
{
|
||||
title: t('nav.console'),
|
||||
url: '/agent',
|
||||
icon: Gauge,
|
||||
},
|
||||
{
|
||||
title: t('nav.cards'),
|
||||
url: '/agent/cards',
|
||||
icon: Key,
|
||||
},
|
||||
{
|
||||
title: t('nav.users'),
|
||||
url: '/agent/users',
|
||||
icon: Users,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
const navMain = computed(() => {
|
||||
const groups: any[] = [
|
||||
{
|
||||
title: t('nav.mainFeatures'),
|
||||
items: [
|
||||
{
|
||||
title: t('nav.console'),
|
||||
url: '/agent',
|
||||
icon: Gauge,
|
||||
},
|
||||
{
|
||||
title: t('nav.cards'),
|
||||
url: '/agent/cards',
|
||||
icon: Key,
|
||||
},
|
||||
{
|
||||
title: t('nav.users'),
|
||||
url: '/agent/users',
|
||||
icon: Users,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
if (user.can_view_cloud_data) {
|
||||
groups[0].items.push({
|
||||
title: '云端数据',
|
||||
url: '/agent/cloud-data',
|
||||
icon: Cloud,
|
||||
})
|
||||
}
|
||||
|
||||
groups.push({
|
||||
title: t('nav.financeGroup'),
|
||||
items: [
|
||||
{
|
||||
@@ -74,8 +87,10 @@ const navMain = computed(() => [
|
||||
icon: CreditCard,
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
return groups
|
||||
})
|
||||
|
||||
const breadcrumbs = computed(() => {
|
||||
const path = router.currentRoute.value.path
|
||||
@@ -86,6 +101,7 @@ const breadcrumbs = computed(() => {
|
||||
cards: t('nav.cards'),
|
||||
users: t('nav.users'),
|
||||
finance: t('nav.finance'),
|
||||
'cloud-data': '云端数据',
|
||||
profile: t('nav.profile'),
|
||||
create: t('nav.create'),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user