Files

243 lines
5.5 KiB
Vue
Executable File

<template>
<view class="page">
<view class="msg" v-for="(item,index) in list" :key='index'>
<view class="my-body">
<view>
<image v-if="item.FINFOSTATUS==2" class="dot" src="../../../static/home/dot.png"/>
<text class="dot-text">{{item.FNAME}}</text>
</view>
</view>
<view v-if='!item.show' class="detail detail-ellipsis">{{item.FCONTENT}}</view>
<view v-if='item.show' class="detail">{{item.FCONTENT}}</view>
<view class="time">日期:&nbsp&nbsp{{item.C_YMD}}</view>
<view style="border-style:solid;border-width:1px 0px 0px 0px;border-color:rgba(240, 240, 240, 1);"/>
<view v-if='item.show' class="look-Class" @click="showDetail(item)">收起</view>
<view v-if='!item.show' :class="['look-Class',item.FINFOSTATUS==2?'look-unRead-Class':'']" @click="showDetail(item)">
查看详情
</view>
</view>
<view style="height: 20px;"></view>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
import errorUtil from '@/common/errorutil.js';
export default {
data() {
return {
orgid:'',
list:[],
pageIndex:1,
pageSize:20,
showTips:false,
}
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
onLoad() {
this.getInfo(1, this.pageSize);
this.pageIndex = 1;
},
onShow() {
this.list = uni.getStorageSync('infoList')
},
onPullDownRefresh:function(){
this.showTips = false;
this.getInfo(1, this.pageSize);
setTimeout(()=>{
//停止下拉样式
uni.stopPullDownRefresh();
//隐藏标题读取
uni.hideNavigationBarLoading();
},
500);
},
onReachBottom:function(){
if(!this.showTips) {
this.getInfo(this.pageIndex, this.pageSize);
}
else {
uni.showToast({
icon: 'none',
title: '已经到底了'
});
}
},
methods: {
getInfo(index,size) {
let _self = this;
let loginId = uni.getStorageSync('userName')
this.pageIndex = index;
this.$request.get('/PersonalMessage/GetAllPersonalMessage',{
params:{
userId:loginId,
pageNum:this.pageIndex,
pageCount:size
}
}).then(res => {
console.log('res', res.Data);
let datalist = res.Data;
if(this.pageIndex == 1) {
this.list = datalist;
this.pageIndex = this.pageIndex+1;
} else {
if(datalist.length != 0) {
let newArray = this.list.concat(datalist);
this.list = newArray;
this.pageIndex = this.pageIndex+1;
if(datalist.length < 6) {
_self.showTips = true;
}
} else {
_self.showTips = true;
}
}
datalist.forEach(function(item) {
item.show = false;
});
}).catch(err => {
errorUtil.handle(err);
});
},
showDetail(item) {
item.show = !item.show;
if (item.FINFOSTATUS == 2) {
let requestParams = { MessageNoList:[], Type:3 };
requestParams.MessageNoList.push(item.FNUMBER);
this.$request.post('/PersonalMessage/UpdatePersonalMessage',requestParams);
}
item.FINFOSTATUS = 3;
this.$forceUpdate();
}
}
}
</script>
<style>
.page {
background-color: #F2F2F2;
display: flex;
flex-direction: column;
}
view{
display: flex;
}
.msg{
display: flex;
flex-direction: column;
margin-left: 43.47rpx;
margin-right: 43.47rpx;
margin-top: 43.47rpx;
background: #FFFFFF;
border-radius: 9.05rpx;
padding: 36rpx 36rpx 20rpx 36rpx;
}
.my-body{
display: flex;
flex-direction: row;
align-items: center;
justify-content: start;
height: 39.85rpx;
line-height: 39.85rpx;
/* margin-bottom: 14.49rpx; */
background: #FFFFFF;
border-radius: 9.05rpx;
font-size: 16px;
}
.dot{
height: 10.86rpx;
width: 10.86rpx;
margin-right: 10rpx;
background: #E24848;
border-radius: 50%;
margin-right: 16rpx;
}
.dot-text {
flex-grow: 0;
flex-shrink: 0;
max-width: 70%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
font-size: 16px;
font-weight: 400;
color: rgba(26, 26, 26, 1)
}
.end{
height: 32.6rpx;
width: 32.6rpx;
}
.my-body view{
width: 100%;
display: flex;
align-items: center;
font-size: 16px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #4688FD;
}
.detail{
margin-top: 14.49rpx;
font-size: 14px;
font-weight: 400;
color: rgba(88, 88, 88, 1);
}
.detail-ellipsis {
height: 50px;
text-overflow:ellipsis;
overflow:hidden;
display: -webkit-box;
/* 弹性盒子元素垂直排列 */
-webkit-box-orient: vertical;
/* 控制要显示的行数 */
-webkit-line-clamp: 2;
}
.sender{
margin-top: 14.49rpx;
width: 100%;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #585858;
}
.time{
width: 100%;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(131, 131, 131, 1);
margin-top: 14rpx;
margin-bottom: 14rpx;
}
.list-title{
font-weight: bold;
font-size: 16px;
/* 文字不换行 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; //文本不换行,这样超出一行的部分被截取,显示...
}
.look-Class {
width:100%;
margin-top:20rpx;
display: flex;
align-items: center;
justify-content: center;
color: rgba(131, 131, 131, 1);
font-size: 14px;
}
.look-unRead-Class {
color: rgba(70, 136, 253, 1);
}
</style>