|
|
|
@ -89,10 +89,14 @@ |
|
|
|
<el-tag size="mini" v-if="is_group ==2">BOT</el-tag> |
|
|
|
{{ contact.displayName }} |
|
|
|
</span> |
|
|
|
<span class="displayName" v-if="is_group == 0"> |
|
|
|
<OnlineStatus :type="contact.is_online ? 'success' : 'info'" :pulse="contact.is_online " v-if="globalConfig.chatInfo.online==1" ></OnlineStatus> {{contact.displayName}}</span> |
|
|
|
<span class="displayName" style="white-space: pre-wrap;line-break: anywhere;" v-if="is_group == 0"> |
|
|
|
<OnlineStatus :type="contact.is_online ? 'success' : 'info'" :pulse="contact.is_online " v-if="globalConfig.chatInfo.online==1" ></OnlineStatus> |
|
|
|
{{contact.displayName}} |
|
|
|
</span> |
|
|
|
<span v-if="parseInt(globalConfig.sysInfo.ipregion) && contact.last_login_ip" class="c-999 f-12 ml-5"> |
|
|
|
<span v-if="globalConfig.chatInfo.online==0 && !contact.is_online">(离线)</span>{{ contact.last_login_ip }} {{ contact.location }}</span> |
|
|
|
<span v-if="globalConfig.chatInfo.online==0 && !contact.is_online">(离线)</span> |
|
|
|
{{ contact.last_login_ip }} {{ contact.location }} |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
|
|
|
|
<input |
|
|
|
@ -300,10 +304,10 @@ |
|
|
|
<!-- 每条消息后面展示的文字 --> |
|
|
|
<template #message-after="message"> |
|
|
|
<span |
|
|
|
v-if="message.fromUser.id == user.id && message.is_group == 0" |
|
|
|
v-if="message.fromUser.id == user.id && message.is_group == 0&&message.status!='failed'" |
|
|
|
style="visibility: visible" |
|
|
|
> |
|
|
|
<span v-if="!message.is_read && message.status=='succeed'"> 未读 </span> |
|
|
|
<span v-if="message.is_read==0 && message.status=='succeed'"> 未读 </span> |
|
|
|
<span v-if="message.is_read && message.status=='succeed'" class="fc-success"> 已读 </span> |
|
|
|
</span> |
|
|
|
</template> |
|
|
|
@ -678,6 +682,7 @@ export default { |
|
|
|
hide(); |
|
|
|
let friend=this.getContact(contact.user_id); |
|
|
|
let curContact=IMUI.getCurrentContact(); |
|
|
|
// console.log(curContact); |
|
|
|
// 如果是管理员,或者群聊开启了资料查看才能打开详情 |
|
|
|
if(curContact.setting.profile==1 || curContact.role<3 || friend || contact.user_id==this.user.id){ |
|
|
|
this.$user(contact.user_id); |
|
|
|
@ -805,7 +810,8 @@ export default { |
|
|
|
_this.$api.messageApi.isBlacklist({friend_user_id:contact.user_id}); |
|
|
|
setTimeout(()=>{ |
|
|
|
_this.getSimpleChat() |
|
|
|
},2000) |
|
|
|
location.reload(); |
|
|
|
},1000) |
|
|
|
}, |
|
|
|
icon: "el-icon-user", |
|
|
|
text: "加入黑名单", |
|
|
|
@ -815,6 +821,24 @@ export default { |
|
|
|
); |
|
|
|
} |
|
|
|
}, |
|
|
|
// { |
|
|
|
// click(e, instance, hide) { |
|
|
|
// const { IMUI, contact } = instance; |
|
|
|
// hide(); |
|
|
|
// _this.$api.messageApi.isBlacklist({friend_user_id:contact.user_id}); |
|
|
|
// setTimeout(()=>{ |
|
|
|
// _this.getSimpleChat() |
|
|
|
// location.reload(); |
|
|
|
// },1000) |
|
|
|
// }, |
|
|
|
// icon: "el-icon-user", |
|
|
|
// text: "移除黑名单", |
|
|
|
// visible: instance => { |
|
|
|
// return ( |
|
|
|
// instance.contact.is_group == 1 |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// }, |
|
|
|
{ |
|
|
|
click(e, instance, hide) { |
|
|
|
const { IMUI, contact } = instance; |
|
|
|
@ -1395,7 +1419,7 @@ export default { |
|
|
|
case "readAll": |
|
|
|
let messages = IMUI.getMessages(message.toContactId); |
|
|
|
messages.forEach(item => { |
|
|
|
if (item.is_read == 0) { |
|
|
|
if (item.is_read == 0&&item.status!='failed') { |
|
|
|
const data = { |
|
|
|
id: item.id, |
|
|
|
is_read: 1, |
|
|
|
@ -1632,7 +1656,7 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
Confirmdeletion(val){ |
|
|
|
console.log(val); |
|
|
|
// console.log(val); |
|
|
|
if(this.is_group==0){ |
|
|
|
this.$api.messageApi.setfriendRemoveAllMessage({to_user:val}).then(res => { |
|
|
|
if(res.code==0){ |
|
|
|
@ -2074,6 +2098,9 @@ export default { |
|
|
|
getContact(id,message=null) { |
|
|
|
const { IMUI } = this.$refs; |
|
|
|
let contact=IMUI.findContact(id); |
|
|
|
if(contact&&contact.user_id==-2){ |
|
|
|
contact.is_notice=0 |
|
|
|
} |
|
|
|
// 如果没有该联系人,需要新增,相当于临时会话 |
|
|
|
if(!contact && message && message.contactInfo){ |
|
|
|
contact = message.contactInfo; |
|
|
|
@ -2232,7 +2259,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
// 如果有未读的消息,需要将消息修改为已读 |
|
|
|
if (data.length > 0) { |
|
|
|
if (data.length > 0&&data.at.length==0) { |
|
|
|
this.$api.imApi.setMsgIsReadAPI({ |
|
|
|
is_group: contact.is_group, |
|
|
|
toContactId: contact.id, |
|
|
|
@ -2353,8 +2380,9 @@ export default { |
|
|
|
// 发送聊天消息 |
|
|
|
handleSend(message, next, file) { |
|
|
|
const { IMUI } = this.$refs; |
|
|
|
const hasEmoji = message.content.includes('emoji-image'); |
|
|
|
const contentText = /^\s*$/.test(message.content.replace(/<[^>]+>/g, "")); |
|
|
|
if(contentText&&message.type!=="file"||message.content==''&&message.type!=="file"){ |
|
|
|
if(contentText&&message.type!=="file"&&!hasEmoji||message.content==''&&message.type!=="file"&&!hasEmoji){ |
|
|
|
this.$message.error("内容不能为空"); |
|
|
|
IMUI.setEditorValue(""); |
|
|
|
IMUI.removeMessage(message.id); |
|
|
|
@ -2365,7 +2393,7 @@ export default { |
|
|
|
IMUI.setEditorValue(""); |
|
|
|
IMUI.removeMessage(message.id); |
|
|
|
return |
|
|
|
}else if(this.isAnswering == false){ |
|
|
|
}else if(this.isAnswering == false&&message.toContactId==-2){ |
|
|
|
this.isAnswering = true; |
|
|
|
}else if(this.isAnswering == true&&message.toContactId==-2){ |
|
|
|
this.$message.error("稍等片刻,等回复完后再发送哦~"); |
|
|
|
@ -2380,6 +2408,7 @@ export default { |
|
|
|
message.plain_text = result |
|
|
|
message.is_group = this.is_group; |
|
|
|
this.curFile=file; |
|
|
|
// console.log(this.curFile); |
|
|
|
// 如果开启了群聊禁言或者关闭了单聊权限,就不允许发送消息 |
|
|
|
if(!this.nospeak()){ |
|
|
|
IMUI.removeMessage(message.id); |
|
|
|
@ -2404,12 +2433,17 @@ export default { |
|
|
|
if(res.code==0){ |
|
|
|
IMUI.setEditorValue(""); |
|
|
|
IMUI.updateMessage(res.data); |
|
|
|
if(res.data.status=='failed'){ |
|
|
|
next({ status: "failed" }); |
|
|
|
}else{ |
|
|
|
next(); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
next({ status: "failed" }); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
this.curFile = null; |
|
|
|
next({ status: "failed" }); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
@ -2420,7 +2454,6 @@ export default { |
|
|
|
if(res.code==0){ |
|
|
|
IMUI.setEditorValue(""); |
|
|
|
IMUI.updateMessage(res.data); |
|
|
|
// console.log(res.data); |
|
|
|
if(res.data.toContactId==-2){ |
|
|
|
this.sendChat(res.data.plain_text,next) |
|
|
|
} |
|
|
|
@ -2450,7 +2483,11 @@ export default { |
|
|
|
if(res.code==0){ |
|
|
|
IMUI.setEditorValue(""); |
|
|
|
IMUI.updateMessage(res.data); |
|
|
|
if(res.data.status=="failed"){ |
|
|
|
next({ status: "failed" }); |
|
|
|
}else{ |
|
|
|
next(); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
next({ status: "failed" }); |
|
|
|
} |
|
|
|
@ -2465,6 +2502,7 @@ export default { |
|
|
|
sendChat(plain_text,next){ |
|
|
|
const { IMUI } = this.$refs; |
|
|
|
this.$api.messageApi.sendChat({content:plain_text}).then(res => { |
|
|
|
res.data.is_notice = 0; |
|
|
|
this.recieveMsg(res.data) |
|
|
|
// console.log(res.data); |
|
|
|
}) |
|
|
|
@ -2661,7 +2699,7 @@ export default { |
|
|
|
}, |
|
|
|
// 修改群组的名称 |
|
|
|
saveGroupName(contact) { |
|
|
|
if (this.displayName.length < 1) { |
|
|
|
if (this.displayName.length < 1||this.displayName.trim()=='') { |
|
|
|
this.$notify({ |
|
|
|
title: "警告", |
|
|
|
message: "名称不能为空!", |
|
|
|
@ -2759,6 +2797,7 @@ export default { |
|
|
|
}, |
|
|
|
// 接收消息重新渲染 |
|
|
|
recieveMsg(message) { |
|
|
|
// console.log(message); |
|
|
|
const { IMUI } = this.$refs; |
|
|
|
const contact = IMUI.getCurrentContact(); |
|
|
|
// 如果收到消息是当前窗口的聊天,需要将消息修改为已读 |
|
|
|
@ -2773,12 +2812,18 @@ export default { |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
// 如果不是自己的消息,需要将未读数加1 |
|
|
|
if (this.user.id != message.fromUser.id && contact.id != '-2') { |
|
|
|
if (this.user.id != message.fromUser.id) { |
|
|
|
let formContact=this.getContact(message.toContactId); |
|
|
|
// 有消息提醒才会增加未读数 |
|
|
|
if(formContact.is_notice==1){ |
|
|
|
this.unread++; |
|
|
|
} |
|
|
|
if(contact.id == 'system'&&contact.id == message.toContactId){ |
|
|
|
this.unread--; |
|
|
|
} |
|
|
|
// if(message.user_id==1){ |
|
|
|
// this.unread = 0; |
|
|
|
// } |
|
|
|
this.initMenus(IMUI); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2790,7 +2835,7 @@ export default { |
|
|
|
if(contact.id == '-2'){ |
|
|
|
message.content = md.render(message.content) |
|
|
|
} |
|
|
|
if(message.toContactId=='system'){ |
|
|
|
if(message.toContactId=='system'&&contact.id != 'system'){ |
|
|
|
IMUI.updateContact({ |
|
|
|
id: message.toContactId, |
|
|
|
lastContent: IMUI.lastContentRender(message), |
|
|
|
|