|
@@ -89,6 +89,7 @@
|
|
@keydown.enter="handleKeyDown"
|
|
@keydown.enter="handleKeyDown"
|
|
placeholder="Write a message"
|
|
placeholder="Write a message"
|
|
v-model="inputMsg"
|
|
v-model="inputMsg"
|
|
|
|
+ @focus="handleFocus"
|
|
@blur="handleBlur"
|
|
@blur="handleBlur"
|
|
:style="{height:inputHeight}"
|
|
:style="{height:inputHeight}"
|
|
/>
|
|
/>
|
|
@@ -166,11 +167,11 @@ import PostMessager from '@/util/postMessager.js'
|
|
import ScatterJS from 'scatter-js/dist/scatter.esm'
|
|
import ScatterJS from 'scatter-js/dist/scatter.esm'
|
|
import { Message } from 'element-ui'
|
|
import { Message } from 'element-ui'
|
|
import ImageMin from '@/util/imageMin.js'
|
|
import ImageMin from '@/util/imageMin.js'
|
|
-import { chatAtMixin } from '@/mixins'
|
|
|
|
|
|
+import { chatAtMixin, chatInputMixin } from '@/mixins'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'chatMini',
|
|
name: 'chatMini',
|
|
- mixins: [chatAtMixin],
|
|
|
|
|
|
+ mixins: [chatAtMixin, chatInputMixin],
|
|
components: {
|
|
components: {
|
|
msgItem,
|
|
msgItem,
|
|
emojiList,
|
|
emojiList,
|
|
@@ -207,22 +208,7 @@ export default {
|
|
pinList: state => state.group.pinList,
|
|
pinList: state => state.group.pinList,
|
|
atList: state => state.group.atList,
|
|
atList: state => state.group.atList,
|
|
unreadNums: state => state.group.unreadNums
|
|
unreadNums: state => state.group.unreadNums
|
|
- }),
|
|
|
|
- filterMembers () {
|
|
|
|
- let val = this.inputMsg.replace('@', '')
|
|
|
|
- let members = this.group.members
|
|
|
|
- let resArr = []
|
|
|
|
- for (let k in members) {
|
|
|
|
- if (k == this.userId) continue
|
|
|
|
- if (val.indexOf(members[k].nick_name) === -1) {
|
|
|
|
- resArr.push(members[k])
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return resArr
|
|
|
|
- },
|
|
|
|
- atShow () {
|
|
|
|
- return this.inputMsg.match(/@$/) && this.filterMembers.length
|
|
|
|
- }
|
|
|
|
|
|
+ })
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -742,9 +728,6 @@ export default {
|
|
e.preventDefault()
|
|
e.preventDefault()
|
|
return false
|
|
return false
|
|
},
|
|
},
|
|
- handleBlur () {
|
|
|
|
- this.updateChatInputFocus(false)
|
|
|
|
- },
|
|
|
|
placeEnd (el) {
|
|
placeEnd (el) {
|
|
var range = document.createRange()
|
|
var range = document.createRange()
|
|
range.selectNodeContents(el)
|
|
range.selectNodeContents(el)
|
|
@@ -877,24 +860,6 @@ export default {
|
|
}
|
|
}
|
|
return window.parent.postMessage(request, '*')
|
|
return window.parent.postMessage(request, '*')
|
|
},
|
|
},
|
|
- handleKeyDown (event) {
|
|
|
|
- if (this.atShow) {
|
|
|
|
- event.preventDefault()
|
|
|
|
- let item = this.filterMembers[this.atInd]
|
|
|
|
- this.atPerson(item.user_name)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (event.altKey || event.ctrlKey) {
|
|
|
|
- // 单纯换行
|
|
|
|
- this.inputMsg = this.inputMsg + '\n'
|
|
|
|
- } else {
|
|
|
|
- event.returnValue = false
|
|
|
|
- this.handleSend(event)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return false
|
|
|
|
- },
|
|
|
|
/**
|
|
/**
|
|
* @des 引用某条消息
|
|
* @des 引用某条消息
|
|
*/
|
|
*/
|