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

View File

@@ -1,14 +1,32 @@
<template>
<view class="nav-bar">
<view class="nav-item" @click="showDrawer">
<uni-icons type="bars" size="24" color="#333" />
<view class="border-box h-44 flex flex-items-center pl-12 pr-12">
<uni-icons type="bars" size="24" color="#333" @click="showDrawer" />
<!-- 隐藏 -->
<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 class="w-24 h-24"></view>
</view>
</template>
<script setup>
import { ref } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
import { defineProps, computed } from "vue";
const props = defineProps({
mainPageDataModel: {
type: Object,
default: () => ({}),
},
});
const logoImageUrl = computed(
() => props.mainPageDataModel.initPageImages?.logoImageUrl
);
const showDrawer = () => uni.$emit("SHOW_DRAWER");
</script>

View File

@@ -1,16 +1,29 @@
.nav-bar {
display: flex;
align-items: center;
height: 44px;
padding: 0 15px;
// 图片从0%到100%动画
.image-animated {
animation: logo-scale 0.3s ease-in-out;
}
.nav-item {
width: 24px;
height: 24px;
margin-right: 10px;
@keyframes logo-scale {
0% {
transform: scale(0);
}
.nav-item-icon {
width: 100%;
height: 100%;
100% {
transform: scale(1);
}
}
// 文字从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 {
height: 80px;
}
.h-44 {
height: 44px;
}
.h-32 {
height: 32px;
}
.h-24 {
height: 24px;
}

View File

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

View File

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