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