mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-08 02:57:32 +08:00
fix: 允许窗口收起
This commit is contained in:
@@ -1,8 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="floatRoute" class="message-float-window">
|
<div v-if="floatRoute" class="message-float-window" :style="{ height: floatHeight }">
|
||||||
<iframe :src="iframeSrc" frameborder="0"></iframe>
|
<iframe :src="iframeSrc" frameborder="0"></iframe>
|
||||||
|
|
||||||
<div class="float-actions">
|
<div class="float-actions">
|
||||||
<i class="fas fa-expand" @click="expand"></i>
|
<i
|
||||||
|
class="fas fa-chevron-down"
|
||||||
|
v-if="floatHeight !== MINI_HEIGHT"
|
||||||
|
title="收起至 100px"
|
||||||
|
@click="collapseToMini"
|
||||||
|
></i>
|
||||||
|
<!-- 回弹:60vh -->
|
||||||
|
<i
|
||||||
|
class="fas fa-chevron-up"
|
||||||
|
v-if="floatHeight !== DEFAULT_HEIGHT"
|
||||||
|
title="回弹至 60vh"
|
||||||
|
@click="reboundToDefault"
|
||||||
|
></i>
|
||||||
|
<!-- 全屏打开(原有逻辑) -->
|
||||||
|
<i class="fas fa-expand" title="在页面中打开" @click="expand"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,17 +25,37 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const floatRoute = useState('messageFloatRoute')
|
const floatRoute = useState('messageFloatRoute')
|
||||||
|
|
||||||
|
const DEFAULT_HEIGHT = '60vh'
|
||||||
|
const MINI_HEIGHT = '45px'
|
||||||
|
const floatHeight = ref(DEFAULT_HEIGHT)
|
||||||
|
|
||||||
const iframeSrc = computed(() => {
|
const iframeSrc = computed(() => {
|
||||||
if (!floatRoute.value) return ''
|
if (!floatRoute.value) return ''
|
||||||
return floatRoute.value + (floatRoute.value.includes('?') ? '&' : '?') + 'float=1'
|
return floatRoute.value + (floatRoute.value.includes('?') ? '&' : '?') + 'float=1'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function collapseToMini() {
|
||||||
|
floatHeight.value = MINI_HEIGHT
|
||||||
|
}
|
||||||
|
|
||||||
|
function reboundToDefault() {
|
||||||
|
floatHeight.value = DEFAULT_HEIGHT
|
||||||
|
}
|
||||||
|
|
||||||
function expand() {
|
function expand() {
|
||||||
if (!floatRoute.value) return
|
if (!floatRoute.value) return
|
||||||
const target = floatRoute.value
|
const target = floatRoute.value
|
||||||
floatRoute.value = null
|
floatRoute.value = null
|
||||||
navigateTo(target)
|
navigateTo(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 当浮窗重新出现时,恢复默认高度
|
||||||
|
watch(
|
||||||
|
() => floatRoute.value,
|
||||||
|
(v) => {
|
||||||
|
if (v) floatHeight.value = DEFAULT_HEIGHT
|
||||||
|
},
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -29,8 +64,7 @@ function expand() {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 60vh;
|
/* 高度由内联样式绑定控制:60vh / 100px */
|
||||||
/* height: 80px; */
|
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
border: 1px solid var(--normal-border-color);
|
border: 1px solid var(--normal-border-color);
|
||||||
@@ -38,6 +72,7 @@ function expand() {
|
|||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
transition: height 0.25s ease; /* 平滑过渡 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-float-window iframe {
|
.message-float-window iframe {
|
||||||
@@ -49,10 +84,18 @@ function expand() {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
padding: 6px;
|
padding: 12px;
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.float-actions i {
|
.float-actions i {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float-actions i:hover {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -633,6 +633,10 @@ function goBack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-height: 200px) {
|
@media (max-height: 200px) {
|
||||||
|
.messages-list,
|
||||||
|
.message-input-area {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="messages-container">
|
<div class="messages-container">
|
||||||
<div class="page-title"><i class="fas fa-comments"></i>选择聊天</div>
|
<div class="page-title">
|
||||||
|
<i class="fas fa-comments"></i>
|
||||||
|
<span class="page-title-text">选择聊天</span>
|
||||||
|
</div>
|
||||||
<div v-if="!isFloatMode" class="float-control">
|
<div v-if="!isFloatMode" class="float-control">
|
||||||
<i class="fas fa-compress" @click="minimize" title="最小化"></i>
|
<i class="fas fa-compress" @click="minimize" title="最小化"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -347,7 +350,18 @@ function minimize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
|
padding: 12px;
|
||||||
display: none;
|
display: none;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title-text {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title-text:hover {
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.messages-title {
|
.messages-title {
|
||||||
|
|||||||
Reference in New Issue
Block a user