Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-im
提交
7ae1ce1d
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看板
提交
7ae1ce1d
编写于
11月 11, 2024
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新 查找好友页面不再显示当前用户自己
上级
4e7b062b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
15 addition
and
21 deletion
+15
-21
pages/contacts/addPeopleGroups/addPeopleGroups.vue
pages/contacts/addPeopleGroups/addPeopleGroups.vue
+15
-21
未找到文件。
pages/contacts/addPeopleGroups/addPeopleGroups.vue
浏览文件 @
7ae1ce1d
...
...
@@ -25,16 +25,9 @@
:avatar=
"item.avatar_file?.url || '/uni_modules/uni-im/static/avatarUrl.png'"
>
<text
v-if=
"item.isFriend"
class=
"chat-custom-right grey"
>
已添加
</text>
<text
v-else-if=
"item._id === currentUser._id"
class=
"chat-custom-right grey"
>
不能加自己
</text>
<text
v-else
@
click=
"addUser(index)"
class=
"chat-custom-right"
>
加为好友
</text>
</uni-im-info-card>
<!--
v-if="keyword.length"
<template
v-else
>
<uni-list-item
v-for=
"(tab,index) in tabs"
:key=
"index"
class=
"tab-item"
:title=
"tab.title"
:to=
"tab.url"
showArrow
:border=
"false"
></uni-list-item>
</
template
>
-->
</view>
<uni-im-load-state
v-else
:status=
"loading?'loading':(hasMore?'hasMore':'noMore')"
></uni-im-load-state>
</view>
...
...
@@ -96,6 +89,7 @@ import uniIm from '@/uni_modules/uni-im/sdk/index.js';
}
},
computed
:
{
...
uniIm
.
mapState
([
'
currentUser
'
]),
usersList
()
{
let
friendList
=
uniIm
.
friend
.
dataList
return
this
.
usersData
.
map
(
item
=>
{
...
...
@@ -140,7 +134,7 @@ import uniIm from '@/uni_modules/uni-im/sdk/index.js';
const
limit
=
100
const
skip
=
this
.
groupData
.
length
/
limit
const
res
=
await
db
.
collection
(
'
uni-im-group
'
)
.
where
(
`"user_id" != "
${
uniIm
.
currentUser
.
_id
}
"`
)
.
where
(
`"user_id" != "
${
this
.
currentUser
.
_id
}
"`
)
.
field
(
'
_id,name,avatar_file
'
)
.
orderBy
(
'
create_date
'
,
'
desc
'
)
.
skip
(
skip
)
...
...
@@ -156,6 +150,7 @@ import uniIm from '@/uni_modules/uni-im/sdk/index.js';
async
getUserList
(){
try
{
let
res
=
await
db
.
collection
(
'
uni-id-users
'
)
.
where
(
`"_id" != "
${
this
.
currentUser
.
_id
}
"`
)
.
field
(
'
_id,nickname,avatar_file
'
)
.
get
()
let
data
=
res
.
result
.
data
...
...
@@ -166,26 +161,26 @@ import uniIm from '@/uni_modules/uni-im/sdk/index.js';
this
.
usersData
=
data
}
}
catch
(
e
){
console
.
log
(
e
);
console
.
error
(
e
);
}
},
back
()
{
uni
.
navigateBack
()
},
async
doSearch
(
e
){
if
(
!
this
.
keyword
){
return
this
.
activeIndex
===
0
?
this
.
getUserList
()
:
this
.
getGroupsList
()
}
// console.log("doSearch: ",e,this.keyword);
uni
.
showLoading
({
title
:
'
搜索中
'
})
if
(
this
.
activeIndex
){
let
where
=
{};
if
(
this
.
keyword
){
where
=
`
const
where
=
`
/
${
this
.
keyword
}
/.test(name) ||
"_id" == "
${
this
.
keyword
}
"
`
}
let
res
=
await
db
.
collection
(
'
uni-im-group
'
)
const
res
=
await
db
.
collection
(
'
uni-im-group
'
)
.
where
(
where
)
.
get
()
// console.log(res);
...
...
@@ -199,7 +194,7 @@ import uniIm from '@/uni_modules/uni-im/sdk/index.js';
"
mobile
"
].
map
(
item
=>
`"
${
item
}
" == "
${
this
.
keyword
}
"`
).
join
(
'
||
'
)
// console.log('whereString',whereString);
le
t
res
=
await
db
.
collection
(
'
uni-id-users
'
)
cons
t
res
=
await
db
.
collection
(
'
uni-id-users
'
)
.
where
(
whereString
)
.
field
(
'
_id,nickname,avatar_file
'
)
.
get
()
...
...
@@ -308,14 +303,10 @@ import uniIm from '@/uni_modules/uni-im/sdk/index.js';
.background
{
background-color
:
#f5f5f5
;
}
.grey
{
color
:
#ddd
;
}
.chat-custom-right
{
width
:
70px
;
height
:
30px
;
line-height
:
30px
;
padding
:
0
10px
;
color
:
#666
;
font-size
:
12px
;
text-align
:
center
;
...
...
@@ -325,6 +316,9 @@ import uniIm from '@/uni_modules/uni-im/sdk/index.js';
/* #endif */
border-radius
:
100px
;
}
.grey
{
color
:
#aaa
;
}
.border
{
border
:
#ddd
solid
1px
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录