feat: 申请试用权限调整

This commit is contained in:
rd
2025-09-11 11:26:51 +08:00
parent 32bc0c4b95
commit 44e1ea9a06
15 changed files with 147 additions and 133 deletions

View File

@ -1,13 +1,12 @@
<script lang="tsx">
import { Dropdown, Menu, Layout } from 'ant-design-vue';
import type { RouteMeta, RouteRecordRaw } from 'vue-router';
import { Dropdown, Layout, Menu } from 'ant-design-vue';
import { useRoute } from 'vue-router';
import SvgIcon from '@/components/svg-icon/index.vue';
import { useAppStore } from '@/stores';
import { useAppStore, useUserStore } from '@/stores';
import { useSidebarStore } from '@/stores/modules/side-bar';
import { MENU_LIST } from './menu-list';
import type { typeMenuItem } from './menu-list';
import { MENU_LIST } from './menu-list';
import { handleUserHome } from '@/utils/user';
import icon1 from '@/assets/img/agent/icon1.png';
@ -21,14 +20,17 @@ export default defineComponent({
const sidebarStore = useSidebarStore();
const appStore = useAppStore();
const userStore = useUserStore();
const currentMenuList = ref<typeMenuItem[]>([]);
// const currentMenuList = ref<typeMenuItem[]>([]);
const currentMenuModInfo = ref<typeMenuItem>({});
const currentRouteName = computed(() => route.name as string);
const currentRouteGroup = computed(() => route.meta?.group ?? 'GroupMain');
const isHomeRoute = computed(() => currentRouteName.value === 'Home');
const showAiSearch = computed(() => !route.meta?.hideAiSearch);
const currentMenuList = computed(() => sidebarStore.currentMenuList);
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
const collapsed = computed(() => {
return sidebarStore.menuCollapse;
@ -134,8 +136,27 @@ export default defineComponent({
};
const initMenuList = () => {
const groupMenuList = MENU_LIST?.[currentRouteGroup.value as string] ?? [];
currentMenuList.value = cloneDeep(groupMenuList);
let groupMenuList = MENU_LIST?.[currentRouteGroup.value as string] ?? [];
// 如果企业未开通,过滤掉 requireAuth 为 true 的菜单项
if (!hasOpenEnterprise.value) {
groupMenuList = groupMenuList.filter((item) => {
if (item.requireAuth === true) {
return false;
}
if (item.children && item.children.length > 0) {
const filteredChildren = item.children.filter((child) => !child.requireAuth);
if (filteredChildren.length === 0 && !item.routeName) {
return false;
}
item.children = filteredChildren;
}
return true;
});
}
sidebarStore.setCurrentMenuList(groupMenuList);
};
const initCollapse = () => {
@ -217,17 +238,21 @@ export default defineComponent({
</style>
<style lang="scss">
@import './style.scss';
.layout-sider-dropdown-xt {
.container {
border-radius: 8px;
background: var(--BG-White, #fff);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
.menu-item {
@include menu-item;
padding: 8px;
&:hover {
background-color: rgba(109, 76, 254, 0.08) !important;
color: #6d4cfe !important;
.svg-icon {
color: #6d4cfe !important;
}