Files
jurong_circle_front_app/pages/message/message.vue

333 lines
7.5 KiB
Vue
Raw Normal View History

2025-09-12 17:23:03 +08:00
<template>
2025-09-16 16:05:34 +08:00
<view class="message-container">
<!-- 可滚动的内容区域 -->
2025-09-28 09:21:15 +08:00
<view class="content-container">
<view>
<view id="fixedHeadId" style="padding: 32rpx 32rpx 0;">
<view class="head-box1">
<view class="title">
容讯聊天室
</view>
<view class="icon">
<image class="icon-img" src="/static/icon/search.png" mode=""></image>
<image class="icon-img2" src="/static/icon/Bookmark.png" mode=""></image>
</view>
2025-09-16 16:05:34 +08:00
</view>
<view class="head-box2">
<view class="item">
<view class="box-img">
<image class="img" src="/static/message/system.png" mode=""></image>
</view>
<view class="title">
系统消息
</view>
</view>
<view class="item">
<view class="box-img">
<image class="img" src="/static/message/customer.png" mode=""></image>
</view>
<view class="title">
客户消息
</view>
</view>
<view class="item">
<view class="box-img">
<image class="img" src="/static/message/order.png" mode=""></image>
</view>
<view class="title">
订单通知
</view>
</view>
<view class="item">
<view class="box-img">
<image class="img" src="/static/message/process.png" mode=""></image>
2025-09-28 09:21:15 +08:00
</view>
<view class="title">
项目进度
</view>
</view>
</view>
2025-09-28 09:21:15 +08:00
<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>
2025-09-16 16:05:34 +08:00
</view>
</view>
2025-09-28 09:21:15 +08:00
<scroll-view scroll-y="true" class="message-list" :style="'height:'+height+'px'">
<view class="message-item" v-for="item in messageList">
<u-swipe-action bgColor="#F8FBFF" :index="item.groupId" class="other-program" @content-click="handleChat(item)" v-if="item.program.linkmanId !== params.userId"
:options="options">
<view class="item-name title-wrap">
{{ item.program.name}}
</view>
<view class="item-company">
{{'负责公司:' + item.program.company }}
</view>
<!-- <view class="item-date">
{{ item.program.startDate + "至" + item.program.endDate }}
</view> -->
<view class="item-unread" v-if="item.userUnread.length!=0">
未读 {{item.userUnread.length}}
</view>
</u-swipe-action>
<u-swipe-action bgColor="#F8FBFF" class="my-program" @content-click="handleChat(item)" v-else :options="options">
<view class="item-name title-wrap">
{{ item.program.name}}
</view>
<view class="item-company">
{{'咨询人:' + maskPhoneNumber(item.user.username) }}
</view>
<view class="item-unread" v-if="item.chargeUnread.length!=0">
未读 {{item.chargeUnread.length}}
</view>
</u-swipe-action>
2025-09-28 09:21:15 +08:00
</view>
</scroll-view>
2025-09-16 16:05:34 +08:00
</view>
</view>
2025-09-12 17:23:03 +08:00
2025-09-16 16:05:34 +08:00
<Tabbar id="tabbarId"></Tabbar>
</view>
</template>
2025-09-12 17:23:03 +08:00
<script setup lang="ts">
2025-09-16 16:05:34 +08:00
import { ref, computed, getCurrentInstance } from 'vue';
import {
2025-09-18 09:52:30 +08:00
onReady, onPullDownRefresh
2025-09-16 16:05:34 +08:00
} from '@dcloudio/uni-app';
import { onReady as onUniReady } from '@dcloudio/uni-app';
2025-09-28 09:21:15 +08:00
import { groupAPI } from '../../api/group';
import { getUserInfo, maskPhoneNumber } from '../../util/common';
2025-09-16 16:05:34 +08:00
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) => {
2025-09-28 09:21:15 +08:00
height.value = screenHeight - data.height - 50
}).exec()
uni.createSelectorQuery().in(instance.proxy).select("#fixedHeadId").boundingClientRect((data : any) => {
height.value = height.value - data.height
2025-09-16 16:05:34 +08:00
}).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
}
2025-09-12 17:23:03 +08:00
// 消息
const messageList = ref([])
2025-09-28 17:30:20 +08:00
const user = ref()
const size = 10
const params = ref({
page: 1,
size: size,
userId: '',
customerId: '',
})
const options = [
{
text: '收藏',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
]
2025-09-28 09:21:15 +08:00
const handleChat = (item) => {
uni.navigateTo({
2025-09-28 17:30:20 +08:00
url: '/pages/message/chat?groupId=' + item.groupId
2025-09-28 09:21:15 +08:00
})
}
const loadData = () => {
2025-09-28 17:30:20 +08:00
groupAPI.getList(params.value).then((res) => {
2025-09-28 09:21:15 +08:00
messageList.value = res.data.list
console.log(messageList.value);
2025-09-28 09:21:15 +08:00
})
}
onPullDownRefresh(async () => {
await loadData()
2025-09-18 09:52:30 +08:00
uni.stopPullDownRefresh()
})
2025-09-16 16:05:34 +08:00
onUniReady(() => {
loadHeight()
2025-09-28 17:30:20 +08:00
user.value = getUserInfo()
params.value.userId = user.value.id
2025-09-28 09:21:15 +08:00
loadData()
2025-09-16 16:05:34 +08:00
})
2025-09-12 17:23:03 +08:00
</script>
2025-09-16 16:05:34 +08:00
<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%);
background: linear-gradient(270deg, #659CFF 0%, #2D75FB 50%, #659CFF 100%);
2025-09-16 16:05:34 +08:00
width: 100%;
height: 100%;
.head-box1 {
padding-top: 60rpx;
display: flex;
justify-content: space-between;
align-items: center;
2025-09-16 16:05:34 +08:00
.title {
font-family: SF Pro;
font-weight: 700;
font-style: Bold;
font-size: 40rpx;
leading-trim: NONE;
line-height: 48rpx;
letter-spacing: 0%;
color: #FFFFFF;
}
2025-09-16 16:05:34 +08:00
.icon {
2025-09-16 16:05:34 +08:00
display: flex;
align-items: center;
.icon-img {
width: 34rpx;
height: 34rpx;
margin-right: 20rpx;
}
.icon-img2 {
2025-09-16 16:05:34 +08:00
width: 48rpx;
height: 48rpx;
}
}
}
.head-box2 {
display: flex;
justify-content: space-around;
margin-top: 20rpx;
2025-09-16 16:05:34 +08:00
.item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.box-img {
.img {
width: 68rpx;
height: 68rpx;
}
}
.title {
margin-top: 10rpx;
font-family: Work Sans;
font-weight: 400;
font-style: Regular;
font-size: 26rpx;
2025-09-16 16:05:34 +08:00
leading-trim: NONE;
line-height: 100%;
letter-spacing: -2%;
text-align: center;
color: #fff;
2025-09-16 16:05:34 +08:00
}
}
}
.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 {
2025-09-16 16:05:34 +08:00
margin-top: 10rpx;
2025-09-12 17:23:03 +08:00
.message-item {
2025-09-16 16:05:34 +08:00
// border: 1px solid #000;
.other-message {
padding: 20rpx 0rpx 20rpx 20rpx;
background-color: #F8FBFF;
;
}
.my-program {
padding: 20rpx 0rpx 20rpx 20rpx;
background-color: #F8FBFF;
border-bottom: 2rpx solid #f1f4ff;
}
2025-09-16 16:05:34 +08:00
}
}
}
}
</style>