feat: 申请试用权限调整
This commit is contained in:
@ -2,17 +2,25 @@
|
||||
import { Input } from 'ant-design-vue';
|
||||
// import { handleUserHome } from '@/utils/user.ts';
|
||||
import { useChatStore } from '@/stores/modules/chat';
|
||||
import { useUserStore } from '@/stores';
|
||||
|
||||
export default {
|
||||
setup(props, { emit, expose }) {
|
||||
const chatStore = useChatStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const keyWord = ref('');
|
||||
|
||||
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||
|
||||
const handleSearch = () => {
|
||||
chatStore.setSearchValue(keyWord.value);
|
||||
chatStore.onCreateSession();
|
||||
keyWord.value = '';
|
||||
};
|
||||
|
||||
if (!hasOpenEnterprise.value) return null;
|
||||
|
||||
return () => (
|
||||
<div class="middle-wrap h-100% flex items-center justify-center">
|
||||
<Input
|
||||
@ -35,6 +43,6 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
@import './style.scss';
|
||||
</style>
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="right-wrap">
|
||||
<!-- 任务中心 -->
|
||||
<div class="relative p-6px rounded-30px flex items-center justify-center task-icon" @click="setUnread">
|
||||
<div class="relative p-6px rounded-30px flex items-center justify-center task-icon" @click="setUnread" v-if="hasOpenEnterprise">
|
||||
<SvgIcon name="svg-taskCenter" size="20" class="color-#737478" @click="openDownloadCenter" />
|
||||
<div class="w-6px h-6px rounded-50% bg-#F64B31 absolute top-6px right-6px" v-if="hasUnreadInfo"></div>
|
||||
</div>
|
||||
|
||||
<!-- 灵机空间入口 -->
|
||||
<div class="agent-entry mx-16px" :class="isAgentRoute ? 'agent' : ''" @click="handleAgentClick"></div>
|
||||
<div class="agent-entry mx-16px" :class="isAgentRoute ? 'agent' : ''" @click="handleAgentClick" v-if="hasOpenEnterprise"></div>
|
||||
|
||||
<!-- 头像设置 -->
|
||||
<Dropdown trigger="click" overlayClassName="layout-avatar-dropdown">
|
||||
@ -23,7 +23,7 @@
|
||||
<icon-right size="12" />
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem>
|
||||
<MenuItem v-if="hasOpenEnterprise">
|
||||
<SubMenu value="option-1" position="lt" trigger="hover" popupClassName="enterprises-dsubmenu">
|
||||
<template #title>
|
||||
<div class="flex justify-between w-100% h-full items-center">
|
||||
@ -70,7 +70,8 @@
|
||||
|
||||
<script setup>
|
||||
import { Dropdown, Menu, MenuItem, SubMenu } from 'ant-design-vue';
|
||||
import router from '@/router';
|
||||
import { useRouter } from "vue-router";
|
||||
// import router from '@/router';
|
||||
import { useEnterpriseStore } from '@/stores/modules/enterprise';
|
||||
import { useSidebarStore } from '@/stores/modules/side-bar';
|
||||
import { useUserStore } from '@/stores';
|
||||
@ -94,8 +95,10 @@ const enterpriseStore = useEnterpriseStore();
|
||||
const userStore = useUserStore();
|
||||
const sideBarStore = useSidebarStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const hasUnreadInfo = computed(() => sideBarStore.unreadInfo.length);
|
||||
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||
|
||||
const exitAccountModalRef = ref(null);
|
||||
const downloadCenterModalRef = ref(null);
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
<div class="navbar-wrap px-24px">
|
||||
<div class="w-full h-full relative flex justify-between">
|
||||
|
||||
<div class="left-wrap flex items-center cursor-pointer" @click="handleUserHome">
|
||||
<img src="@/assets/img/icon-logo.png" alt="" width="96" height="24" />
|
||||
<div class="left-wrap flex items-center cursor-pointer" @click="onLogoClick">
|
||||
<img src="@/assets/img/icon-logo.png" alt="" width="96" height="24"/>
|
||||
</div>
|
||||
<!-- <div class="flex-1"> -->
|
||||
<MiddleSide v-if="!isHomeRoute"/>
|
||||
<!-- </div> -->
|
||||
<RightSide :isAgentRoute="isAgentRoute" v-if="userStore.isLogin"/>
|
||||
</div>
|
||||
<!-- <div class="flex-1"> -->
|
||||
<MiddleSide v-if="!isHomeRoute" />
|
||||
<!-- </div> -->
|
||||
<RightSide :isAgentRoute="isAgentRoute" v-if="userStore.isLogin" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
@ -25,6 +25,7 @@ import router from '@/router';
|
||||
const route = useRoute();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||
const isAgentRoute = computed(() => {
|
||||
return route.meta?.isAgentRoute;
|
||||
});
|
||||
@ -32,6 +33,16 @@ const isAgentRoute = computed(() => {
|
||||
const isHomeRoute = computed(() => {
|
||||
return route.name === 'Home';
|
||||
});
|
||||
|
||||
const onLogoClick = () => {
|
||||
if (hasOpenEnterprise.value) {
|
||||
handleUserHome();
|
||||
} else {
|
||||
router.push({
|
||||
name: 'Trial'
|
||||
})
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.navbar-wrap {
|
||||
@ -58,16 +69,20 @@ const isHomeRoute = computed(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.arco-dropdown-option-suffix {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.enterprises-doption {
|
||||
.arco-dropdown-option-content {
|
||||
padding: 0 !important;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
&:not(.arco-dropdown-option-disabled):hover {
|
||||
background-color: transparent;
|
||||
|
||||
.arco-dropdown-option-content {
|
||||
background: var(--BG-200, #f2f3f5);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
label: '账号管理',
|
||||
routeName: 'MediaAccountAccountManagement',
|
||||
requireLogin: true,
|
||||
requireAuth: true,
|
||||
activeMatch: ['MediaAccountAccountManagement'],
|
||||
},
|
||||
{
|
||||
@ -34,6 +35,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
label: '账号数据',
|
||||
routeName: 'MediaAccountAccountDashboard',
|
||||
requireLogin: true,
|
||||
requireAuth: true,
|
||||
activeMatch: ['MediaAccountAccountDashboard', 'MediaAccountAccountDetails'],
|
||||
},
|
||||
// {
|
||||
@ -42,6 +44,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
// label: '账户管理',
|
||||
// routeName: 'PutAccountAccountManagement',
|
||||
// requireLogin: true,
|
||||
// requireAuth: true,
|
||||
// activeMatch: ['PutAccountAccountManagement'],
|
||||
// },
|
||||
// {
|
||||
@ -50,6 +53,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
// label: '账户数据',
|
||||
// routeName: 'PutAccountAccountData',
|
||||
// requireLogin: true,
|
||||
// requireAuth: true,
|
||||
// activeMatch: ['PutAccountAccountData'],
|
||||
// },
|
||||
// {
|
||||
@ -58,6 +62,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
// label: '投放表现分析',
|
||||
// routeName: 'PutAccountAccountDashboard',
|
||||
// requireLogin: true,
|
||||
// requireAuth: true,
|
||||
// activeMatch: ['PutAccountAccountDashboard'],
|
||||
// },
|
||||
// {
|
||||
@ -66,6 +71,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
// label: '投放指南',
|
||||
// routeName: 'PutAccountInvestmentGuidelines',
|
||||
// requireLogin: true,
|
||||
// requireAuth: true,
|
||||
// activeMatch: ['PutAccountInvestmentGuidelines', 'PutAccountInvestmentGuidelinesDetail'],
|
||||
// },
|
||||
],
|
||||
@ -81,6 +87,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
label: '成品库',
|
||||
routeName: 'MaterialCenterFinishedProducts',
|
||||
requireLogin: true,
|
||||
requireAuth: true,
|
||||
activeMatch: [
|
||||
'MaterialCenterFinishedProducts',
|
||||
'ManuscriptUpload',
|
||||
@ -96,6 +103,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
label: '原料库',
|
||||
routeName: 'MaterialCenterRawMaterial',
|
||||
requireLogin: true,
|
||||
requireAuth: true,
|
||||
activeMatch: ['MaterialCenterRawMaterial'],
|
||||
},
|
||||
],
|
||||
@ -119,6 +127,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
label: '成品库',
|
||||
routeName: 'WriterMaterialCenterFinishedProducts',
|
||||
requireLogin: true,
|
||||
requireAuth: true,
|
||||
activeMatch: [
|
||||
'WriterMaterialCenterFinishedProducts',
|
||||
'WriterManuscriptUpload',
|
||||
@ -134,6 +143,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
// label: '原料库',
|
||||
// routeName: 'WriterMaterialCenterRawMaterial',
|
||||
// requireLogin: true,
|
||||
// requireAuth: true,
|
||||
// activeMatch: ['WriterMaterialCenterRawMaterial'],
|
||||
// },
|
||||
],
|
||||
@ -156,6 +166,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
label: '企业信息',
|
||||
routeName: 'ManagementEnterprise',
|
||||
requireLogin: true,
|
||||
requireAuth: true,
|
||||
activeMatch: [
|
||||
'ManagementEnterprise',
|
||||
],
|
||||
@ -166,6 +177,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
||||
label: '账号管理',
|
||||
routeName: 'ManagementAccount',
|
||||
requireLogin: true,
|
||||
requireAuth: true,
|
||||
activeMatch: ['ManagementAccount'],
|
||||
},
|
||||
]
|
||||
|
||||
@ -1,62 +0,0 @@
|
||||
// /*
|
||||
// * @Author: RenXiaoDong
|
||||
// * @Date: 2025-06-19 01:45:53
|
||||
// */
|
||||
// import type { RouteRecordRaw, RouteRecordNormalized } from 'vue-router';
|
||||
// import { useRouter } from 'vue-router';
|
||||
// import { useSidebarStore } from '@/stores/modules/side-bar';
|
||||
|
||||
// export default function useMenuTree() {
|
||||
// const router = useRouter();
|
||||
// const appRoutes = router.options?.routes ?? [];
|
||||
// const sidebarStore = useSidebarStore();
|
||||
// const appRoute = computed(() => {
|
||||
// const _filterRoutes = appRoutes.filter((v) => v.meta?.id === sidebarStore.activeMenuKey);
|
||||
// return _filterRoutes;
|
||||
// });
|
||||
// const menuTree = computed(() => {
|
||||
// const copyRouter = cloneDeep(appRoute.value) as RouteRecordNormalized[];
|
||||
// copyRouter.sort((a: RouteRecordNormalized, b: RouteRecordNormalized) => {
|
||||
// return (a.meta.order || 0) - (b.meta.order || 0);
|
||||
// });
|
||||
// function travel(_routes: RouteRecordRaw[], layer: number) {
|
||||
// if (!_routes) return null;
|
||||
|
||||
// const collector: any = _routes.map((element) => {
|
||||
// // leaf node
|
||||
// if (element.meta?.hideChildrenInMenu || !element.children) {
|
||||
// element.children = [];
|
||||
// return element;
|
||||
// }
|
||||
|
||||
// // route filter hideInMenu true
|
||||
// element.children = element.children.filter((x) => x.meta?.hideInMenu !== true);
|
||||
|
||||
// // Associated child node
|
||||
// const subItem = travel(element.children, layer + 1);
|
||||
|
||||
// if (subItem.length) {
|
||||
// element.children = subItem;
|
||||
// return element;
|
||||
// }
|
||||
// // the else logic
|
||||
// if (layer > 1) {
|
||||
// element.children = subItem;
|
||||
// return element;
|
||||
// }
|
||||
|
||||
// if (element.meta?.hideInMenu === false) {
|
||||
// return element;
|
||||
// }
|
||||
|
||||
// return null;
|
||||
// });
|
||||
// return collector.filter(Boolean);
|
||||
// }
|
||||
// return travel(copyRouter, 0);
|
||||
// });
|
||||
|
||||
// return {
|
||||
// menuTree,
|
||||
// };
|
||||
// }
|
||||
Reference in New Issue
Block a user