header里面的logo图标增加链接指向首页
This commit is contained in:
parent
91ba49e4f0
commit
c381a476c5
@ -32,7 +32,7 @@
|
|||||||
class="mobile-header"
|
class="mobile-header"
|
||||||
>
|
>
|
||||||
<div class="mobile-header-content">
|
<div class="mobile-header-content">
|
||||||
<JLogo class="mobile-logo" />
|
<JLogo class="mobile-logo" @click="goToHome" />
|
||||||
<n-dropdown
|
<n-dropdown
|
||||||
:options="mobileDropdownOptions"
|
:options="mobileDropdownOptions"
|
||||||
:show-arrow="true"
|
:show-arrow="true"
|
||||||
@ -93,7 +93,7 @@ import { defineAsyncComponent, computed, watch, ref, provide, onMounted, onUnmou
|
|||||||
import { NLayout, NLayoutSider, NConfigProvider, NButton, NIcon, NDropdown } from 'naive-ui';
|
import { NLayout, NLayoutSider, NConfigProvider, NButton, NIcon, NDropdown } from 'naive-ui';
|
||||||
import { Toaster } from 'vue-sonner';
|
import { Toaster } from 'vue-sonner';
|
||||||
import { dialogs } from './utils/components';
|
import { dialogs } from './utils/components';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { getTeam } from './data/team';
|
import { getTeam } from './data/team';
|
||||||
import { session } from './data/session.js';
|
import { session } from './data/session.js';
|
||||||
import JLogo from '@/components/icons/JLogo.vue';
|
import JLogo from '@/components/icons/JLogo.vue';
|
||||||
@ -109,6 +109,7 @@ const SwitchTeamDialog = defineAsyncComponent(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
const team = getTeam();
|
const team = getTeam();
|
||||||
const instance = getCurrentInstance();
|
const instance = getCurrentInstance();
|
||||||
const showTeamSwitcher = ref(false);
|
const showTeamSwitcher = ref(false);
|
||||||
@ -188,6 +189,15 @@ const toggleSidebar = () => {
|
|||||||
sidebarCollapsed.value = !sidebarCollapsed.value;
|
sidebarCollapsed.value = !sidebarCollapsed.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 跳转到首页
|
||||||
|
const goToHome = () => {
|
||||||
|
router.push('/').catch((err) => {
|
||||||
|
if (err.name !== 'NavigationDuplicated') {
|
||||||
|
console.error('Navigation error:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 移动端下拉菜单选项
|
// 移动端下拉菜单选项
|
||||||
const mobileDropdownOptions = computed(() => {
|
const mobileDropdownOptions = computed(() => {
|
||||||
const options = [];
|
const options = [];
|
||||||
@ -346,6 +356,12 @@ n-config-provider {
|
|||||||
width: 28px;
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-logo:hover {
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-user-info-wrapper {
|
.mobile-user-info-wrapper {
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
class="user-info"
|
class="user-info"
|
||||||
:class="{ 'user-info-collapsed': collapsed }"
|
:class="{ 'user-info-collapsed': collapsed }"
|
||||||
>
|
>
|
||||||
<JLogo class="logo-icon" />
|
<JLogo class="logo-icon" @click.stop="goToHome" />
|
||||||
<div v-if="!collapsed" class="user-info-text">
|
<div v-if="!collapsed" class="user-info-text">
|
||||||
<div class="brand-name">今果 Jingrow</div>
|
<div class="brand-name">Jingrow</div>
|
||||||
<div class="user-name">
|
<div class="user-name">
|
||||||
{{ teamUserText }}
|
{{ teamUserText }}
|
||||||
</div>
|
</div>
|
||||||
@ -226,6 +226,15 @@ export default {
|
|||||||
return team?.pg?.user || '';
|
return team?.pg?.user || '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 跳转到首页
|
||||||
|
const goToHome = () => {
|
||||||
|
router.push('/').catch((err) => {
|
||||||
|
if (err.name !== 'NavigationDuplicated') {
|
||||||
|
console.error('Navigation error:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showTeamSwitcher,
|
showTeamSwitcher,
|
||||||
collapsed,
|
collapsed,
|
||||||
@ -235,6 +244,7 @@ export default {
|
|||||||
handleDropdownSelect,
|
handleDropdownSelect,
|
||||||
handleMenuSelect,
|
handleMenuSelect,
|
||||||
convertToMenuOptions,
|
convertToMenuOptions,
|
||||||
|
goToHome,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -296,6 +306,12 @@ export default {
|
|||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-icon:hover {
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info-text {
|
.user-info-text {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user