diff --git a/im-uniapp/common/emotion.js b/im-uniapp/common/emotion.js index 8937732..7e301e0 100644 --- a/im-uniapp/common/emotion.js +++ b/im-uniapp/common/emotion.js @@ -7,25 +7,21 @@ const emoTextList = ['憨笑', '媚眼', '开心', '坏笑', '可怜', '爱心', ]; - -let transform = (content) => { - return content.replace(/\#[\u4E00-\u9FA5]{1,3}\;/gi, textToImg); +let transform = (content, extClass) => { + return content.replace(/\#[\u4E00-\u9FA5]{1,3}\;/gi, (emoText)=>{ + // 将匹配结果替换表情图片 + let word = emoText.replace(/\#|\;/gi, ''); + let idx = emoTextList.indexOf(word); + if (idx == -1) { + return emoText; + } + let path = textToPath(emoText); + let img = ``; + return img; + }); } -// 将匹配结果替换表情图片 -let textToImg = (emoText) => { - let word = emoText.replace(/\#|\;/gi, ''); - let idx = emoTextList.indexOf(word); - if (idx == -1) { - return emoText; - } - let path = textToPath(emoText); - let img = ``; - return img; -} - let textToPath = (emoText) => { let word = emoText.replace(/\#|\;/gi, ''); @@ -38,6 +34,5 @@ let textToPath = (emoText) => { export default { emoTextList, transform, - textToImg, textToPath } \ No newline at end of file diff --git a/im-uniapp/components/chat-item/chat-item.vue b/im-uniapp/components/chat-item/chat-item.vue index 47131c8..ed985f6 100644 --- a/im-uniapp/components/chat-item/chat-item.vue +++ b/im-uniapp/components/chat-item/chat-item.vue @@ -16,7 +16,7 @@ {{ atText }} {{ chat.sendNickName + ': ' }} - + diff --git a/im-uniapp/components/chat-message-item/chat-message-item.vue b/im-uniapp/components/chat-message-item/chat-message-item.vue index 2f43b00..71ab643 100644 --- a/im-uniapp/components/chat-message-item/chat-message-item.vue +++ b/im-uniapp/components/chat-message-item/chat-message-item.vue @@ -17,7 +17,7 @@ - + diff --git a/im-uniapp/components/file-upload/file-upload.vue b/im-uniapp/components/file-upload/file-upload.vue index f204243..c364ffd 100644 --- a/im-uniapp/components/file-upload/file-upload.vue +++ b/im-uniapp/components/file-upload/file-upload.vue @@ -43,6 +43,12 @@ export default { } }, methods: { + show() { + this.$refs.lsjUpload.show(); + }, + hide() { + this.$refs.lsjUpload.hide(); + }, onUploadEnd(item) { let file = this.fileMap.get(item.path); if (item.type == 'fail') { diff --git a/im-uniapp/im.scss b/im-uniapp/im.scss index 53bd6c6..f6d4dd6 100644 --- a/im-uniapp/im.scss +++ b/im-uniapp/im.scss @@ -171,4 +171,22 @@ button[size='mini'] { uni-button + uni-button { margin-top: 20rpx; } +} + +.emoji-large { + width: 64rpx; + height: 64rpx; + vertical-align: bottom; +} + +.emoji-normal { + width: 54rpx; + height: 54rpx; + vertical-align: bottom; +} + +.emoji-small { + width: 36rpx; + height: 36rpx; + vertical-align: bottom; } \ No newline at end of file diff --git a/im-uniapp/manifest.json b/im-uniapp/manifest.json index a0ed444..36b75c1 100644 --- a/im-uniapp/manifest.json +++ b/im-uniapp/manifest.json @@ -22,6 +22,9 @@ "Record" : {}, "Bluetooth" : {} }, + "softinput" : { + "mode" : "adjustResize" + }, /* 应用发布信息 */ "distribute" : { /* android打包配置 */ diff --git a/im-uniapp/pages.json b/im-uniapp/pages.json index 6a499e6..a17086a 100644 --- a/im-uniapp/pages.json +++ b/im-uniapp/pages.json @@ -7,8 +7,7 @@ "^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue" } }, - "pages": [ - { + "pages": [{ "path": "pages/login/login" }, { @@ -30,7 +29,14 @@ "path": "pages/common/user-info" }, { - "path": "pages/chat/chat-box" + "path": "pages/chat/chat-box", + "style": { + "navigationStyle": "custom", + "app-plus": { + // adjustPan窗体高度不变,但窗体上推、adjustResize屏幕高度=webview窗体高度+软键盘高度 + "softinputMode": "adjustResize" + } + } }, { "path": "pages/chat/chat-private-video" @@ -71,8 +77,7 @@ "selectedColor": "#587ff0", "borderStyle": "black", "backgroundColor": "#ffffff", - "list": [ - { + "list": [{ "pagePath": "pages/chat/chat", "iconPath": "static/tarbar/chat.png", "selectedIconPath": "static/tarbar/chat_active.png", diff --git a/im-uniapp/pages/chat/chat-box.vue b/im-uniapp/pages/chat/chat-box.vue index add8199..0f2f015 100644 --- a/im-uniapp/pages/chat/chat-box.vue +++ b/im-uniapp/pages/chat/chat-box.vue @@ -1,49 +1,54 @@