2025-09-28

This commit is contained in:
2025-09-28 09:21:15 +08:00
parent d2a0584ee5
commit 5110537d73
24 changed files with 819 additions and 365 deletions

View File

@@ -1,37 +1,39 @@
<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 class="content-container">
<view style="padding: 32rpx;">
<view id="fixedHeadId">
<view class="message-title">
容讯聊天室
</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 +')'}}
<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>
<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>
<scroll-view scroll-y="true" class="message-list" :style="'height:'+height+'px'">
<view class="message-item" v-for="item in messageList" @click="handleChat(item)">
{{item.program.name}}
</view>
</scroll-view>
</view>
</view>
@@ -45,6 +47,7 @@
onReady, onPullDownRefresh
} from '@dcloudio/uni-app';
import { onReady as onUniReady } from '@dcloudio/uni-app';
import { groupAPI } from '../../api/group';
const instance = getCurrentInstance();
const height = ref(0)
@@ -54,7 +57,10 @@
success(res) {
let screenHeight = res.screenHeight
uni.createSelectorQuery().in(instance.proxy).select("#tabbarId").boundingClientRect((data : any) => {
height.value = screenHeight - data.height
height.value = screenHeight - data.height - 50
}).exec()
uni.createSelectorQuery().in(instance.proxy).select("#fixedHeadId").boundingClientRect((data : any) => {
height.value = height.value - data.height
}).exec()
}
})
@@ -94,18 +100,28 @@
})
}
}
// 下拉刷新
onPullDownRefresh(() => {
const handleChat = (item) => {
uni.navigateTo({
url: '/pages/program/chat?groupId=' + item.groupId
})
}
const loadData = () => {
groupAPI.getList().then((res) => {
messageList.value = res.data.list
})
}
onPullDownRefresh(async () => {
await loadData()
uni.stopPullDownRefresh()
})
onUniReady(() => {
loadHeight()
// 模拟数据
mockData()
loadData()
})
</script>
@@ -117,29 +133,12 @@
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;
/* 确保内容在背景上方 */
background: linear-gradient(180deg, #2F75F9 0%, #F0F3FF 34.13%);
width: 100%;
overflow-y: scroll;
height: 100%;
padding: 32rpx;
.message-title {
margin-top: 40rpx;