RoomChatActor.vue
2.55 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
<div class="p-room-chat-actor">
<div class="actor-info">
<span class="actor-avatar">
<img :src="chatroomActor.avatar">
</span>
<span class="actor-status">
<h3>主播: {{chatroomActor.nick || chatroomActor.account}} </h3>
<p>
<span>
在线:{{chatroomInfo.onlineMemberNum}}
</span>
<!-- <em>创建时间:{{chatroomInfo.showTime}}</em> -->
</p>
</span>
</div>
<div class="actor-notice">
<h3>公告:</h3>
<p>
{{chatroomNotice}}
</p>
</div>
</div>
</template>
<script>
import util from '../utils'
import config from '../configs'
export default {
mounted () {
this.$store.dispatch('getChatroomInfo')
},
computed: {
chatroomInfo () {
let chatroomInfo = this.$store.state.currChatroomInfo
chatroomInfo.showTime = util.formatDate(chatroomInfo.createTime)
return chatroomInfo
},
chatroomNotice () {
return this.chatroomInfo.announcement || '暂无公告'
},
chatroomActor () {
if (this.chatroomInfo) {
let actor = this.chatroomInfo.actor || {}
actor.avatar = actor.avatar || config.defaultUserIcon
return actor
}
return {}
}
}
}
</script>
<style type="text/css">
.p-room-chat-actor {
position: relative;
width: 100%;
height: 100%;
h3 {
text-align: left;
}
.actor-info {
position: relative;
width: 100%;
height: 4rem;
padding: 0.5rem;
box-sizing: border-box;
}
.actor-avatar {
position: relative;
display: inline-block;
height: 3rem;
width: 3rem;
border-radius: 3rem;
overflow: hidden;
img {
width: inherit;
height: inherit;
}
}
.actor-status {
position: relative;
display: inline-block;
margin-left: 0.5rem;
height: 3rem;
width: auto;
vertical-align: top;
h3 {
line-height: 1.8rem;
font-size: 1.0rem;
}
p {
position: relative;
top: 0.2rem;
line-height: 1.0rem;
font-size: 0.9rem;
color: #999;
}
em {
margin-left: 2rem;
}
}
.actor-notice {
position: absolute;
box-sizing: border-box;
padding: 5rem 1rem 1rem 1rem;
top: 0;
left: 0;
width: 100%;
height: 100%;
line-height: 1.4;
h3 {
border-bottom: 1px solid #e9e9e9;
}
p {
margin-top: 0.6rem;
color: #666;
}
}
}
</style>