diff --git a/im-uniapp/common/emotion.js b/im-uniapp/common/emotion.js index a4d9140..8c7674e 100644 --- a/im-uniapp/common/emotion.js +++ b/im-uniapp/common/emotion.js @@ -13,23 +13,30 @@ let containEmoji = (content) => { } let transform = (content, extClass) => { - return content.replace(regex, (emoText)=>{ + return content.replace(regex, (emoText) => { // 将匹配结果替换表情图片 let word = emoText.replace(/\#|\;/gi, ''); let idx = emoTextList.indexOf(word); if (idx == -1) { return emoText; } - let path = textToPath(emoText); + let path = textToPath(emoText, true); let img = ``; return img; }); } -let textToPath = (emoText) => { +let textToPath = (emoText, isRichText) => { let word = emoText.replace(/\#|\;/gi, ''); let idx = emoTextList.indexOf(word); - return `/static/emoji/${idx}.gif`; + let path = `/static/emoji/${idx}.gif`; + // #ifdef MP-WEIXIN + // 小程序的表情要去掉最前面"/"(但有的时候又不能去掉,十分奇怪) + if (isRichText) { + path = path.slice(1); + } + // #endif + return path; } export default { diff --git a/im-uniapp/manifest.json b/im-uniapp/manifest.json index cfbc8be..04d0f26 100644 --- a/im-uniapp/manifest.json +++ b/im-uniapp/manifest.json @@ -106,9 +106,11 @@ "appid" : "wxda94f40bfad0262c", "libVersion" : "latest", "setting" : { - "urlCheck" : false + "urlCheck" : false, + "minified" : true }, - "usingComponents" : true + "usingComponents" : true, + "lazyCodeLoading" : "requiredComponents" }, "mp-alipay" : { "usingComponents" : true diff --git a/im-uniapp/pages/chat/chat-box.vue b/im-uniapp/pages/chat/chat-box.vue index d00d07c..a9eb4a8 100644 --- a/im-uniapp/pages/chat/chat-box.vue +++ b/im-uniapp/pages/chat/chat-box.vue @@ -32,7 +32,8 @@ + :read-only="isReadOnly" @focus="onEditorFocus" @blur="onEditorBlur" @ready="onEditorReady" + @input="onTextInput"> @@ -93,7 +94,7 @@ - @@ -369,7 +370,7 @@ export default { } }, selectEmoji(emoText) { - let path = this.$emo.textToPath(emoText) + let path = this.$emo.textToPath(emoText, true) // 先把键盘禁用了,否则会重新弹出键盘 this.isReadOnly = true; this.isEmpty = false; @@ -588,7 +589,7 @@ export default { this.isEmpty = e.detail.html == '


' }, onEditorReady() { - this.$nextTick(()=>{ + this.$nextTick(() => { const query = uni.createSelectorQuery().in(this); query.select('#editor').context((res) => { this.editorCtx = res.context @@ -741,7 +742,7 @@ export default { }, listenKeyBoard() { // #ifdef H5 - if (navigator.platform == "Win32" || navigator.platform == "MacIntel" ) { + if (navigator.platform == "Win32" || navigator.platform == "MacIntel") { // 电脑端不需要弹出键盘 console.log("navigator.platform:", navigator.platform) return; @@ -751,7 +752,7 @@ export default { window.addEventListener('focusin', this.focusInListener); window.addEventListener('focusout', this.focusOutListener); // 监听键盘高度,ios13以上开始支持 - if(window.visualViewport){ + if (window.visualViewport) { window.visualViewport.addEventListener('resize', this.resizeListener); } } else { diff --git a/im-uniapp/static/logo/logo.png b/im-uniapp/static/logo/logo.png deleted file mode 100644 index 7078e93..0000000 Binary files a/im-uniapp/static/logo/logo.png and /dev/null differ