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