feat: 调整首页顶部功能

This commit is contained in:
duanshuwen
2025-11-04 21:13:19 +08:00
parent e81b7e662a
commit fad25e951c
6 changed files with 74 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
<view class="flex flex-col h-screen" @touchend="handleTouchEnd"> <view class="flex flex-col h-screen" @touchend="handleTouchEnd">
<!-- 顶部自定义导航栏 --> <!-- 顶部自定义导航栏 -->
<view class="header" :style="{ paddingTop: statusBarHeight + 'px' }"> <view class="header" :style="{ paddingTop: statusBarHeight + 'px' }">
<ChatTopNavBar @openDrawer="openDrawer" /> <ChatTopNavBar :mainPageDataModel="mainPageDataModel" />
</view> </view>
<!-- 消息列表可滚动区域 --> <!-- 消息列表可滚动区域 -->
@@ -15,7 +15,7 @@
@scrolltolower="handleScrollToLower" @scrolltolower="handleScrollToLower"
> >
<!-- welcome栏 --> <!-- welcome栏 -->
<ChatTopWelcome :mainPageDataModel="mainPageDataModel" /> <ChatTopWelcome ref="welcomeRef" :mainPageDataModel="mainPageDataModel" />
<view <view
class="area-msg-list-content" class="area-msg-list-content"
@@ -202,10 +202,6 @@ let webSocketConnectStatus = false;
// 当前会话的消息ID用于保持发送和终止的messageId一致 // 当前会话的消息ID用于保持发送和终止的messageId一致
let currentSessionMessageId = null; let currentSessionMessageId = null;
// 打开抽屉
const emits = defineEmits(["openDrawer"]);
const openDrawer = () => emits("openDrawer");
/// =============事件函数↓================ /// =============事件函数↓================
const handleTouchEnd = () => { const handleTouchEnd = () => {
clearTimeout(holdKeyboardTimer.value); clearTimeout(holdKeyboardTimer.value);

View File

@@ -1,14 +1,32 @@
<template> <template>
<view class="nav-bar"> <view class="border-box h-44 flex flex-items-center pl-12 pr-12">
<view class="nav-item" @click="showDrawer"> <uni-icons type="bars" size="24" color="#333" @click="showDrawer" />
<uni-icons type="bars" size="24" color="#333" />
<!-- 隐藏 -->
<view class="flex-full h-full flex flex-items-center flex-justify-center">
<!-- 需要添加的image-animated动画 -->
<image class="w-32 h-32" :src="logoImageUrl" mode="aspectFit" />
<!-- 需要添加的text-animated动画 -->
<text class="font-size-14 font-500 color-171717 ml-10">沐沐</text>
</view> </view>
<view class="w-24 h-24"></view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { defineProps, computed } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
const props = defineProps({
mainPageDataModel: {
type: Object,
default: () => ({}),
},
});
const logoImageUrl = computed(
() => props.mainPageDataModel.initPageImages?.logoImageUrl
);
const showDrawer = () => uni.$emit("SHOW_DRAWER"); const showDrawer = () => uni.$emit("SHOW_DRAWER");
</script> </script>

View File

@@ -1,16 +1,29 @@
.nav-bar { // 图片从0%到100%动画
display: flex; .image-animated {
align-items: center; animation: logo-scale 0.3s ease-in-out;
height: 44px; }
padding: 0 15px;
.nav-item { @keyframes logo-scale {
width: 24px; 0% {
height: 24px; transform: scale(0);
margin-right: 10px;
} }
.nav-item-icon { 100% {
width: 100%; transform: scale(1);
height: 100%; }
}
// 文字从0%到100%动画,从左到右
.text-animated {
animation: text-fade-in 0.3s ease-in-out;
}
@keyframes text-fade-in {
0% {
opacity: 0;
transform: translateX(-20px);
}
100% {
opacity: 1;
transform: translateX(0);
} }
} }

View File

@@ -9,3 +9,15 @@
.h-80 { .h-80 {
height: 80px; height: 80px;
} }
.h-44 {
height: 44px;
}
.h-32 {
height: 32px;
}
.h-24 {
height: 24px;
}

View File

@@ -59,6 +59,10 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
.ml-10 {
margin-left: 10px;
}
.m-12 { .m-12 {
margin: 12px; margin: 12px;
} }

View File

@@ -6,6 +6,14 @@
width: 100vw; width: 100vw;
} }
.w-24 {
width: 24px;
}
.w-32 {
width: 32px;
}
.w-50 { .w-50 {
width: 50%; width: 50%;
} }