Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-im
比较版本
9e8e5170304884034264135faa3142293b9a8b39...12a3d5b5d442f56f431f92b1611677ef4d5c42a5
U
uni-im
项目概览
DCloud
/
uni-im
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-im
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
源分支
12a3d5b5d442f56f431f92b1611677ef4d5c42a5
选择Git版本
...
目标分支
9e8e5170304884034264135faa3142293b9a8b39
选择Git版本
比较
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
显示空白变更内容
内联
并排
Showing
8 changed file
with
366 addition
and
196 deletion
+366
-196
changelog.md
changelog.md
+1
-1
components/uni-im-editor/uni-im-editor.vue
components/uni-im-editor/uni-im-editor.vue
+4
-0
components/uni-im-msg/popup-control.vue
components/uni-im-msg/popup-control.vue
+3
-12
pages/chat/chat.vue
pages/chat/chat.vue
+22
-74
pages/chat/toolbar.vue
pages/chat/toolbar.vue
+125
-0
pages/group/info.vue
pages/group/info.vue
+4
-0
pages/share-msg/share-msg.vue
pages/share-msg/share-msg.vue
+199
-104
uniCloud/cloudfunctions/uni-im-co/conversation.js
uniCloud/cloudfunctions/uni-im-co/conversation.js
+8
-5
未找到文件。
changelog.md
浏览文件 @
12a3d5b5
## 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更新引起的解散群功能出错的问题
...
...
components/uni-im-editor/uni-im-editor.vue
浏览文件 @
12a3d5b5
...
...
@@ -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
{
...
...
components/uni-im-msg/popup-control.vue
浏览文件 @
12a3d5b5
...
...
@@ -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
})
}
...
...
pages/chat/chat.vue
浏览文件 @
12a3d5b5
...
...
@@ -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
pages/chat/toolbar.vue
0 → 100644
浏览文件 @
12a3d5b5
<
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
pages/group/info.vue
浏览文件 @
12a3d5b5
...
...
@@ -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
:
{
...
...
components/uni-im-share-msg/uni-im-
share-msg.vue
→
pages/share-msg/
share-msg.vue
浏览文件 @
12a3d5b5
...
...
@@ -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
:
750
rpx
;
/* #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
uniCloud/cloudfunctions/uni-im-co/conversation.js
浏览文件 @
12a3d5b5
...
...
@@ -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)
...
...