提交 48018d16 编写于 作者: DCloud_JSON's avatar DCloud_JSON

2.0.10

上级 9add3e4a
## 2.0.10(2023-05-25)
- 修复 Vue3-web-pc端 敲完回车会先执行换行再发送消息的问题
## 2.0.9(2023-05-25)
- 修复 因为`2.0.8`优化sqlite,引起的web端报`ReferenceError: sqlite is not defined`的问题
## 2.0.8(2023-05-24)
......
......@@ -32,7 +32,7 @@ let appIsShow = true;
let getCloudMsgIng = false
export default {
init() {
// #ifdef APP-NVUE
// #ifdef APP
getApp().globalData.sqlite = sqlite
// #endif
......
......@@ -502,7 +502,7 @@
}
},
destroyed(){
// console.log('uni-im-msg-destroyed');
console.log('uni-im-msg-destroyed');
audioContext.offPlay(this.onPlay);
audioContext.offPause(this.soundPlayEnd);
audioContext.offStop(this.soundPlayEnd);
......
{
"id": "uni-im",
"displayName": "uni-im",
"version": "2.0.9",
"version": "2.0.10",
"description": "uni-im是云端一体的、全平台的、免费的、开源即时通讯系统",
"keywords": [
"im,即时通讯,客服,聊天"
......
......@@ -34,51 +34,53 @@
<text class="answer-msg-text">{{getNicknameByUid(msgList[answerMsgIndex].from_uid)}}:{{msgList[answerMsgIndex].body}}</text>
<uni-icons @click="answerMsgIndex = false" type="clear" color="#aaa" size="16px"></uni-icons>
</view>
<textarea class="textarea" :maxlength="isCodeText?-1:250" v-model="chatText" @focus="onChatInputFocus()" @blur="isFocus = false"
<textarea class="textarea" :maxlength="isCodeText?-1:250" v-model="chatText" @focus="onChatInputFocus()" @blur="isFocus = false" :focus="isFocus"
@keyup.shift="onKeyup('shift')" @keydown.shift="onKeydown('shift')" @keydown.enter="onKeydown('enter')"
></textarea>
</view>
<!-- #endif -->
<!-- 非pc宽屏(width<960px)的输入框 -->
<view v-if="!isWidescreen && showInputBox" class="input-box">
<!-- 切换为语音模式 -->
<uni-im-icons @click="changeSoundIsShow" :code="soundIsShow?'e69f':'e684'" size="30" class="icon"></uni-im-icons>
<view class="input-box-conetnt">
<view class="textarea-box">
<textarea
v-model="chatText" @input="input" @confirm="beforeSendMsg()" @linechange="linechange" :flex="true"
:style="{ height: textareaHeight + 'px' }" :disable-default-padding="false" :hold-keyboard="true" :confirm-hold="true"
:auto-blur="false" confirm-type="send" :show-confirm-bar="false" :cursor-spacing="20" maxlength="250"
:focus="mpIsFocus" @focus="onChatInputFocus()" @blur="isFocus = false" :fixed="true"
:adjust-position="false" class="textarea" ref="input-box" @return="beforeSendMsg()"/>
</view>
<view class="answer-msg" v-if="answerMsgIndex !== false">
<text class="answer-msg-text">{{getNicknameByUid(msgList[answerMsgIndex].from_uid)}}:{{msgList[answerMsgIndex].body}}</text>
<uni-icons @click="answerMsgIndex = false" type="clear" color="#aaa" size="16"></uni-icons>
</view>
<uni-im-sound class="uni-im-sound" v-if="soundIsShow" @success="sendSound"></uni-im-sound>
</view>
<uni-im-icons @click.native.stop="changeEmojiIsShow" :code="emojiIsShow?'e69f':'e646'" size="30" class="icon"></uni-im-icons>
<text v-if="!soundIsShow&&chatText" @click.prevent="beforeSendMsg()" class="icon beforeSendMsg">发送</text>
<uni-im-icons v-else @click.native.stop="changeMenuIsShow" code="e75a" size="30" class="icon"></uni-im-icons>
</view>
<view v-if="menuIsShow||emojiIsShow" class="media-box" :style="{height:keyboardMaxHeight+'px'}">
<view v-if="menuIsShow" class="menu" :style="{height:keyboardMaxHeight+'px'}">
<view class="menu-item" v-for="(item,index) in menuList" :key="index" @click.stop="clickMenu(index,$event)">
<view class="menu-item-icon">
<uni-im-icons :code="item.iconCode" size="26"></uni-im-icons>
</view>
<text class="menu-item-text">{{item.title}}</text>
</view>
</view>
<scroll-view :scroll-y="true" v-if="emojiIsShow" class="emojiListBox" :style="{height:keyboardMaxHeight+'px'}">
<text v-for="(uniCodeEmoji,index) in emojiCodes" :key="index" @click.stop="clickEmojiItem(uniCodeEmoji,$event)"
class="emoji-item">{{uniCodeEmoji}}</text>
</scroll-view>
</view>
<view v-else :style="{height:keyboardHeight - phoneBH +'px'}"></view>
<!-- 非pc宽屏(width<960px)的输入框 -->
<template v-if="!isWidescreen">
<view v-if="showInputBox" class="input-box">
<!-- 切换为语音模式 -->
<uni-im-icons @click="changeSoundIsShow" :code="soundIsShow?'e69f':'e684'" size="30" class="icon"></uni-im-icons>
<view class="input-box-conetnt">
<view class="textarea-box">
<textarea
v-model="chatText" @input="input" @confirm="beforeSendMsg()" @linechange="linechange" :flex="true"
:style="{ height: textareaHeight + 'px' }" :disable-default-padding="false" :hold-keyboard="true" :confirm-hold="true"
:auto-blur="false" confirm-type="send" :show-confirm-bar="false" :cursor-spacing="20" maxlength="250"
:focus="mpIsFocus" @focus="onChatInputFocus()" @blur="isFocus = false" :fixed="true"
:adjust-position="false" class="textarea" ref="input-box" @return="beforeSendMsg()"/>
</view>
<view class="answer-msg" v-if="answerMsgIndex !== false">
<text class="answer-msg-text">{{getNicknameByUid(msgList[answerMsgIndex].from_uid)}}:{{msgList[answerMsgIndex].body}}</text>
<uni-icons @click="answerMsgIndex = false" type="clear" color="#aaa" size="16"></uni-icons>
</view>
<uni-im-sound class="uni-im-sound" v-if="soundIsShow" @success="sendSound"></uni-im-sound>
</view>
<uni-im-icons @click.native.stop="changeEmojiIsShow" :code="emojiIsShow?'e69f':'e646'" size="30" class="icon"></uni-im-icons>
<text v-if="!soundIsShow&&chatText" @click.prevent="beforeSendMsg()" class="icon beforeSendMsg">发送</text>
<uni-im-icons v-else @click.native.stop="changeMenuIsShow" code="e75a" size="30" class="icon"></uni-im-icons>
</view>
<view v-if="menuIsShow||emojiIsShow" class="media-box" :style="{height:keyboardMaxHeight+'px'}">
<view v-if="menuIsShow" class="menu" :style="{height:keyboardMaxHeight+'px'}">
<view class="menu-item" v-for="(item,index) in menuList" :key="index" @click.stop="clickMenu(index,$event)">
<view class="menu-item-icon">
<uni-im-icons :code="item.iconCode" size="26"></uni-im-icons>
</view>
<text class="menu-item-text">{{item.title}}</text>
</view>
</view>
<scroll-view :scroll-y="true" v-if="emojiIsShow" class="emojiListBox" :style="{height:keyboardMaxHeight+'px'}">
<text v-for="(uniCodeEmoji,index) in emojiCodes" :key="index" @click.stop="clickEmojiItem(uniCodeEmoji,$event)"
class="emoji-item">{{uniCodeEmoji}}</text>
</scroll-view>
</view>
<view v-else :style="{height:keyboardHeight - phoneBH +'px'}"></view>
</template>
</view>
<uni-im-control ref="uni-im-control" @answer="answer"></uni-im-control>
......@@ -411,7 +413,7 @@
// #ifdef H5 && VUE3
//获得消息输入框对象
let adjunctKeydown = false
const textareaDom = document.querySelector('.textarea-box textarea');
const textareaDom = document.querySelector('.pc textarea');
if (textareaDom) {
//键盘按下时
textareaDom.onkeydown = e => {
......@@ -421,10 +423,7 @@
adjunctKeydown = true;
}
if (e.keyCode == 13 && !adjunctKeydown) {
// 延迟兼容 v-model的时机小于onkeydown的问题
setTimeout(()=> {
this.beforeSendMsg();
}, 100);
this.beforeSendMsg();
}
};
textareaDom.onkeyup = e => {
......@@ -687,8 +686,17 @@
}
}
// 如果是文本类型需要做一些处理
if(data.type == 'text'){
//清除空格
if(data.type == 'text'){
// #ifdef H5
const textareaDom = document.querySelector('.pc textarea') || document.querySelector('.textarea-box textarea')
this.chatText = textareaDom.value
textareaDom.disabled = true
setTimeout(()=> {
textareaDom.disabled = false
this.isFocus = true
}, 0);
// #endif
//清除空格
data.body = this.chatText.trim();
// console.log('data.body',data.body);
// 阻止发送空消息
......@@ -700,12 +708,12 @@
}
// 在下一个事件循环 清除输入框的文本内容
// 注意:为兼容web-pc端 这里必须用 setTimeout,0
setTimeout(e => {
// 注意:为兼容web-pc端 这里必须用 setTimeout,0
this.$nextTick(e => {
this.chatText = '';
this.textareaHeight = 26;
this.answerMsgIndex = false
},0);
});
// 当消息是否为 code类型开启时设置 -- 快速实现,临时方案 后续会优化
if(this.isCodeText){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册