123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <template>
- <div>
- <v-toolbar
- class="banner"
- density="compact"
- style="padding-left: 0px;height: 50px;font-size: 14px;"
- >
- <div class="innerBox d-flex justify-space-between">
- <div>
- <div class="nav-logo" style="cursor: pointer;" @click="handleLogoClick">
- <v-img src="../../assets/logo.png" aspect-ratio="16/9" cover :width="90" style="height: 40px"></v-img>
- </div>
- </div>
-
- <div class="d-flex user-nav">
- <div class="d-flex align-center cursor-pointer">
- <v-img rounded width="40" height="40" src="https://minio.citupro.com/dev/menduner/7.png" ></v-img>
- <span class="ml-3">广州辞图科技有限公司</span>
- </div>
- <div class="line"></div>
-
- <!-- 头像用户名 -->
- <div class="d-flex align-center" v-if="getToken()">
- <v-menu open-on-hover>
- <template v-slot:activator="{ props }">
- <div class="d-flex ml-5 pl-2 align-center cursor-pointer" v-bind="props" @click="handleToPersonalCenter">
- <v-avatar>
- <v-img alt="" :src="baseInfo?.avatar ?? 'https://minio.citupro.com/dev/menduner/7.png'"></v-img>
- </v-avatar>
- <div class="ml-2">{{ baseInfo?.name ?? $t('sys.tourist') }}</div>
- </div>
- </template>
- <v-list>
- <v-list-item v-for="(item, index) in items" :key="index" @click="item.change">
- <template v-slot:prepend>
- <v-icon :icon="item.icon"></v-icon>
- </template>
- <v-list-item-title>{{ item.title }}</v-list-item-title>
- </v-list-item>
- </v-list>
- </v-menu>
- </div>
- <!-- 语言切换 -->
- <v-menu>
- <template v-slot:activator="{ props }">
- <v-btn
- class="ml-3"
- color="primary"
- size="small"
- icon="mdi-translate"
- v-bind="props"
- >
- </v-btn>
- </template>
- <v-list density="compact">
- <v-list-item
- v-for="item in localeStore.localeMap"
- :key="item.name"
- :value="item.lang"
- :active="localeStore.currentLocale.lang === item.lang"
- @click="localeStore.setCurrentLocale(item)"
- >
- <v-list-item-title>{{ item.name }}</v-list-item-title>
- </v-list-item>
- </v-list>
- </v-menu>
- <v-btn size="small" icon="mdi-bell-outline"></v-btn>
- </div>
- </div>
- </v-toolbar>
- </div>
- </template>
- <script setup>
- import { reactive, ref } from 'vue'
- import { getToken } from '@/utils/auth'
- import { useUserStore } from '@/store/user'
- import { useLocaleStore } from '@/store/locale'
- defineOptions({ name: 'personal-navbar' })
- defineProps({
- sticky: {
- type: Boolean,
- default: true
- }
- })
- const localeStore = useLocaleStore()
- const userStore = useUserStore()
- import { useRouter } from 'vue-router'
- const router = useRouter()
- const handleLogoClick = () => { router.push({ path: '/enterprise/home'}) }
- const show = ref(false)
- const userType = ref(0) // 0企业用户、1个人用户
- const changeRole = () => {
- if (userType.value) {
- show.value = true
- router.push({ path: '/enterprise/register' })
- } else {
- // 重新走登录拿数据
- }
- }
- const handleToPersonalCenter = () => {
- // router.push({ path: '/personalCenter' })
- }
- // 退出登录
- const handleLogout = async () => {
- await userStore.userLogout()
- router.push({ path: '/login' })
- }
- const items = ref([
- { title: '联系人信息', icon: 'mdi-account-outline', change: () => router.push({ path: '/resume' }) },
- { title: '账号管理', icon: 'mdi-cog-outline', change: () => router.push({ path: '/personalAccount/accountBinding' }) },
- { title: '切换为求职者', icon: 'mdi-swap-horizontal', change: changeRole },
- { title: '退出登录', icon: 'mdi-logout', change: handleLogout }
- ])
- const baseInfo = reactive(JSON.parse(localStorage.getItem('baseInfo'))) // 人才信息
- </script>
- <style lang="scss" scoped>
- .banner {
- width: 100%;
- height: 50px;
- z-index: var(--zIndex-nav) !important;
- color: #fff;
- background-color: #d5e6e8;
- padding-left: 0px;
- height: 50px;
- font-size: 15px;
- .left {
- height: 100%;
- display: flex;
- align-items: center;
- font-size: 20px;
- cursor: pointer;
- }
- }
- .hover:hover {
- cursor: pointer;
- background: rgba(0, 0, 0, 0.03);
- }
- .innerBox {
- position: relative;
- width: 100%;
- align-items: center;
- padding: 0 30px;
- }
- .nav-logo {
- float: left;
- }
- .nav {
- font-size: 0;
- float: left;
- margin-left: 50px;
- height: 49px;
- line-height: 49px;
- }
- .user-nav {
- color: var(--v-primary-base);
- }
- .line {
- width: 1px;
- height: 25px;
- background-color: #fff;
- margin: 0 10px;
- margin: 8px 0 0 29px;
- }
- </style>
|