消息最多能发送1000个文字

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

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

Loading…
Cancel
Save