update
This commit is contained in:
@@ -2,18 +2,18 @@
|
|||||||
<view class="invite">
|
<view class="invite">
|
||||||
<view class="search">
|
<view class="search">
|
||||||
<u--input class="search-input" placeholder="搜索" border="none" prefixIcon="search" v-model="searchTxt"
|
<u--input class="search-input" placeholder="搜索" border="none" prefixIcon="search" v-model="searchTxt"
|
||||||
disabledColor="#Fff" prefixIconStyle="font-size: 22px;color: #909399" />
|
disabledColor="#Fff" prefixIconStyle="font-size: 22px;color: #909399" @change="onSearch" />
|
||||||
</view>
|
</view>
|
||||||
<block v-if="friends.length > 0">
|
<block v-if="friends.length > 0">
|
||||||
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
||||||
<u-checkbox-group v-if="friends.length > 0" v-model="checkboxValue" placement="column">
|
<u-checkbox-group v-if="friends.length > 0" v-model="checkboxValue" placement="column">
|
||||||
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
||||||
<u-index-anchor :text="indexs[fkey]" bgColor="#ededed" height="20" size="12" color="#666"
|
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#ededed" height="20" size="12"
|
||||||
style="padding:10rpx 30rpx" />
|
color="#666" style="padding:10rpx 30rpx" />
|
||||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
||||||
@click="addContact(friendItem.targetId)">
|
@click="addContact(friendItem.targetId)">
|
||||||
<u-checkbox :name="friendItem.targetId" shape="square" activeColor="#34ce98"
|
<u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98"
|
||||||
style="margin-right: 20rpx;" />
|
style="margin-right: 20rpx;" :disabled="canSelect(friendItem.targetId)" />
|
||||||
<u-avatar class="avatar-img" size="40" shape="square"
|
<u-avatar class="avatar-img" size="40" shape="square"
|
||||||
:src="contact(friendItem.targetId).portraitUrl" />
|
:src="contact(friendItem.targetId).portraitUrl" />
|
||||||
<view class="info">
|
<view class="info">
|
||||||
@@ -43,6 +43,8 @@
|
|||||||
inviteGroupUser,
|
inviteGroupUser,
|
||||||
getGroupUsers
|
getGroupUsers
|
||||||
} from '@/apis/interfaces/im';
|
} from '@/apis/interfaces/im';
|
||||||
|
import utils from '@/utils/index.js'
|
||||||
|
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -51,9 +53,11 @@
|
|||||||
searchTxt: '',
|
searchTxt: '',
|
||||||
targetId: '',
|
targetId: '',
|
||||||
indexs: [],
|
indexs: [],
|
||||||
|
orignalIndexs: [],
|
||||||
friends: [],
|
friends: [],
|
||||||
|
orignalFriends: [],
|
||||||
checkboxValue: [],
|
checkboxValue: [],
|
||||||
selectValue:[]
|
selectValue: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -68,15 +72,44 @@
|
|||||||
this.getFriendList()
|
this.getFriendList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onSearch(val) {
|
||||||
|
if (val) {
|
||||||
|
var ix = []
|
||||||
|
this.friends = this.orignalFriends.map((list, index) => {
|
||||||
|
const resList = list.filter(item => item.name.indexOf(val) > 0)
|
||||||
|
if (resList.length > 0) {
|
||||||
|
this.indexs.filter((t, i) => i == index)
|
||||||
|
}
|
||||||
|
// if (resList.length > 0) {
|
||||||
|
// ix = this.orignalIndexs.map((t, i) => {
|
||||||
|
// if (i == index) {
|
||||||
|
// return t
|
||||||
|
// }
|
||||||
|
// }).filter(Boolean)
|
||||||
|
// }
|
||||||
|
return resList
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log( this.indexs);
|
||||||
|
} else {
|
||||||
|
this.friends = this.orignalFriends
|
||||||
|
this.indexs = this.orignalIndexs
|
||||||
|
}
|
||||||
|
},
|
||||||
|
canSelect(targetId) {
|
||||||
|
return utils.inArray(targetId, this.selectValue)
|
||||||
|
},
|
||||||
getFriendList() {
|
getFriendList() {
|
||||||
getFriendsLetter().then(res => {
|
getFriendsLetter().then(res => {
|
||||||
this.indexs = res.indexList
|
this.indexs = res.indexList
|
||||||
this.friends = res.itemArr
|
this.friends = res.itemArr
|
||||||
|
this.orignalFriends = res.itemArr
|
||||||
|
this.orignalIndexs = res.indexList
|
||||||
})
|
})
|
||||||
getGroupUsers(this.targetId).then(res => {
|
getGroupUsers(this.targetId).then(res => {
|
||||||
res.map(res => {
|
res.map(res => {
|
||||||
this.checkboxValue.push(res.targetId + "")
|
this.checkboxValue.push(String(res.targetId))
|
||||||
this.selectValue.push(res.targetId+"")
|
this.selectValue.push(String(res.targetId))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -91,7 +124,7 @@
|
|||||||
},
|
},
|
||||||
onInvite() {
|
onInvite() {
|
||||||
inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
|
inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
|
||||||
console.log(res,'res')
|
console.log(res, 'res')
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
animationType: 'pop-out',
|
animationType: 'pop-out',
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ export const timeCustomCN = (val) => {
|
|||||||
// 判断是否属于今天,计算时分
|
// 判断是否属于今天,计算时分
|
||||||
let difftime = (currentDate - valDate) / 1000;
|
let difftime = (currentDate - valDate) / 1000;
|
||||||
if (currentYear === valYear && currentMonth === valMonth && currentD === valD) {
|
if (currentYear === valYear && currentMonth === valMonth && currentD === valD) {
|
||||||
let minute = parseInt(difftime % 3600 / 60);
|
if (difftime < 3600) {
|
||||||
if (minute <= 60) {
|
let minute = parseInt(difftime % 3600 / 60);
|
||||||
return minute === 0 ? '刚刚' : minute + '分钟前';
|
return minute === 0 ? '刚刚' : minute + '分钟前';
|
||||||
} else {
|
} else {
|
||||||
return (minute * 60).toFixed(0) + '小时前';
|
return (difftime / 3600).toFixed(0) + '小时前';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 计算天
|
// 计算天
|
||||||
@@ -37,7 +37,6 @@ export const timeCustomCN = (val) => {
|
|||||||
let days = Math.abs(currentDate.getTime() - valDate.getTime()) / (1000 * 60 * 60 * 24);
|
let days = Math.abs(currentDate.getTime() - valDate.getTime()) / (1000 * 60 * 60 * 24);
|
||||||
return Math.ceil(days) + '天前';
|
return Math.ceil(days) + '天前';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user