|
@@ -131,7 +131,7 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="emoji-wrap" v-show="showEmoji">
|
|
|
- <emoji-list @addEmoji="addEmoji" :isMini="true" :emojiShow="showEmoji"></emoji-list>
|
|
|
+ <emoji @addEmoji="addEmoji" :isMini="true" :emojiShow="showEmoji"></emoji>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -157,7 +157,7 @@
|
|
|
|
|
|
<script>
|
|
|
import msgItem from '@/components/msgItem'
|
|
|
-import emojiList from '@/components/emoji'
|
|
|
+import emoji from '@/components/emoji'
|
|
|
import chatAt from '@/components/chatAt'
|
|
|
import atMe from '@/components/chatAt/atme'
|
|
|
import chatPin from '@/components/chatPin'
|
|
@@ -170,13 +170,14 @@ import ScatterJS from 'scatter-js/dist/scatter.esm'
|
|
|
import { Message } from 'element-ui'
|
|
|
import ImageMin from '@/util/imageMin.js'
|
|
|
import { chatAtMixin, chatInputMixin } from '@/mixins'
|
|
|
+import { emojiList } from '@/util/emoji'
|
|
|
|
|
|
export default {
|
|
|
name: 'chatMini',
|
|
|
mixins: [chatAtMixin, chatInputMixin],
|
|
|
components: {
|
|
|
msgItem,
|
|
|
- emojiList,
|
|
|
+ emoji,
|
|
|
chatAt,
|
|
|
chatPin,
|
|
|
atMe
|
|
@@ -210,7 +211,19 @@ export default {
|
|
|
pinList: state => state.group.pinList,
|
|
|
atList: state => state.group.atList,
|
|
|
unreadNums: state => state.group.unreadNums
|
|
|
- })
|
|
|
+ }),
|
|
|
+ emojiMap () {
|
|
|
+ var emojiMap = {}
|
|
|
+ for (let i in emojiList) {
|
|
|
+ let arr = emojiList[i]
|
|
|
+ arr.forEach(v => {
|
|
|
+ let names = JSON.stringify(v.names)
|
|
|
+ let emoji = v.surrogates
|
|
|
+ emojiMap[names] = emoji
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return emojiMap
|
|
|
+ }
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
@@ -653,8 +666,16 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- let text = this.inputMsg.trim()
|
|
|
+ // 替换emoji字符串
|
|
|
+ let _inputMsg = this.inputMsg
|
|
|
+ let parts = _inputMsg.match(/\["[a-z_]+"\]/g)
|
|
|
+ for (let k in parts) {
|
|
|
+ let emoji = this.emojiMap[parts[k]]
|
|
|
+ if (emoji) {
|
|
|
+ _inputMsg = _inputMsg.replace(parts[k], emoji)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let text = _inputMsg.trim()
|
|
|
|
|
|
if (text.length === 0) {
|
|
|
Message({
|