2025-06-16 14:42:26 +08:00
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
import { useAppStore } from '@/stores';
|
|
|
|
|
|
import { IconExport, IconFile, IconCaretDown } from '@arco-design/web-vue/es/icon';
|
|
|
|
|
|
import { fetchMenusTree } from '@/api/all';
|
2025-06-20 06:10:15 -04:00
|
|
|
|
import { handleUserLogout } from '@/utils/user';
|
2025-06-23 03:16:55 -04:00
|
|
|
|
import { fetchLogOut } from '@/api/all/login';
|
2025-06-23 23:59:08 -04:00
|
|
|
|
import { useSidebarStore } from '@/stores/modules/side-bar';
|
|
|
|
|
|
import { MENU_GROUP_IDS } from '@/router/constants';
|
|
|
|
|
|
import router from '@/router';
|
|
|
|
|
|
import { useRoute } from 'vue-router';
|
2025-07-01 17:52:41 +08:00
|
|
|
|
import ExitAccountModal from '@/components/_base/exit-account-modal/index.vue';
|
2025-06-23 23:59:08 -04:00
|
|
|
|
|
|
|
|
|
|
interface MenuItem {
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
id: number;
|
|
|
|
|
|
children: Array<{
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
}>;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const lists = ref<MenuItem[]>([]);
|
|
|
|
|
|
const sidebarStore = useSidebarStore();
|
|
|
|
|
|
const route = useRoute();
|
2025-07-01 17:52:41 +08:00
|
|
|
|
const exitAccountModalRef = ref(null);
|
2025-06-23 23:59:08 -04:00
|
|
|
|
const selectedKey = computed(() => {
|
|
|
|
|
|
// 判断是否为工作台页面(假设路由名为 'Home' 或 path 为 '/')
|
|
|
|
|
|
if (route.name === 'Home' || route.path === '/') {
|
|
|
|
|
|
return [`${MENU_GROUP_IDS.WORK_BENCH_ID}`];
|
|
|
|
|
|
}
|
|
|
|
|
|
// 其他页面,activeMenuId 作为 key
|
|
|
|
|
|
return [String(sidebarStore.activeMenuId)];
|
|
|
|
|
|
});
|
2025-06-23 03:16:55 -04:00
|
|
|
|
|
|
|
|
|
|
const clickExit = async () => {
|
2025-07-01 17:52:41 +08:00
|
|
|
|
exitAccountModalRef.value?.open();
|
2025-06-17 11:18:39 +08:00
|
|
|
|
};
|
2025-06-16 14:42:26 +08:00
|
|
|
|
const getMenus = async () => {
|
|
|
|
|
|
const res = await fetchMenusTree();
|
2025-06-23 03:16:55 -04:00
|
|
|
|
if (res.code === 200) {
|
2025-06-21 16:57:01 +08:00
|
|
|
|
lists.value = res.data;
|
|
|
|
|
|
}
|
2025-06-16 14:42:26 +08:00
|
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
getMenus();
|
|
|
|
|
|
});
|
|
|
|
|
|
const appStore = useAppStore();
|
|
|
|
|
|
|
2025-06-23 05:58:04 -04:00
|
|
|
|
const setServerMenu = () => {
|
|
|
|
|
|
router.push('/management/person');
|
|
|
|
|
|
};
|
2025-06-16 14:42:26 +08:00
|
|
|
|
const handleSelect = (index: any) => {
|
2025-06-23 03:16:55 -04:00
|
|
|
|
if (index === 0) {
|
2025-06-23 23:59:08 -04:00
|
|
|
|
router.push('/');
|
2025-06-17 11:18:39 +08:00
|
|
|
|
} else {
|
2025-06-23 05:58:04 -04:00
|
|
|
|
router.push('/dataEngine/hotTranslation');
|
2025-06-17 11:18:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleDopdownClick = (index: any, ind: any) => {
|
2025-06-23 23:59:08 -04:00
|
|
|
|
const { children } = lists.value[index];
|
|
|
|
|
|
const indPath = children[ind] as any;
|
|
|
|
|
|
if (indPath.name === '行业热门话题洞察') {
|
2025-06-23 05:58:04 -04:00
|
|
|
|
router.push('/dataEngine/hotTranslation');
|
2025-06-23 23:59:08 -04:00
|
|
|
|
} else if (indPath.name === '行业词云') {
|
2025-06-23 05:58:04 -04:00
|
|
|
|
router.push('/dataEngine/hotCloud');
|
2025-06-23 23:59:08 -04:00
|
|
|
|
} else if (indPath.name === '行业关键词动向') {
|
2025-06-23 05:58:04 -04:00
|
|
|
|
router.push('/dataEngine/keyWord');
|
2025-06-23 23:59:08 -04:00
|
|
|
|
} else if (indPath.name === '用户痛点观察') {
|
2025-06-23 05:58:04 -04:00
|
|
|
|
router.push('/dataEngine/userPainPoints');
|
2025-06-23 23:59:08 -04:00
|
|
|
|
} else if (indPath.name === '重点品牌动向') {
|
2025-06-23 05:58:04 -04:00
|
|
|
|
router.push('/dataEngine/keyBrandMovement');
|
2025-06-23 23:59:08 -04:00
|
|
|
|
} else if (indPath.name === '用户画像') {
|
2025-06-23 05:58:04 -04:00
|
|
|
|
router.push('/dataEngine/userPersona');
|
2025-06-17 11:18:39 +08:00
|
|
|
|
}
|
2025-06-16 14:42:26 +08:00
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="navbar">
|
|
|
|
|
|
<div class="left-side">
|
2025-07-01 16:00:35 +08:00
|
|
|
|
<a-space class="cursor-pointer" @click="router.push('/')">
|
2025-06-17 11:18:39 +08:00
|
|
|
|
<img src="@/assets/logo.svg" alt="" />
|
2025-06-16 14:42:26 +08:00
|
|
|
|
</a-space>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="center-side">
|
2025-07-01 16:00:35 +08:00
|
|
|
|
<div class="menu-demo h-100%">
|
2025-06-23 23:59:08 -04:00
|
|
|
|
<a-menu
|
|
|
|
|
|
mode="horizontal"
|
|
|
|
|
|
:selected-keys="selectedKey"
|
|
|
|
|
|
:default-selected-keys="[`${MENU_GROUP_IDS.WORK_BENCH_ID}`]"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-menu-item :key="`${MENU_GROUP_IDS.WORK_BENCH_ID}`" @click="handleSelect(0)">
|
2025-07-01 16:00:35 +08:00
|
|
|
|
<span class="menu-item-text">工作台</span>
|
2025-06-16 14:42:26 +08:00
|
|
|
|
</a-menu-item>
|
2025-06-23 23:59:08 -04:00
|
|
|
|
<a-menu-item v-for="(item, index) in lists" :key="String(item.id)">
|
2025-07-01 16:00:35 +08:00
|
|
|
|
<a-dropdown :popup-max-height="false" class="layout-menu-item-dropdown">
|
|
|
|
|
|
<a-button>
|
|
|
|
|
|
<span class="menu-item-text mr-2px"> {{ item.name }}</span>
|
2025-07-01 16:39:47 +08:00
|
|
|
|
<icon-caret-down size="16" class="arco-icon-down !mr-0" />
|
2025-07-01 16:00:35 +08:00
|
|
|
|
</a-button>
|
2025-06-16 14:42:26 +08:00
|
|
|
|
<template #content>
|
2025-07-01 16:00:35 +08:00
|
|
|
|
<a-doption v-for="(child, ind) in item.children" :key="ind" @click="handleDopdownClick(index, ind)">
|
|
|
|
|
|
<span class="menu-item-text"> {{ child.name }}</span>
|
|
|
|
|
|
</a-doption>
|
2025-06-16 14:42:26 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
|
</a-menu>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<ul class="right-side">
|
|
|
|
|
|
<li>
|
2025-07-01 17:52:41 +08:00
|
|
|
|
<a-dropdown trigger="click" class="layout-avatar-dropdown">
|
2025-06-16 14:42:26 +08:00
|
|
|
|
<a-avatar class="cursor-pointer" :size="32">
|
2025-06-17 11:18:39 +08:00
|
|
|
|
<img alt="avatar" src="@/assets/avatar.svg" />
|
2025-06-16 14:42:26 +08:00
|
|
|
|
</a-avatar>
|
2025-06-17 11:18:39 +08:00
|
|
|
|
<template #content>
|
2025-07-01 17:52:41 +08:00
|
|
|
|
<div>
|
2025-06-17 11:18:39 +08:00
|
|
|
|
<a-doption>
|
2025-07-01 17:52:41 +08:00
|
|
|
|
<a-space class="flex justify-between w-100%" @click="setServerMenu">
|
|
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
|
<img src="@/assets/option.svg" class="w-16px h-16px mr-8px" />
|
|
|
|
|
|
<span>管理中心</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<icon-right size="12" />
|
2025-06-17 11:18:39 +08:00
|
|
|
|
</a-space>
|
|
|
|
|
|
</a-doption>
|
2025-07-01 17:52:41 +08:00
|
|
|
|
<!-- <a-doption>
|
|
|
|
|
|
<a-space class="flex justify-between w-100%">
|
|
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
|
<img src="@/assets/change.svg" class="w-16px h-16px mr-8px" />
|
|
|
|
|
|
<span>切换企业账号</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<icon-right size="12" />
|
2025-06-17 11:18:39 +08:00
|
|
|
|
</a-space>
|
2025-07-01 17:52:41 +08:00
|
|
|
|
</a-doption> -->
|
2025-06-17 11:18:39 +08:00
|
|
|
|
<a-doption>
|
2025-07-01 17:52:41 +08:00
|
|
|
|
<a-space class="flex justify-between w-100%" @click="clickExit">
|
|
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
|
<img src="@/assets/exit.svg" class="w-16px h-16px mr-8px" />
|
|
|
|
|
|
<span>退出登录</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<icon-right size="12" />
|
2025-06-17 11:18:39 +08:00
|
|
|
|
</a-space>
|
|
|
|
|
|
</a-doption>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2025-06-16 14:42:26 +08:00
|
|
|
|
</a-dropdown>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
2025-07-01 17:52:41 +08:00
|
|
|
|
<ExitAccountModal ref="exitAccountModalRef" />
|
2025-06-16 14:42:26 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2025-07-01 16:00:35 +08:00
|
|
|
|
<style scoped lang="scss">
|
2025-06-16 14:42:26 +08:00
|
|
|
|
.navbar {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
background-color: var(--color-bg-2);
|
|
|
|
|
|
border-bottom: 1px solid var(--color-border);
|
|
|
|
|
|
}
|
|
|
|
|
|
.left-side {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
padding-left: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.center-side {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
margin-left: 40px;
|
2025-07-01 16:00:35 +08:00
|
|
|
|
.menu-item-text {
|
|
|
|
|
|
color: var(--Text-2, #3c4043);
|
|
|
|
|
|
font-family: 'PuHuiTi-Medium';
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
|
}
|
|
|
|
|
|
:deep(.arco-menu) {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
.arco-menu-inner {
|
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.arco-menu-item {
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
&.arco-menu-selected {
|
|
|
|
|
|
.menu-item-text,
|
|
|
|
|
|
.arco-menu-selected-label {
|
|
|
|
|
|
color: #6d4cfe;
|
|
|
|
|
|
}
|
|
|
|
|
|
.arco-menu-selected-label {
|
|
|
|
|
|
background: var(--Brand-Brand-6, #6d4cfe);
|
|
|
|
|
|
height: 4px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
width: 50%;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
bottom: -8px;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-01 16:39:47 +08:00
|
|
|
|
.arco-icon-down {
|
|
|
|
|
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
.arco-dropdown-open .arco-icon-down {
|
|
|
|
|
|
transform: rotate(180deg);
|
|
|
|
|
|
}
|
2025-06-16 14:42:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
.cneter-tip {
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
color: var(--color-text-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
.menu-demo {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-side {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
padding-right: 20px;
|
|
|
|
|
|
list-style: none;
|
|
|
|
|
|
li {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
a {
|
|
|
|
|
|
color: var(--color-text-1);
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
.nav-btn {
|
|
|
|
|
|
border-color: rgb(var(--gray-2));
|
|
|
|
|
|
color: rgb(var(--gray-8));
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
2025-07-01 16:00:35 +08:00
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2025-07-01 17:52:41 +08:00
|
|
|
|
.layout-menu-item-dropdown,
|
|
|
|
|
|
.layout-avatar-dropdown {
|
2025-07-01 16:00:35 +08:00
|
|
|
|
.arco-dropdown {
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
border: 1px solid var(--BG-300, #e6e6e8);
|
|
|
|
|
|
background: var(--BG-white, #fff);
|
|
|
|
|
|
padding: 12px 0px;
|
|
|
|
|
|
.arco-dropdown-option {
|
|
|
|
|
|
padding: 0 12px;
|
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
&-content {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 10px 24px;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
.menu-item-text {
|
|
|
|
|
|
color: var(--Text-2, #3c4043);
|
|
|
|
|
|
font-family: 'PuHuiTi-Regular';
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
line-height: 22px; /* 137.5% */
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
&:not(.arco-dropdown-option-disabled):hover {
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
.arco-dropdown-option-content {
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
background: var(--BG-200, #f2f3f5);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-01 17:52:41 +08:00
|
|
|
|
.layout-avatar-dropdown {
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
.arco-dropdown {
|
|
|
|
|
|
padding: 12px 4px;
|
|
|
|
|
|
.arco-dropdown-option {
|
|
|
|
|
|
padding: 0 !important;
|
|
|
|
|
|
&-content {
|
|
|
|
|
|
padding: 0 12px !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-01 16:00:35 +08:00
|
|
|
|
</style>
|