feat: 路由动态权限控制、图片广场优化
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
import { Expand, Fold } from '@element-plus/icons-vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { checkPagePermission } from '@/config/permission.ts';
|
||||
import { useUserStore } from '@/stores';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -13,9 +15,16 @@ const inviteCodeFromUrl = computed(() => {
|
||||
|
||||
// 控制侧边栏折叠状态
|
||||
const isCollapsed = ref(false);
|
||||
const userStore = useUserStore();
|
||||
|
||||
const userName = userStore.userInfo?.user?.userName;
|
||||
|
||||
const hasPermission = checkPagePermission('/console/channel', userName);
|
||||
|
||||
// 菜单项配置
|
||||
const navItems = [
|
||||
|
||||
// 基础菜单项
|
||||
const baseNavItems = [
|
||||
{ name: 'user', label: '用户信息', icon: 'User', path: '/console/user' },
|
||||
{ name: 'apikey', label: 'API密钥', icon: 'Key', path: '/console/apikey' },
|
||||
{ name: 'recharge-log', label: '充值记录', icon: 'Document', path: '/console/recharge-log' },
|
||||
@@ -24,9 +33,13 @@ const navItems = [
|
||||
{ name: 'daily-task', label: '每日任务(限时)', icon: 'Trophy', path: '/console/daily-task' },
|
||||
{ name: 'invite', label: '每周邀请(限时)', icon: 'Present', path: '/console/invite' },
|
||||
{ name: 'activation', label: '激活码兑换', icon: 'MagicStick', path: '/console/activation' },
|
||||
{ name: 'channel', label: '渠道商管理', icon: 'Setting', path: '/console/channel' },
|
||||
];
|
||||
|
||||
// 根据权限动态添加渠道商管理
|
||||
const navItems = hasPermission
|
||||
? [...baseNavItems, { name: 'channel', label: '渠道商管理', icon: 'Setting', path: '/console/channel' }]
|
||||
: baseNavItems;
|
||||
|
||||
// 当前激活的菜单
|
||||
const activeNav = computed(() => {
|
||||
const path = route.path;
|
||||
|
||||
Reference in New Issue
Block a user