diff --git a/resources/assets/js/pages/manage/components/ChatInput.vue b/resources/assets/js/pages/manage/components/ChatInput.vue index df026b6a1..e7a1c782d 100755 --- a/resources/assets/js/pages/manage/components/ChatInput.vue +++ b/resources/assets/js/pages/manage/components/ChatInput.vue @@ -2,8 +2,34 @@
+ + + + + + + + + + + + {{$L('图片')}} + + + + {{$L('文件')}} + + + + +
+ - + +
@@ -243,6 +269,39 @@ export default { this.$emit('on-send', this.quill) }, + onToolbar(action) { + switch (action) { + case 'user': + this.openMenu("@"); + break; + + case 'task': + this.openMenu("#"); + break; + + case 'image': + case 'file': + this.$emit('on-more', action) + break; + } + }, + + openMenu(char) { + if (!this.quill) { + return; + } + if (this.value.length === 0 || this.value.endsWith("


")) { + this.quill.getModule("mention").openMenu(char); + } else { + let str = this.value.replace(/<[^>]+>/g,""); + if (str.length === 0 || str.endsWith(" ")) { + this.quill.getModule("mention").openMenu(char); + } else { + this.quill.getModule("mention").openMenu(` ${char}`); + } + } + }, + getSource(mentionChar) { return new Promise(resolve => { switch (mentionChar) { diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index f7e839d35..d1a8b964f 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -90,7 +90,8 @@ v-model="msgText" :maxlength="20000" @on-focus="onEventFocus" - @on-blur="onEventblur" + @on-blur="onEventBlur" + @on-more="onEventMore" @on-send="sendMsg" :placeholder="$L('输入消息...')"/> @@ -476,11 +477,17 @@ export default { this.$emit("on-focus", e) }, - onEventblur(e) { + onEventBlur(e) { this.inputFocus = false; this.$emit("on-blur", e) }, + onEventMore(e) { + if (['image', 'file'].includes(e)) { + this.$refs.chatUpload.handleClick() + } + }, + onActive() { this.$emit("on-active"); }, diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index b0960744f..2d83cee29 100644 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -301,7 +301,7 @@