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

104 lines
2.9 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-03-14 10:13:50 +00:00
<div class="app-title-container flex-center cursor" @click="router.push('/')">
<div class="app-title-icon"></div>
<div class="app-title-text app-logo-font ml-4">
{{ defaultTitle }}
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">
<el-tooltip effect="dark" :content="$t('layout.topbar.github')" placement="top">
2024-04-28 04:56:46 +00:00
<AppIcon
iconName="app-github"
class="cursor color-secondary mr-8 ml-8"
style="font-size: 20px"
@click="toUrl('https://github.com/1Panel-dev/MaxKB')"
></AppIcon>
</el-tooltip>
<el-tooltip effect="dark" :content="$t('layout.topbar.wiki')" placement="top">
2024-04-28 04:56:46 +00:00
<AppIcon
iconName="app-reading"
class="cursor color-secondary mr-8 ml-8"
style="font-size: 20px"
@click="toUrl('https://github.com/1Panel-dev/MaxKB/wiki')"
></AppIcon>
</el-tooltip>
<el-tooltip effect="dark" :content="$t('layout.topbar.forum')" placement="top">
2024-04-28 04:56:46 +00:00
<AppIcon
iconName="app-help"
class="cursor color-secondary mr-8 ml-8"
style="font-size: 20px"
@click="toUrl('https://bbs.fit2cloud.com/c/mk/11')"
></AppIcon>
</el-tooltip>
<el-dropdown v-if="true" 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-03-14 10:13:50 +00:00
const router = useRouter()
2023-10-12 08:36:16 +00:00
const defaultTitle = import.meta.env.VITE_APP_TITLE
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
.app-title-icon {
2023-12-18 06:42:13 +00:00
background-image: url('@/assets/logo.png');
2023-09-15 09:40:35 +00:00
background-size: 100% 100%;
2023-12-18 06:42:13 +00:00
width: 35px;
height: 35px;
2023-09-15 09:40:35 +00:00
}
.app-title-text {
2023-11-02 10:25:09 +00:00
font-size: 24px;
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>