This commit is contained in:
lVAL 2020-10-28 18:04:48 +08:00
commit 0d673deab1

View File

@ -5,7 +5,7 @@
<div :class="chatContent.memberId == myMemberId?'rightUser':'leftUser'"> <div :class="chatContent.memberId == myMemberId?'rightUser':'leftUser'">
<div class="userHeader"> <div class="userHeader">
<div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div> <div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div>
<div :class="chatContent.memberId == myMemberId?'userChatTime textRight':'userChatTime'">{{ chatContent.time }}</div> <div :class="chatContent.memberId == myMemberId?'userChatTime textRight':'userChatTime'">{{ covertTime(chatContent.time) }}</div>
</div> </div>
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)"> <div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage"> <div class="userMessage">
@ -23,6 +23,7 @@
<script> <script>
import yuyin from '@/assets/yuyin.png'; import yuyin from '@/assets/yuyin.png';
import {overConversationMessage} from '@/api/chat'; import {overConversationMessage} from '@/api/chat';
// this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
export default { export default {
props:{ props:{
messageList:{ messageList:{
@ -153,6 +154,16 @@ export default {
} }
return name; return name;
}, },
covertTime(time) {
const date = new Date(time);
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
hour = hour > 9 ? hour : '0' + hour;
minute = minute > 9 ? minute : '0' + minute;
second = second > 9 ? second : '0' + second;
return hour + ':' + minute + ':' + second;
},
playAudio(audioUrl) { playAudio(audioUrl) {
if (!this.isPlay) { if (!this.isPlay) {
document.querySelector('#audioPlay').src = audioUrl; document.querySelector('#audioPlay').src = audioUrl;