更新功能、刷新不立即解散房间、交互动画优化

This commit is contained in:
李琦
2026-08-15 09:15:06 +08:00
parent cd1ab90013
commit 7c56d1e658
6 changed files with 3363 additions and 917 deletions

View File

@@ -1,7 +1,7 @@
<script setup>
// 顶部导航栏:站点名、主导航(SVG 图标在上 + 文字在下的竖排布局)、消息入口(带未读角标)、积分、用户菜单
// 小屏(≤900px)不再收进汉堡抽屉,而是隐藏文字仅留图标(title 悬浮提示文字)
import { computed } from 'vue'
import { computed, ref, watch, onMounted, onBeforeUnmount } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useUserStore } from '../stores/user'
import { useThemeStore } from '../stores/theme'
@@ -33,6 +33,17 @@ const msgBadge = computed(() => {
return n > 99 ? '99+' : n
})
// 仅饥荒游玩页:导航变悬浮小条,默认隐藏,鼠标靠近顶部再展示
const navFloat = computed(() => route.path.startsWith('/play/starve'))
const navShow = ref(true)
watch(navFloat, (v) => { navShow.value = !v }, { immediate: true })
function onNavMouseMove(e) {
if (!navFloat.value) return
navShow.value = e.clientY <= 60
}
onMounted(() => window.addEventListener('mousemove', onNavMouseMove))
onBeforeUnmount(() => window.removeEventListener('mousemove', onNavMouseMove))
// 当前路由是否命中某导航
function isActive(path) {
return route.path === path || (path !== '/' && route.path.startsWith(path))
@@ -46,7 +57,7 @@ function logout() {
</script>
<template>
<header class="nav">
<header class="nav" :class="{ 'nav-float': navFloat, 'nav-hidden': navFloat && !navShow }">
<div class="nav-inner">
<router-link to="/" class="brand">
<span class="brand-icon"><NavIcon name="lobby" :size="26" /></span>
@@ -287,4 +298,53 @@ function logout() {
font-size: 15px;
}
}
/* ---- 仅饥荒游玩页:悬浮小导航,自动隐藏,鼠标靠近顶部展示 ---- */
.nav.nav-float {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 150;
height: 40px;
transition: transform 0.25s ease;
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.nav.nav-float.nav-hidden {
transform: translateY(-100%);
}
.nav-float .nav-inner {
max-width: none;
height: 40px;
padding: 0 10px;
gap: 10px;
}
.nav-float .brand {
font-size: 14px;
gap: 6px;
}
.nav-float .brand-name,
.nav-float .link-text,
.nav-float .nickname {
display: none;
}
.nav-float .links {
gap: 0;
}
.nav-float .link {
flex-direction: row;
padding: 4px 8px;
gap: 4px;
}
.nav-float .link-icon {
width: 18px;
height: 18px;
}
.nav-float .points {
font-size: 13px;
}
.nav-float .avatar {
width: 26px;
height: 26px;
}
</style>