...
 
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)
uni-im-co 新增 httpApi 方法,方便第三方服务器调用其 url 化后的任意方法
uni-im-co 新增 httpApi 方法,方便外部服务器调用其url化后的方法
## 3.4.39(2024-11-15)
- 新增 客户端错误日志收集功能
- 修复 由3.4.37更新引起的解散群功能出错的问题
......
......@@ -585,10 +585,14 @@
max-height: 110px;
overflow: auto;
// 解决ios下不能编辑的问题
user-select: text;
-webkit-user-select:text;
-webkit-user-modify: read-write-plaintext-only;
/* #ifdef APP */
&,* {
user-select: text;
-webkit-user-select:text;
-webkit-user-modify: read-write-plaintext-only;
}
/* #endif */
&:focus {
......
......@@ -60,16 +60,7 @@
this.$emit('chooseMore',[this.controlData.msg])
},
share(e){
// 仅支持web pc端
if(!this.isWidescreen){
uni.showToast({
title:'仅支持web pc端',
icon:'none'
})
return
}
this.$emit('share',[this.controlData.msg])
},
initControlList(msg){
this.controlList = [
......@@ -96,12 +87,12 @@
{
title:'转发',
action:()=>this.share(),
canDisplay:this.isWidescreen && msg._id != undefined,
canDisplay: msg._id != undefined,
},
{
title:'多选',
action:()=>this.chooseMore(),
canDisplay:this.isWidescreen && msg._id != undefined,
canDisplay: msg._id != undefined,
}
]
......@@ -109,7 +100,7 @@
this.controlList.push({
title:'进入会话',
action:()=> this.$emit('intoTopic', msg._id),
canDisplay:true,
canDisplay: this.isWidescreen
})
}
......
......@@ -46,39 +46,7 @@
</template>
</uni-im-chat-input>
<view v-if="chooseMoreMsg" class="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>
<toolbar v-model="chooseMoreMsg" @shareMsg="shareMsg(checkedMsgList,$event)"></toolbar>
</view>
<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 @@
<uni-im-member-list ref="member-list" :conversationId="conversation.id"></uni-im-member-list>
<!-- #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 -->
<view style="position: fixed;top: 200px;left: 0;background-color: #FFFFFF;z-index: 9999;">
<!-- keyboardMaxHeight:{{keyboardMaxHeight}}
conversation.leave:{{conversation.leave}}
......@@ -106,7 +73,12 @@
<script>
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 toolbar from './toolbar.vue';
import {markRaw} from "vue";
// #ifdef H5
import uniImShareMsg from '@/uni_modules/uni-im/pages/share-msg/share-msg.vue';
// #endif
/**
* chat 组件,渲染一个完整的会话,包括头部、消息列表、输入区。
......@@ -117,7 +89,11 @@
*/
export default {
components: {
// #ifdef H5
uniImShareMsg,
// #endif
msgPopupControl,
toolbar
},
data() {
return {
......@@ -858,15 +834,17 @@
this.$refs['msg-popup-control'].show({isSelf,msg,msgContentDomInfo})
},
shareMsg(msgList,merge = false) {
console.error('msgList',msgList)
if (this.isWidescreen) {
this.$refs['share-msg'].open(msgList,merge)
this.chooseMoreMsg = false
},
toolBarNext(){
uni.showToast({
title: '暂不支持',
icon: 'none',
duration: 2000
});
} else {
uni.navigateTo({
url: '/uni_modules/uni-im/pages/share-msg/share-msg',
success: res => {
res.eventChannel.emit('shareMsg', [msgList,merge])
}
})
}
this.chooseMoreMsg = false
},
tapUnreadCount() {
......@@ -1006,35 +984,5 @@ page {
margin-top: 3px;
}
/* #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>
\ 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 @@
<!-- <text @click="joinGroup" style="padding: 15px;text-align: center;color: #005eca;cursor: pointer;">申请加入</text> -->
</view>
<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>
<uni-popup ref="popupInfo" type="dialog">
<uni-popup-dialog mode="input" :title="editorFields[editorType]" :placeholder="'请输入'+editorFields[editorType]"
......@@ -122,6 +123,9 @@
},
isTmpGroup(){
return this.conversation?.id?.indexOf('__tmp') === 0
},
isBissnessGroup(){
return this.conversation.group?.ext?.business_group_code
}
},
watch: {
......
......@@ -5,6 +5,15 @@
@click="close"
>
<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">
<uni-search-bar
id="search-bar"
......@@ -22,7 +31,7 @@
:show-unread-count="false"
/>
</view>
<view class="conversation-detail-box">
<view class="conversation-detail-box" v-if="isWidescreen">
<text class="title">
转发给:
</text>
......@@ -97,6 +106,7 @@
import uniIm from '@/uni_modules/uni-im/sdk/index.js';
export default {
name: 'UniImShareMsg',
emits: ['close'],
props: {
noMsgList: { // 不显示转发的消息列表
type: Boolean,
......@@ -114,13 +124,54 @@ export default {
checkedList: [],
isOpen: false,
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
}
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('shareMsg', ([msgList,merge]) => {
console.log('shareMsg',msgList,merge)
this.open(msgList, merge);
});
},
computed: {},
methods: {
open(msgList, merge) {
// console.info('msgList', msgList);
console.info('msgList', msgList);
this.isOpen = true;
this.merge = merge;
......@@ -142,6 +193,9 @@ export default {
this.isOpen = false;
this.checkedList = [];
this.inputText = '';
if(!this.isWidescreen){
uni.navigateBack();
}
},
createMsg(msg, conversation) {
......@@ -151,6 +205,8 @@ export default {
this.$refs['view-msg'].open(this.msgList);
},
async send() {
console.info('send', this.checkedList);
console.info('this.msgList', this.msgList);
if (!this.merge && this.inputText.length != 0) {
this.msgList.push({
"body": this.inputText,
......@@ -235,7 +291,8 @@ export default {
}
</script>
<style>
<style lang="scss">
@import "@/uni_modules/uni-im/common/baseStyle.scss";
/* #ifdef H5*/
.share-msg-root,
.share-msg-root * {
......@@ -246,11 +303,13 @@ export default {
/* #endif */
.share-msg-root {
width: 750rpx;
/* #ifndef APP */
position: fixed;
top: 0;
left: 0;
z-index: 999;
width: 750rpx;
/* #endif */
/* #ifdef H5 */
width: 100vw;
height: 100vh;
......@@ -259,19 +318,54 @@ export default {
justify-content: center;
align-items: center;
background-color: rgb(0, 0, 0, 0.3);
}
.share-msg-content {
.navbar {
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 10px;
border-bottom: 1px solid #eee;
.title {
font-size: 14px;
color: #333;
}
.btn {
font-size: 12px;
color: #FFF;
background-color: #149d42;
padding: 4px 8px;
border-radius: 6px;
&.disabled {
background-color: #EEE;
color: #CCC;
}
&.cancel {
border: none;
background-color: #FFF;
color: #666;
}
}
}
background-color: #fff;
width: 750rpx;
height: 100%;
/* #ifdef H5 */
@media screen and (min-device-width:960px){
width: 750px;
height: 70vh;
flex-direction: row;
border-radius: 15px;
flex-direction: row;
}
/* #endif */
position: relative;
}
.conversation-list-box {
/* #ifdef H5 */
@media screen and (min-device-width:960px){
width: 300px;
}
/* #endif */
height: 100%;
border-right: 1px solid #eee;
}
......@@ -358,4 +452,5 @@ export default {
color: #999;
border-color: #999;
}
}
</style>
\ No newline at end of file
......@@ -209,11 +209,14 @@ async function getConversationList({
let friend_uids = res.data.map(item => item.friend_uid).filter(i => i)
// 计算请求时间
startTime = Date.now()
let usersInfoRes = await dbJQL.collection('uni-id-users')
let usersInfoRes = {data:[]}
if (friend_uids.length !== 0){
usersInfoRes = await dbJQL.collection('uni-id-users')
.where(`_id in ${JSON.stringify(friend_uids)}`)
.field('_id,avatar_file,nickname,realname_auth')
.limit(friend_uids.length)
.get()
}
// log请求时间
// console.error('get user耗时', Date.now() - startTime,startTime)
......