UnisKB/ui/src/layout/components/top-bar/index.vue

120 lines
3.1 KiB
Vue
Raw Normal View History

·
2023-09-15 09:40:35 +00:00
<template>
2023-11-02 10:25:09 +00:00
<div class="top-bar-container border-b flex-between">
2023-10-13 08:11:54 +00:00
<div class="flex-center h-full">
2024-07-01 01:45:59 +00:00
<div class="app-title-container cursor" @click="router.push('/')">
<div class="logo flex-center">
2024-07-15 10:08:02 +00:00
<LogoFull />
2023-12-07 11:28:38 +00:00
</div>
2024-03-14 10:13:50 +00:00
</div>
2023-09-15 09:40:35 +00:00
<TopMenu></TopMenu>
</div>
<div class="flex-center avatar">
2024-07-29 06:09:05 +00:00
<el-button
2024-07-30 03:02:49 +00:00
v-if="!user.isEnterprise()"
2024-07-29 06:09:05 +00:00
link
type="primary"
@click="toUrl('https://maxkb.cn/pricing.html')"
class="mr-8"
>
<AppIcon iconName="app-pricing" class="mr-8" style="font-size: 20px"></AppIcon>
2025-01-13 03:15:51 +00:00
{{ $t('common.professional') }}
2024-07-29 06:09:05 +00:00
</el-button>
2024-09-02 11:05:36 +00:00
<el-tooltip
effect="dark"
:content="$t('layout.topbar.github')"
placement="top"
v-if="user.themeInfo?.showProject"
>
2024-04-28 04:56:46 +00:00
<AppIcon
iconName="app-github"
class="cursor color-secondary mr-8 ml-8"
style="font-size: 20px"
2024-09-02 11:05:36 +00:00
@click="toUrl(user.themeInfo?.projectUrl)"
2024-04-28 04:56:46 +00:00
></AppIcon>
</el-tooltip>
2024-09-02 11:05:36 +00:00
<el-tooltip
effect="dark"
:content="$t('layout.topbar.wiki')"
placement="top"
v-if="user.themeInfo?.showUserManual"
>
2024-04-28 04:56:46 +00:00
<AppIcon
iconName="app-reading"
class="cursor color-secondary mr-8 ml-8"
style="font-size: 20px"
2024-09-02 11:05:36 +00:00
@click="toUrl(user.themeInfo?.userManualUrl)"
2024-04-28 04:56:46 +00:00
></AppIcon>
</el-tooltip>
2024-09-02 11:05:36 +00:00
<el-tooltip
effect="dark"
:content="$t('layout.topbar.forum')"
placement="top"
v-if="user.themeInfo?.showForum"
>
2024-04-28 04:56:46 +00:00
<AppIcon
iconName="app-help"
2024-07-29 06:09:05 +00:00
class="cursor color-secondary mr-16 ml-8"
2024-04-28 04:56:46 +00:00
style="font-size: 20px"
2024-09-02 11:05:36 +00:00
@click="toUrl(user.themeInfo?.forumUrl)"
2024-04-28 04:56:46 +00:00
></AppIcon>
</el-tooltip>
2025-01-13 03:15:51 +00:00
<el-dropdown trigger="click" type="primary">
<template #dropdown>
<el-dropdown-menu>
2024-04-28 04:56:46 +00:00
<el-dropdown-item
v-for="(lang, index) in langList"
:key="index"
:value="lang.value"
@click="changeLang(lang.value)"
>{{ lang.label }}</el-dropdown-item
>
</el-dropdown-menu>
</template>
2024-04-28 04:56:46 +00:00
<AppIcon
iconName="app-translate"
class="cursor color-secondary mr-16 ml-8"
style="font-size: 20px"
>
</AppIcon>
</el-dropdown>
2023-09-15 09:40:35 +00:00
<Avatar></Avatar>
</div>
</div>
</template>
<script setup lang="ts">
2023-10-16 10:58:51 +00:00
import TopMenu from './top-menu/index.vue'
import Avatar from './avatar/index.vue'
2024-03-14 10:13:50 +00:00
import { useRouter } from 'vue-router'
2024-04-28 04:56:46 +00:00
import { langList } from '@/locales/index'
import { useLocale } from '@/locales/useLocale'
2024-07-29 06:09:05 +00:00
import useStore from '@/stores'
const { user } = useStore()
2024-03-14 10:13:50 +00:00
const router = useRouter()
2024-07-10 10:04:38 +00:00
2024-04-28 04:56:46 +00:00
const { changeLocale } = useLocale()
const changeLang = (lang: string) => {
2024-04-28 04:56:46 +00:00
changeLocale(lang)
}
function toUrl(url: string) {
window.open(url, '_blank')
}
2023-09-15 09:40:35 +00:00
</script>
<style lang="scss">
.top-bar-container {
2023-10-13 08:11:54 +00:00
height: var(--app-header-height);
box-sizing: border-box;
padding: var(--app-header-padding);
2023-09-15 09:40:35 +00:00
.app-title-container {
2023-11-02 10:25:09 +00:00
margin-right: 45px;
2023-09-15 09:40:35 +00:00
}
2023-10-13 08:11:54 +00:00
.line {
height: 2em;
}
2023-09-15 09:40:35 +00:00
}
</style>