audio-element.vue
2.63 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
<template>
<message-bubble :isMine="isMine" :message="message">
<div class="m-e-content" @click="goAudioDetail">
<img :src="coverUrl" class="covor" />
<span class="title" v-if="name">{{ name }}</span>
<span class="title" v-else>未命名音乐文件</span>
<!-- <div style="position: absolute; right: 15px">
<u-icon name="list" color="#fff" size="32"></u-icon>
</div> -->
</div>
</message-bubble>
<!-- <div class="chat-bubble">
<div class="message-content" :class="isMine ? 'message-send' : 'message-received'">
<template v-for="(item, index) in contentList">
<span :key="index" v-if="item.name === 'text'">{{ item.text }}</span>
<img v-else-if="item.name === 'img'" :src="item.src" width="20px" height="20px" :key="index"/>
</template>
</div>
</div> -->
</template>
<script>
import MessageBubble from "../message-bubble";
export default {
name: "AudioElement",
components: {
MessageBubble,
},
props: {
payload: {
type: Object,
required: true,
},
message: {
type: Object,
required: true,
},
isMine: {
type: Boolean,
},
},
methods: {
goAudioDetail() {
console.log("in goAudioDetail");
// this.$emit("goAudioDetail");
},
// previewImage() {
// uni.previewImage({
// current: 0,
// urls: [this.imagePath]
// });
// },
},
computed: {
audioUrl() {
return this.payload.description;
},
coverUrl() {
try {
let res = JSON.parse(this.payload.extension);
return res.cover_url;
} catch (e) {}
return "";
},
name() {
try {
let res = JSON.parse(this.payload.extension);
return res.name;
} catch (e) {}
return "";
},
},
mounted() {
console.log("this.message is ", this.message);
},
};
</script>
<style lang="stylus" scoped>
.covor{
width: 80px;
height: 80px;
// border-top-left-radius: 10px;
// border-bottom-left-radius: 10px;
border-radius:6px;
}
.m-e-content{
display: flex;
flex-direction: row;
align-items: center;
width:250px;
height: 80px
// background-color: #2D2F39;
position: relative;
}
.title{
width: 150px;
// color: #E9E9EA;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
/* #ifndef APP-PLUS-NVUE */
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/* #endif */
/* #ifdef APP-PLUS-NVUE */
lines: 2;
text-overflow:ellipsis;
/* #endif */
margin-left: 15px
}
</style>