Files
jurong_circle_front_app/pages/message/message.vue
Sun_sun 9f3bd53563 2025-09-16
项目页面和消息页面
登录注册接口对接
2025-09-16 17:57:04 +08:00

222 lines
4.4 KiB
Vue

<template>
<view class="message-container">
<!-- 固定背景的容器 -->
<view class="background-container"></view>
<!-- 可滚动的内容区域 -->
<view class="content-container" :style="'height:'+height+'px'">
<view class="message-title">
容讯聊天室
</view>
<u-row class="message-search">
<u-col span="9">
<u-search placeholder="点击查询项目" v-model="keyword" :show-action="false"></u-search>
</u-col>
<u-col class="collection" span="3">
<image class="collection-icon" src="/static/icon/Bookmark.png" mode=""></image>
<view class="collection-text">
我的收藏
</view>
</u-col>
</u-row>
<view class="menu-list">
<view class="menu-item" v-for="(item,index) in menuList" @click="handleMenuChange(index)">
<view class="menu-title">{{item.name + '(' + item.count +')'}}
</view>
<image class="menu-icon"
:src="currentMenu==index?'/static/icon/Chevron down.png':'/static/icon/Chevron right Menu.png'"
mode=""></image>
</view>
</view>
<view class="message-list">
<view class="message-item" v-for="item in messageList">
{{item.messageName}}
</view>
</view>
</view>
<Tabbar id="tabbarId"></Tabbar>
</view>
</template>
<script setup lang="ts">
import { ref, computed, getCurrentInstance } from 'vue';
import {
onReady
} from '@dcloudio/uni-app';
import { onReady as onUniReady } from '@dcloudio/uni-app';
const instance = getCurrentInstance();
const height = ref(0)
const loadHeight = () => {
uni.getSystemInfo({
success(res) {
let screenHeight = res.screenHeight
uni.createSelectorQuery().in(instance.proxy).select("#tabbarId").boundingClientRect((data : any) => {
height.value = screenHeight - data.height
}).exec()
}
})
}
// 搜索
const keyword = ref('')
// 小菜单切换
const menuList = ref([{
name: '全部',
count: 5
}, {
name: '已投资',
count: 5
}, {
name: '未读',
count: 0
}, {
name: '不感兴趣',
count: 5
}])
// 当前小菜单
const currentMenu = ref(0)
// 切换小菜单
const handleMenuChange = (val) => {
currentMenu.value = val
}
// 项目
const messageList = ref([])
const mockData = () => {
for (var i = 0; i < 20; i++) {
messageList.value.push({
messageName: "test" + i
})
}
}
onUniReady(() => {
loadHeight()
// 模拟数据
mockData()
})
</script>
<style lang="scss" scoped>
.message-container {
width: 100%;
position: fixed;
top: 0;
left: 0;
height: 100%;
overflow: hidden;
/* 防止容器本身滚动 */
/* 固定背景 */
.background-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(180deg, #2F75F9 0%, #F0F3FF 34.13%);
z-index: 1;
/* 确保背景在内容下方 */
}
/* 内容滚动区域 */
.content-container {
position: relative;
z-index: 2;
/* 确保内容在背景上方 */
width: 100%;
overflow-y: scroll;
height: 100%;
padding: 32rpx;
.message-title {
margin-top: 40rpx;
text-align: center;
font-family: SF Pro;
font-weight: 700;
font-style: Bold;
font-size: 40rpx;
leading-trim: NONE;
line-height: 48rpx;
letter-spacing: 0%;
color: #FFFFFF;
}
.message-search {
margin-top: 20rpx;
.collection {
width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
.collection-icon {
width: 48rpx;
height: 48rpx;
}
.collection-text {
font-family: SF Pro;
font-weight: 30;
font-style: Expanded Ultralight;
font-size: 24rpx;
leading-trim: NONE;
line-height: 26px;
letter-spacing: 0%;
color: #FFFFFF;
}
}
}
.menu-list {
margin-top: 20rpx;
display: flex;
justify-content: space-around;
.menu-item {
display: flex;
align-items: center;
.menu-title {
font-family: SF Pro;
font-weight: 30;
font-style: Expanded Ultralight;
font-size: 24rpx;
leading-trim: NONE;
line-height: 42rpx;
letter-spacing: 0%;
color: #000;
}
.menu-icon {
width: 22rpx;
height: 22rpx;
}
}
}
.message-list {
margin-top: 10rpx;
.message-item {
// border: 1px solid #000;
padding: 20rpx 10px;
background-color: #FFFFFF;
border-radius: 10rpx;
margin-bottom: 10rpx;
}
}
}
}
</style>