blue
3 years ago
committed by
Gitee
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with
16 additions and
10 deletions
-
im-ui/src/components/chat/ChatBox.vue
-
im-ui/src/components/chat/ChatPrivateVideo.vue
-
im-ui/src/components/chat/ChatTime.vue
|
|
|
@ -40,7 +40,7 @@ |
|
|
|
</div> |
|
|
|
<div title="聊天记录" class="el-icon-chat-dot-round" @click="showHistoryBox()"></div> |
|
|
|
</div> |
|
|
|
<textarea v-model="sendText" ref="sendBox" class="send-text-area" @keydown.enter="sendTextMessage()"></textarea> |
|
|
|
<textarea v-model="sendText" ref="sendBox" class="send-text-area" :disabled="lockMessage" @keydown.enter="sendTextMessage()"></textarea> |
|
|
|
<div class="im-chat-send"> |
|
|
|
<el-button type="primary" @click="sendTextMessage()">发送</el-button> |
|
|
|
</div> |
|
|
|
@ -94,7 +94,8 @@ |
|
|
|
x: 0, |
|
|
|
y: 0 |
|
|
|
}, |
|
|
|
showHistory: false // 是否显示历史聊天记录 |
|
|
|
showHistory: false, // 是否显示历史聊天记录 |
|
|
|
lockMessage: false // 是否锁定发送 |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -269,6 +270,7 @@ |
|
|
|
} |
|
|
|
// 填充对方id |
|
|
|
this.setTargetId(msgInfo, this.chat.targetId); |
|
|
|
this.lockMessage = true; |
|
|
|
this.$http({ |
|
|
|
url: this.messageAction, |
|
|
|
method: 'post', |
|
|
|
@ -281,11 +283,14 @@ |
|
|
|
msgInfo.sendId = this.$store.state.userStore.userInfo.id; |
|
|
|
msgInfo.selfSend = true; |
|
|
|
this.$store.commit("insertMessage", msgInfo); |
|
|
|
}).finally(() => { |
|
|
|
// 解除锁定 |
|
|
|
this.lockMessage = false; |
|
|
|
// 保持输入框焦点 |
|
|
|
this.$refs.sendBox.focus(); |
|
|
|
this.$nextTick(() => this.$refs.sendBox.focus()); |
|
|
|
// 滚动到底部 |
|
|
|
this.scrollToBottom(); |
|
|
|
}) |
|
|
|
}); |
|
|
|
const e = window.event || arguments[0]; |
|
|
|
if (e.key === 'Enter' || e.code === 'Enter' || e.keyCode === 13) { |
|
|
|
e.returnValue = false; |
|
|
|
|
|
|
|
@ -19,7 +19,6 @@ |
|
|
|
@click="cancel()"></div> |
|
|
|
<div v-show="state=='CONNECTED'" title="挂断" class="icon iconfont icon-phone-reject reject" style="color: red;" |
|
|
|
@click="handup()"></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
@ -17,16 +17,18 @@ |
|
|
|
formatDate(){ |
|
|
|
let time = new Date(this.time); |
|
|
|
let strtime = ""; |
|
|
|
let curTime = new Date(); |
|
|
|
let dayDiff =curTime.getDate() - time.getDate() ; |
|
|
|
if (time.getDate() === new Date().getDate()) { |
|
|
|
|
|
|
|
let todayTime = new Date(); |
|
|
|
todayTime.setHours(0,0,0,0) |
|
|
|
let dayDiff = Math.floor((todayTime.getTime() - time.getTime())/(24*3600*1000)) ; |
|
|
|
if (time.getTime() > todayTime.getTime()) { |
|
|
|
strtime = time.getHours() <= 9 ? "0" + time.getHours() : time.getHours(); |
|
|
|
strtime += ":" |
|
|
|
strtime += time.getMinutes() <= 9 ? "0" + time.getMinutes() : time.getMinutes(); |
|
|
|
} else if (dayDiff === 1) { |
|
|
|
} else if (dayDiff < 1 ) { |
|
|
|
strtime = "昨天"; |
|
|
|
} else if (dayDiff < 7) { |
|
|
|
strtime = `${dayDiff}天前`; |
|
|
|
strtime = `${dayDiff+1}天前`; |
|
|
|
} else { |
|
|
|
strtime = time.getMonth()+1+"月"+time.getDate()+"日"; |
|
|
|
} |
|
|
|
|