diff --git a/pages/contacts/addPeopleGroups/addPeopleGroups.vue b/pages/contacts/addPeopleGroups/addPeopleGroups.vue
index b282577bd300f0f20bc16ab0665878dbe11b3c87..e8aea51a4c18fc8be74e4eddf9351e09e4d73000 100644
--- a/pages/contacts/addPeopleGroups/addPeopleGroups.vue
+++ b/pages/contacts/addPeopleGroups/addPeopleGroups.vue
@@ -25,16 +25,9 @@
:avatar="item.avatar_file?.url || '/uni_modules/uni-im/static/avatarUrl.png'"
>
已添加
+ 不能加自己
加为好友
-
@@ -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);
- let res = await db.collection('uni-id-users')
+ const 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;
}