...
 
Commits (7)
    https://gitcode.net/dcloud/uni-im/-/commit/a4c2c143b824449369e23fbb33e8733cda66743f Update changelog.md 2024-11-19T15:55:21+08:00 linju linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/b06682bc44be2af7791f10ce2f56153273cd2a04 Update info.vue 2024-11-25T11:17:04+08:00 linju linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/5dd51d24f6a21756ec46af80eaf3f749ffa10eed Update uni-im-editor.vue 2024-11-25T11:17:04+08:00 linju linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/0e810bdd0fda4c09364a8cd8f4f405f7f967b06d 更新 share-msg支持移动端 2024-11-25T11:21:03+08:00 linju linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/639ac025d9300c7bfc208622a1f5e86aba9e7d09 更新 优化部分情况下,多余的uni-id-users查询逻辑 2024-11-25T11:21:03+08:00 linju linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/44b14031f67ead78e816f84ca1d31aba93f1203e 更新 toolbar 从 chat 页面中抽离出来 2024-11-25T11:21:03+08:00 linju linju@dcloud.io https://gitcode.net/dcloud/uni-im/-/commit/12a3d5b5d442f56f431f92b1611677ef4d5c42a5 Update chat.vue 2024-11-25T11:21:03+08:00 linju linju@dcloud.io
