perf: 转发消息至群聊时支持@留言

This commit is contained in:
kuaifan 2024-04-23 11:02:17 +08:00
parent 053daa621b
commit a6708a26a6
5 changed files with 66 additions and 10 deletions

View File

@ -410,7 +410,10 @@ class WebSocketDialogMsg extends AbstractModel
$already[] = $dialogid;
}
if ($leaveMessage) {
self::sendMsg(null, $dialogid, 'text', ['text' => $leaveMessage], $user->userid);
$res = self::sendMsg(null, $dialogid, 'text', ['text' => $leaveMessage], $user->userid);
if (Base::isSuccess($res)) {
$msgs[] = $res['data'];
}
}
}
}
@ -429,7 +432,10 @@ class WebSocketDialogMsg extends AbstractModel
$msgs[] = $res['data'];
}
if ($leaveMessage) {
self::sendMsg(null, $dialog->id, 'text', ['text' => $leaveMessage], $user->userid);
$res = self::sendMsg(null, $dialog->id, 'text', ['text' => $leaveMessage], $user->userid);
if (Base::isSuccess($res)) {
$msgs[] = $res['data'];
}
}
}
}

View File

@ -266,6 +266,10 @@ export default {
type: Boolean,
default: true
},
simpleMode: {
type: Boolean,
default: false
},
options: {
type: Object,
default: () => ({})
@ -420,6 +424,9 @@ export default {
array.push('record-ready');
}
}
if (this.simpleMode) {
array.push('simple-mode');
}
if (this.showMenu) {
array.push('show-menu');
}
@ -496,7 +503,9 @@ export default {
this.quill.setText('')
}
}
this.$store.dispatch("saveDialogDraft", {id: this.dialogId, extra_draft_content: this.filterInvalidLine(val)})
if (!this.simpleMode) {
this.$store.dispatch("saveDialogDraft", {id: this.dialogId, extra_draft_content: this.filterInvalidLine(val)})
}
},
// Watch disabled change
@ -642,7 +651,7 @@ export default {
placeholder: this.placeholder,
modules: {
toolbar: this.$isEEUiApp || this.windowTouch ? false : this.toolbar,
keyboard: {
keyboard: this.simpleMode ? {} : {
bindings: {
'short enter': {
key: "Enter",
@ -965,13 +974,13 @@ export default {
loadInputDraft() {
const {extra_draft_content} = this.dialogData;
if (extra_draft_content) {
this.pasteClean = false
this.$emit('input', extra_draft_content)
this.$nextTick(_ => this.pasteClean = true)
} else {
if (this.simpleMode || !extra_draft_content) {
this.$emit('input', '')
return
}
this.pasteClean = false
this.$emit('input', extra_draft_content)
this.$nextTick(_ => this.pasteClean = true)
},
onClickEditor() {

View File

@ -483,7 +483,23 @@
</Scrollbar>
</div>
<div class="leave-message">
<Input type="textarea" :autosize="{minRows: 1,maxRows: 3}" v-model="forwardMessage" :placeholder="$L('留言')" clearable />
<ChatInput
v-if="forwardDialogId > 0"
v-model="forwardMessage"
:dialog-id="forwardDialogId"
:emoji-bottom="windowPortrait"
:maxlength="200000"
:placeholder="$L('留言')"
disabled-record
simple-mode/>
<Input
v-else
type="textarea"
:autosize="{minRows: 1,maxRows: 3}"
v-model="forwardMessage"
:maxlength="200000"
:placeholder="$L('留言')"
clearable/>
</div>
</div>
</div>
@ -731,6 +747,7 @@ export default {
forwardhow: false,
forwardData: [],
forwardLoad: 0,
forwardDialogId: 0,
forwardMessage: '',
forwardSource: true,
@ -2598,6 +2615,13 @@ export default {
if (this.forwardData.length === 0) {
$A.messageError("请选择转发对话或成员");
} else {
this.forwardDialogId = 0;
if (this.forwardData.length === 1) {
const {type, userid} = this.forwardData[0];
if (type === "group" && /^d:/.test(userid)) {
this.forwardDialogId = parseInt(userid.replace(/^d:/, ''));
}
}
this.forwardMessage = '';
this.forwardSource = true;
this.forwardhow = true;

View File

@ -43,6 +43,20 @@
}
}
&.simple-mode {
.chat-input-wrapper {
border: 1px solid #e8e8e8;
border-radius: 4px;
.ql-container {
width: 100%;
}
.chat-space,
.chat-toolbar {
display: none;
}
}
}
&.show-menu,
&.show-more,
&.show-emoji {

View File

@ -1897,6 +1897,7 @@ body:not(.window-touch) {
.dialog-wrapper-forward-body {
.dialog-wrapper {
position: relative;
z-index: 1;
&.inde-list {
border-radius: 0;
@ -1941,6 +1942,8 @@ body:not(.window-touch) {
}
.leave-message {
position: relative;
z-index: 2;
padding-bottom: 16px;
textarea {