Contacts.vue
2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
<div class="g-inherit m-main p-contacts" :style="{paddingBottom:model}">
<div class="sysMsgItem" v-for = "(item,index) in sessionlist">
<div class="sysMsg-title">{{item.data.title}}</div>
<div class="sysMsg-content">{{item.data.summary}}</div>
<div class="sysMsg-time">{{item.time}}</div>
</div>
</div>
</template>
<script>
import { dateFormat } from 'vux'
export default {
data(){
return{
model:navigator.userAgent.toLowerCase().indexOf('android') != -1 ? 0:'2.6rem'
}
},
computed: {
sessionlist:function(){
let sessionlist = this.$store.state.sessionlist;
let msgList = this.$store.state.msgs;
let sysMsgList = [];
for(let i=0;i<sessionlist.length;i++){
if(sessionlist[i].scene == 'p2p' && sessionlist[i].lastMsg && sessionlist[i].lastMsg.type == 'custom'){
let content = JSON.parse(sessionlist[i].lastMsg.content);
if(content.type == 10){
if(msgList[sessionlist[i].id]){
for(let j=0;j<msgList[sessionlist[i].id].length;j++){
sysMsgList.push(JSON.parse(msgList[sessionlist[i].id][j].content))
}
}
}
}
}
for(let i=0;i<sysMsgList.length;i++){
sysMsgList[i].time = dateFormat(sysMsgList[i].data.time,'YYYY-MM-DD HH:mm');
}
return sysMsgList;
}
},
}
</script>
<style lang="less" scoped>
.p-contacts{
background-color:#f3f3f3;
.sysMsgItem{
height:auto;
background-color:#fff;
margin-bottom:6px;
font-size:14px;
padding:0 5px;
.sysMsg-title{
line-height:40px;
border-bottom:1px solid #efefef;
color:#333;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
.sysMsg-content{
max-height:60px;
overflow:hidden;
line-height:30px;
color:#999;
white-space:inherit;
-webkit-line-clamp:2;
display:-webkit-box;
-webkit-box-orient:vertical;
border-bottom:1px solid #efefef;
}
.sysMsg-time{
height:30px;
line-height:30px;
color:#999;
text-align:right;
}
}
}
</style>