## 3.4.40(2024-11-18) ## 3.4.40(2024-11-18)
uni-im-co 新增 httpApi 方法,方便第三方服务器调用其 url 化后的任意方法 uni-im-co 新增 httpApi 方法,方便外部服务器调用其url化后的方法
## 3.4.39(2024-11-15) ## 3.4.39(2024-11-15)
- 新增 客户端错误日志收集功能 - 新增 客户端错误日志收集功能
- 修复 由3.4.37更新引起的解散群功能出错的问题 - 修复 由3.4.37更新引起的解散群功能出错的问题
......
...@@ -585,10 +585,14 @@ ...@@ -585,10 +585,14 @@
max-height: 110px; max-height: 110px;
overflow: auto; overflow: auto;
// 解决ios下不能编辑的问题 // 解决ios下不能编辑的问题
user-select: text;
-webkit-user-select:text;
-webkit-user-modify: read-write-plaintext-only; -webkit-user-modify: read-write-plaintext-only;
/* #ifdef APP */ /* #ifdef APP */
&,* { &,* {
user-select: text;
-webkit-user-select:text; -webkit-user-select:text;
-webkit-user-modify: read-write-plaintext-only;
} }
/* #endif */ /* #endif */
&:focus { &:focus {
......
...@@ -60,16 +60,7 @@ ...@@ -60,16 +60,7 @@
this.$emit('chooseMore',[this.controlData.msg]) this.$emit('chooseMore',[this.controlData.msg])
}, },
share(e){ share(e){
// 仅支持web pc端
if(!this.isWidescreen){
uni.showToast({
title:'仅支持web pc端',
icon:'none'
})
return
}
this.$emit('share',[this.controlData.msg]) this.$emit('share',[this.controlData.msg])
}, },
initControlList(msg){ initControlList(msg){
this.controlList = [ this.controlList = [
...@@ -96,12 +87,12 @@ ...@@ -96,12 +87,12 @@
{ {
title:'转发', title:'转发',
action:()=>this.share(), action:()=>this.share(),
canDisplay:this.isWidescreen && msg._id != undefined, canDisplay: msg._id != undefined,
}, },
{ {
title:'多选', title:'多选',
action:()=>this.chooseMore(), action:()=>this.chooseMore(),
canDisplay:this.isWidescreen && msg._id != undefined, canDisplay: msg._id != undefined,
} }
] ]
...@@ -109,7 +100,7 @@ ...@@ -109,7 +100,7 @@
this.controlList.push({ this.controlList.push({
title:'进入会话', title:'进入会话',
action:()=> this.$emit('intoTopic', msg._id), action:()=> this.$emit('intoTopic', msg._id),
canDisplay:true, canDisplay: this.isWidescreen
}) })
} }
......
...@@ -46,39 +46,7 @@ ...@@ -46,39 +46,7 @@
</template> </template>
</uni-im-chat-input> </uni-im-chat-input>
<view v-if="chooseMoreMsg" class="toolbar"> <toolbar v-model="chooseMoreMsg" @shareMsg="shareMsg(checkedMsgList,$event)"></toolbar>
<view class="item" @click="shareMsg(checkedMsgList)">
<view class="icons-box">
<uni-icons size="35" type="redo"></uni-icons>
</view>
<text class="title">逐条转发</text>
</view>
<view class="item" @click="shareMsg(checkedMsgList,true)">
<view class="icons-box">
<uni-icons size="35" type="paperplane"></uni-icons>
</view>
<text class="title">合并转发</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="folder-add"></uni-icons>
</view>
<text class="title">收藏</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="download"></uni-icons>
</view>
<text class="title">保存至电脑</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="35" type="trash"></uni-icons>
</view>
<text class="title">删除</text>
</view>
<uni-icons @click="chooseMoreMsg = false" color="#999" size="35" type="closeempty"></uni-icons>
</view>
</view> </view>
<msg-popup-control ref="msg-popup-control" @answer="setAnswerMsg" @intoTopic="intoTopic" @share="shareMsg" @chooseMore="chooseMoreMsg = true;checkedMsgList = $event"></msg-popup-control> <msg-popup-control ref="msg-popup-control" @answer="setAnswerMsg" @intoTopic="intoTopic" @share="shareMsg" @chooseMore="chooseMoreMsg = true;checkedMsgList = $event"></msg-popup-control>
...@@ -87,10 +55,9 @@ ...@@ -87,10 +55,9 @@
<uni-im-member-list ref="member-list" :conversationId="conversation.id"></uni-im-member-list> <uni-im-member-list ref="member-list" :conversationId="conversation.id"></uni-im-member-list>
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<uni-im-share-msg id="uni-im-share-msg" ref="share-msg"></uni-im-share-msg> <uni-im-share-msg v-if="isWidescreen" id="uni-im-share-msg" ref="share-msg"></uni-im-share-msg>
<!-- #endif --> <!-- #endif -->
<view style="position: fixed;top: 200px;left: 0;background-color: #FFFFFF;z-index: 9999;"> <view style="position: fixed;top: 200px;left: 0;background-color: #FFFFFF;z-index: 9999;">
<!-- keyboardMaxHeight:{{keyboardMaxHeight}} <!-- keyboardMaxHeight:{{keyboardMaxHeight}}
conversation.leave:{{conversation.leave}} conversation.leave:{{conversation.leave}}
...@@ -106,7 +73,12 @@ ...@@ -106,7 +73,12 @@
<script> <script>
import uniIm from '@/uni_modules/uni-im/sdk/index.js'; import uniIm from '@/uni_modules/uni-im/sdk/index.js';
import msgPopupControl from '@/uni_modules/uni-im/components/uni-im-msg/popup-control.vue'; import msgPopupControl from '@/uni_modules/uni-im/components/uni-im-msg/popup-control.vue';
import toolbar from './toolbar.vue';
import {markRaw} from "vue"; import {markRaw} from "vue";
// #ifdef H5
import uniImShareMsg from '@/uni_modules/uni-im/pages/share-msg/share-msg.vue';
// #endif
/** /**
* chat 组件,渲染一个完整的会话,包括头部、消息列表、输入区。 * chat 组件,渲染一个完整的会话,包括头部、消息列表、输入区。
...@@ -117,7 +89,11 @@ ...@@ -117,7 +89,11 @@
*/ */
export default { export default {
components: { components: {
// #ifdef H5
uniImShareMsg,
// #endif
msgPopupControl, msgPopupControl,
toolbar
}, },
data() { data() {
return { return {
...@@ -858,15 +834,17 @@ ...@@ -858,15 +834,17 @@
this.$refs['msg-popup-control'].show({isSelf,msg,msgContentDomInfo}) this.$refs['msg-popup-control'].show({isSelf,msg,msgContentDomInfo})
}, },
shareMsg(msgList,merge = false) { shareMsg(msgList,merge = false) {
this.$refs['share-msg'].open(msgList,merge) console.error('msgList',msgList)
this.chooseMoreMsg = false if (this.isWidescreen) {
}, this.$refs['share-msg'].open(msgList,merge)
toolBarNext(){ } else {
uni.showToast({ uni.navigateTo({
title: '暂不支持', url: '/uni_modules/uni-im/pages/share-msg/share-msg',
icon: 'none', success: res => {
duration: 2000 res.eventChannel.emit('shareMsg', [msgList,merge])
}); }
})
}
this.chooseMoreMsg = false this.chooseMoreMsg = false
}, },
tapUnreadCount() { tapUnreadCount() {
...@@ -1006,35 +984,5 @@ page { ...@@ -1006,35 +984,5 @@ page {
margin-top: 3px; margin-top: 3px;
} }
/* #endif */ /* #endif */
.toolbar{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #ededed;
border-top: solid 1px #ededed;
flex-direction: row;
justify-content: space-around;
align-items: center;
z-index: 9;
}
.toolbar .item {
align-items: center;
}
/* #ifdef H5 */
.toolbar ::v-deep .uni-icons {
cursor: pointer;
}
/* #endif */
.toolbar .icons-box {
background-color: #fff;
justify-content: center;
width: 60px;
height: 60px;
border-radius: 100px;
margin-bottom: 10px;
}
} }
</style> </style>
\ No newline at end of file
<template>
<view v-if="modelValue" class="toolbar">
<view class="item" @click="shareMsg(false)">
<view class="icons-box">
<uni-icons size="20" type="redo"></uni-icons>
</view>
<text class="title">逐条转发</text>
</view>
<view class="item" @click="shareMsg(true)">
<view class="icons-box">
<uni-icons size="20" type="paperplane"></uni-icons>
</view>
<text class="title">合并转发</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="20" type="folder-add"></uni-icons>
</view>
<text class="title">收藏</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="20" type="download"></uni-icons>
</view>
<text class="title">下载保存</text>
</view>
<view class="item" @click="toolBarNext">
<view class="icons-box">
<uni-icons size="20" type="trash"></uni-icons>
</view>
<text class="title">删除</text>
</view>
<uni-icons class="close-icon" @click="close" color="#999" size="35" type="closeempty"></uni-icons>
</view>
</template>
<script>
export default {
name: 'UniImToolBar',
emits: ['shareMsg', 'toolBarNext', 'update:modelValue'],
props: {
checkedMsgList: {
type: Array,
default: () => []
},
modelValue: {
type: Boolean,
default: false,
}
},
data() {
return {
}
},
methods: {
shareMsg(merge) {
this.$emit('shareMsg', merge)
},
close() {
this.$emit('update:modelValue', false)
},
toolBarNext(){
uni.showToast({
title: '暂不支持',
icon: 'none',
duration: 2000
});
this.chooseMoreMsg = false
},
}
}
</script>
<style lang="scss">
.toolbar {
background-color: #FFF;
/* #ifdef H5 */
@media screen and (min-device-width:960px){
background-color: #ededed;
}
/* #endif */
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
border-top: solid 1px #ededed;
flex-direction: row;
justify-content: space-around;
align-items: center;
z-index: 9;
.item {
align-items: center;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
.icons-box {
background-color: #fff;
justify-content: center;
align-items: center;
border-radius: 100px;
width: 30px;
height: 30px;
/* #ifdef H5 */
@media screen and (min-device-width:960px){
width: 60px;
height: 60px;
margin-bottom: 10px;
.uni-icons {
font-size: 35px !important;
}
}
/* #endif */
}
.title {
font-size: 8px;
/* #ifdef H5 */
@media screen and (min-device-width:960px){
font-size: 14px;
}
/* #endif */
}
}
}
</style>
\ No newline at end of file
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<!-- <text @click="joinGroup" style="padding: 15px;text-align: center;color: #005eca;cursor: pointer;">申请加入</text> --> <!-- <text @click="joinGroup" style="padding: 15px;text-align: center;color: #005eca;cursor: pointer;">申请加入</text> -->
</view> </view>
<text v-else-if="isTmpGroup" style="padding: 15px;text-align: center;color: #666;">- 临时群聊 -</text> <text v-else-if="isTmpGroup" style="padding: 15px;text-align: center;color: #666;">- 临时群聊 -</text>
<text v-else-if="isBissnessGroup" style="padding: 15px;text-align: center;color: #666;">- 业务群 -</text>
<text v-else class="exitGroup" @click="exitGroup">{{isGroupCreator?'解散群聊':'退出群聊'}}</text> <text v-else class="exitGroup" @click="exitGroup">{{isGroupCreator?'解散群聊':'退出群聊'}}</text>
<uni-popup ref="popupInfo" type="dialog"> <uni-popup ref="popupInfo" type="dialog">
<uni-popup-dialog mode="input" :title="editorFields[editorType]" :placeholder="'请输入'+editorFields[editorType]" <uni-popup-dialog mode="input" :title="editorFields[editorType]" :placeholder="'请输入'+editorFields[editorType]"
...@@ -122,6 +123,9 @@ ...@@ -122,6 +123,9 @@
}, },
isTmpGroup(){ isTmpGroup(){
return this.conversation?.id?.indexOf('__tmp') === 0 return this.conversation?.id?.indexOf('__tmp') === 0
},
isBissnessGroup(){
return this.conversation.group?.ext?.business_group_code
} }
}, },
watch: { watch: {
......
...@@ -5,6 +5,15 @@ ...@@ -5,6 +5,15 @@
@click="close" @click="close"
> >
<view class="share-msg-content" @click.stop> <view class="share-msg-content" @click.stop>
<!-- #ifndef APP -->
<view class="navbar" v-if="!isWidescreen">
<text class="btn cancel" @click="close">返回</text>
<text class="title">选择会话</text>
<text class="btn" @click="send" v-if="canSend">发送({{checkedList.length}})</text>
<text class="btn disabled" v-else>发送</text>
</view>
<!-- #endif -->
<view class="conversation-list-box"> <view class="conversation-list-box">
<uni-search-bar <uni-search-bar
id="search-bar" id="search-bar"
...@@ -22,7 +31,7 @@ ...@@ -22,7 +31,7 @@
:show-unread-count="false" :show-unread-count="false"
/> />
</view> </view>
<view class="conversation-detail-box"> <view class="conversation-detail-box" v-if="isWidescreen">
<text class="title"> <text class="title">
转发给: 转发给:
</text> </text>
...@@ -97,6 +106,7 @@ ...@@ -97,6 +106,7 @@
import uniIm from '@/uni_modules/uni-im/sdk/index.js'; import uniIm from '@/uni_modules/uni-im/sdk/index.js';
export default { export default {
name: 'UniImShareMsg', name: 'UniImShareMsg',
emits: ['close'],
props: { props: {
noMsgList: { // 不显示转发的消息列表 noMsgList: { // 不显示转发的消息列表
type: Boolean, type: Boolean,
...@@ -114,13 +124,54 @@ export default { ...@@ -114,13 +124,54 @@ export default {
checkedList: [], checkedList: [],
isOpen: false, isOpen: false,
msgList: [], msgList: [],
merge: false merge: false,
canSend: false
}
},
computed: {
...uniIm.mapState(['isWidescreen'])
},
watch: {
checkedList: {
handler(val) {
this.canSend = val.length > 0;
// #ifdef APP
const titleNView = {
"autoBackButton": false,
"buttons": [{
"text": "取消",
"fontSize": 16,
"float": "left",
"onclick": this.close
},{
"text": "发送",
"fontSize": 16,
"float": "right",
"onclick": this.canSend ? this.send : null
}]
}
const rightButton = titleNView.buttons[1];
rightButton.width = "100px"
rightButton.text = `发送(${val.length})`
rightButton.color = this.canSend ? '#149d42' : '#CCC'
const currentWebview = this.$scope.$getAppWebview();
currentWebview.setStyle({titleNView});
// #endif
},
immediate: true,
deep: true
} }
}, },
computed: {}, onLoad() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('shareMsg', ([msgList,merge]) => {
console.log('shareMsg',msgList,merge)
this.open(msgList, merge);
});
},
methods: { methods: {
open(msgList, merge) { open(msgList, merge) {
// console.info('msgList', msgList); console.info('msgList', msgList);
this.isOpen = true; this.isOpen = true;
this.merge = merge; this.merge = merge;
...@@ -142,6 +193,9 @@ export default { ...@@ -142,6 +193,9 @@ export default {
this.isOpen = false; this.isOpen = false;
this.checkedList = []; this.checkedList = [];
this.inputText = ''; this.inputText = '';
if(!this.isWidescreen){
uni.navigateBack();
}
}, },
createMsg(msg, conversation) { createMsg(msg, conversation) {
...@@ -151,6 +205,8 @@ export default { ...@@ -151,6 +205,8 @@ export default {
this.$refs['view-msg'].open(this.msgList); this.$refs['view-msg'].open(this.msgList);
}, },
async send() { async send() {
console.info('send', this.checkedList);
console.info('this.msgList', this.msgList);
if (!this.merge && this.inputText.length != 0) { if (!this.merge && this.inputText.length != 0) {
this.msgList.push({ this.msgList.push({
"body": this.inputText, "body": this.inputText,
...@@ -235,7 +291,8 @@ export default { ...@@ -235,7 +291,8 @@ export default {
} }
</script> </script>
<style> <style lang="scss">
@import "@/uni_modules/uni-im/common/baseStyle.scss";
/* #ifdef H5*/ /* #ifdef H5*/
.share-msg-root, .share-msg-root,
.share-msg-root * { .share-msg-root * {
...@@ -246,11 +303,13 @@ export default { ...@@ -246,11 +303,13 @@ export default {
/* #endif */ /* #endif */
.share-msg-root { .share-msg-root {
width: 750rpx;
/* #ifndef APP */
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
z-index: 999; z-index: 999;
width: 750rpx; /* #endif */
/* #ifdef H5 */ /* #ifdef H5 */
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
...@@ -259,103 +318,139 @@ export default { ...@@ -259,103 +318,139 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: rgb(0, 0, 0, 0.3); background-color: rgb(0, 0, 0, 0.3);
} .share-msg-content {
.navbar {
.share-msg-content { flex-direction: row;
background-color: #fff; justify-content: space-between;
width: 750px; align-items: center;
height: 70vh; padding: 10px;
flex-direction: row; border-bottom: 1px solid #eee;
border-radius: 15px; .title {
position: relative; font-size: 14px;
} color: #333;
}
.conversation-list-box { .btn {
width: 300px; font-size: 12px;
height: 100%; color: #FFF;
border-right: 1px solid #eee; background-color: #149d42;
} padding: 4px 8px;
border-radius: 6px;
.conversation-list-box ::v-deep .conversation-list .refresh-box { &.disabled {
background-color: #fff; background-color: #EEE;
} color: #CCC;
}
.conversation-detail-box { &.cancel {
flex: 1; border: none;
} background-color: #FFF;
color: #666;
.conversation-detail-box .title { }
font-size: 18px; }
color: #333; }
margin: 15px; background-color: #fff;
} width: 750rpx;
height: 100%;
.selected-conversation-list { /* #ifdef H5 */
height: 0; @media screen and (min-device-width:960px){
flex: 1; width: 750px;
} height: 70vh;
border-radius: 15px;
.scroll-content { flex-direction: row;
flex-direction: row; }
flex-wrap: wrap; /* #endif */
margin: 0 5px 35px 5px; position: relative;
} }
.selected-conversation-item { .conversation-list-box {
flex-direction: row; /* #ifdef H5 */
padding: 3px; @media screen and (min-device-width:960px){
justify-content: center; width: 300px;
align-items: center; }
border-radius: 5px; /* #endif */
background-color: rgba(250, 250, 250, 1); height: 100%;
margin: 3px; border-right: 1px solid #eee;
} }
.selected-conversation-item .avatar { .conversation-list-box ::v-deep .conversation-list .refresh-box {
width: 35px; background-color: #fff;
height: 35px; }
border-radius: 50%;
} .conversation-detail-box {
flex: 1;
.selected-conversation-item .title { }
font-size: 12px;
color: #333; .conversation-detail-box .title {
text-align: center; font-size: 18px;
margin: 0 5px; color: #333;
} margin: 15px;
}
.close-icon {
cursor: pointer; .selected-conversation-list {
} height: 0;
flex: 1;
.msg {} }
.input-box { .scroll-content {
padding: 15px 10px; flex-direction: row;
border: 1px solid #EEE; flex-wrap: wrap;
border-width: 1px 0; margin: 0 5px 35px 5px;
} }
.textarea { .selected-conversation-item {
width: 100%; flex-direction: row;
border-radius: 5px; padding: 3px;
font-size: 14px; justify-content: center;
outline: none; align-items: center;
} border-radius: 5px;
background-color: rgba(250, 250, 250, 1);
.action-btns { margin: 3px;
flex-direction: row; }
justify-content: flex-end;
padding: 10px; .selected-conversation-item .avatar {
} width: 35px;
height: 35px;
.action-btns .btn { border-radius: 50%;
margin: 0 10px; }
width: 100px;
} .selected-conversation-item .title {
font-size: 12px;
.action-btns .btn.cancel { color: #333;
color: #999; text-align: center;
border-color: #999; margin: 0 5px;
}
.close-icon {
cursor: pointer;
}
.msg {}
.input-box {
padding: 15px 10px;
border: 1px solid #EEE;
border-width: 1px 0;
}
.textarea {
width: 100%;
border-radius: 5px;
font-size: 14px;
outline: none;
}
.action-btns {
flex-direction: row;
justify-content: flex-end;
padding: 10px;
}
.action-btns .btn {
margin: 0 10px;
width: 100px;
}
.action-btns .btn.cancel {
color: #999;
border-color: #999;
}
} }
</style> </style>
\ No newline at end of file
...@@ -209,11 +209,14 @@ async function getConversationList({ ...@@ -209,11 +209,14 @@ async function getConversationList({
let friend_uids = res.data.map(item => item.friend_uid).filter(i => i) let friend_uids = res.data.map(item => item.friend_uid).filter(i => i)
// 计算请求时间 // 计算请求时间
startTime = Date.now() startTime = Date.now()
let usersInfoRes = await dbJQL.collection('uni-id-users') let usersInfoRes = {data:[]}
.where(`_id in ${JSON.stringify(friend_uids)}`) if (friend_uids.length !== 0){
.field('_id,avatar_file,nickname,realname_auth') usersInfoRes = await dbJQL.collection('uni-id-users')
.limit(friend_uids.length) .where(`_id in ${JSON.stringify(friend_uids)}`)
.get() .field('_id,avatar_file,nickname,realname_auth')
.limit(friend_uids.length)
.get()
}
// log请求时间 // log请求时间
// console.error('get user耗时', Date.now() - startTime,startTime) // console.error('get user耗时', Date.now() - startTime,startTime)
......