Files
jurong_circle_front_app/pages/message/message.vue
2025-09-28 17:30:20 +08:00

228 lines
4.8 KiB
Vue

<template>
<view class="message-container">
<!-- 可滚动的内容区域 -->
<view class="content-container">
<view style="padding: 32rpx;">
<view id="fixedHeadId">
<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>
<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>
<Tabbar id="tabbarId"></Tabbar>
</view>
</template>
<script setup lang="ts">
import { ref, computed, getCurrentInstance } from 'vue';
import {
onReady, onPullDownRefresh
} from '@dcloudio/uni-app';
import { onReady as onUniReady } from '@dcloudio/uni-app';
import { groupAPI } from '../../api/group';
import { getUserInfo } from '../../util/common';
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 - 50
}).exec()
uni.createSelectorQuery().in(instance.proxy).select("#fixedHeadId").boundingClientRect((data : any) => {
height.value = height.value - 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 user = ref()
const size = 10
const params = ref({
page: 1,
size: size,
userId: '',
customerId: '',
})
const handleChat = (item) => {
uni.navigateTo({
url: '/pages/message/chat?groupId=' + item.groupId
})
}
const loadData = () => {
groupAPI.getList(params.value).then((res) => {
messageList.value = res.data.list
})
}
onPullDownRefresh(async () => {
await loadData()
uni.stopPullDownRefresh()
})
onUniReady(() => {
loadHeight()
user.value = getUserInfo()
params.value.userId = user.value.id
loadData()
})
</script>
<style lang="scss" scoped>
.message-container {
width: 100%;
position: fixed;
top: 0;
left: 0;
height: 100%;
overflow: hidden;
/* 内容滚动区域 */
.content-container {
background: linear-gradient(180deg, #2F75F9 0%, #F0F3FF 34.13%);
width: 100%;
height: 100%;
.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>