消息最多能发送1000个文字

发起会诊传参
main
ysn 3 days ago
parent e4acdd4299
commit 6cf5b20cc9
  1. 40
      src/views/message/components/MessageEditor.vue

@ -90,14 +90,14 @@
<el-button
type="text"
icon="el-icon-video-camera"
@click="handleTeachingClick(1)"
@click="handleTeachingClick(9)"
title="发起教学"
v-if="currentChat.scene == ContactsScene.GROUP"
/>
<el-button
type="text"
icon="el-icon-video-camera-solid"
@click="handleTeachingClick(9)"
@click="handleTeachingClick(1)"
title="发起会诊"
v-if="currentChat.scene == ContactsScene.PRIVATE"
/>
@ -180,6 +180,8 @@ export default {
//
editorFiles: [],
maxQuillInitRetries: 20,
//
wordLimitWarning: false,
};
},
@ -418,6 +420,10 @@ export default {
// @
handleTextChange(delta) {
try {
//
this.checkWordLimit();
// @
if (
!this.currentChat ||
this.currentChat.scene !== ContactsScene.GROUP
@ -441,6 +447,27 @@ export default {
}
},
//
checkWordLimit() {
if (!this.quill) return;
const text = this.quill.getText().trim();
const maxLength = 1000;
const currentLength = text.length;
if (currentLength > maxLength) {
//
this.quill.deleteText(maxLength, currentLength - maxLength);
//
if (!this.wordLimitWarning) {
this.wordLimitWarning = true;
this.$message.warning(`消息字数不能超过${maxLength}`);
setTimeout(() => {
this.wordLimitWarning = false;
}, 2000);
}
}
},
// @
showAtDropdown() {
try {
@ -542,13 +569,13 @@ export default {
const targetMode = this.meetingModes.find(
(item) => item.type === meetingType
);
console.log(targetMode);
//
this.$router.push({
name: targetMode.routeName,
query: {
name: this.userInfo.group,
roomId_id: this.generateRoomId(targetMode.type, this.userInfo.id),
init_users: [this.currentChat.source_id],
},
});
},
@ -586,6 +613,13 @@ export default {
return;
}
//
const maxLength = 1000;
if (textContent.length > maxLength) {
this.$message.warning(`消息字数不能超过${maxLength}`);
return;
}
this.sending = true;
try {

Loading…
Cancel
Save