This commit is contained in:
2022-02-18 14:39:44 +08:00
parent ffae45097f
commit e77a81e38e
3 changed files with 101 additions and 94 deletions

View File

@@ -84,15 +84,10 @@
onLoad(e) { onLoad(e) {
this.targetId = e.targetId this.targetId = e.targetId
this.qrContent += e.targetId this.qrContent += e.targetId
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({ RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({status}) => {
status
}) => {
this.status = !Boolean(status) this.status = !Boolean(status)
}) })
RongIMLib.getConversation(this.conversationType, this.targetId, ({ RongIMLib.getConversation(this.conversationType, this.targetId, ({code,conversation}) => {
code,
conversation
}) => {
if (code == 0) { if (code == 0) {
this.isTop = conversation.isTop this.isTop = conversation.isTop
} }

View File

@@ -1,74 +1,59 @@
<template> <template>
<view> <view class="invite">
<!-- <u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98"> <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" /> </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-checkbox-group v-model="checkboxValue" placement="column" @change="checkboxChange"> <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]" bgColor="#ededed" height="20" size="12" color="#666"
style="padding:10rpx 30rpx" /> 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="selectFriend(friendItem.targetId)"> @click="addContact(friendItem.targetId)">
<u-checkbox :customStyle="{marginBottom: '8px'}" :name="friendItem.targetId" /> <u-checkbox :name="friendItem.targetId" shape="square" activeColor="#34ce98"
<u-avatar class="avatar-img" size="40" shape="square" :src="contact(friendItem.targetId).portraitUrl" /> style="margin-right: 20rpx;" />
<u-avatar class="avatar-img" size="40" shape="square"
:src="contact(friendItem.targetId).portraitUrl" />
<view class="info"> <view class="info">
<view class="name">{{ contact(friendItem.targetId).name }}</view> <view class="name">{{ contact(friendItem.targetId).name }}</view>
<!-- <view class="address">Hash:{{ friendItem.address }}</view> -->
</view> </view>
</view> </view>
</u-index-item> </u-index-item>
</u-checkbox-group> </u-checkbox-group>
</block> </u-index-list>
<view class="no-lists" v-else> <view class="bottom">
<u-image class="cover" radius="4" width="400rpx" height="400rpx" <span class="onInvite" @click="onInvite">完成<span>{{`(${checkboxValue.length})` || ''}}</span></span>
:src="searchTxt=== '' ? require('@/static/imgs/no-friend.png') :require('@/static/imgs/no-search.png')" </view>
:lazy-load="true" /> </block>
<span>{{searchTxt=== ''?'暂无好友列表~':'暂无搜索内容~'}}</span> <view class="no-lists" v-else>
</view> --> <u-image class="cover" radius="4" width="400rpx" height="400rpx"
<button type="default" @click="onInvite">确定</button> :src="searchTxt=== '' ? require('@/static/imgs/no-friend.png') :require('@/static/imgs/no-search.png')"
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98"> :lazy-load="true" />
<u-checkbox-group v-if="friends.length > 0" v-model="checkboxValue" placement="column"> <span>{{searchTxt=== ''?'暂无好友列表~':'暂无搜索内容~'}}</span>
<u-index-item v-for="(item, fkey) in friends" :key="fkey"> </view>
<u-index-anchor :text="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="circle" />
<u-avatar class="avatar-img" size="40" shape="square"
:src="contact(friendItem.targetId).portraitUrl" />
<view class="info">
<view class="name">{{ contact(friendItem.targetId).name }}</view>
<!-- <view class="address">Hash:{{ friendItem.address }}</view> -->
</view>
</view>
</u-index-item>
</u-checkbox-group>
</u-index-list>
</view> </view>
</template> </template>
<script> <script>
import { import {
getFriendsLetter, getFriendsLetter,
inviteGroupUser inviteGroupUser,
getGroupUsers
} from '@/apis/interfaces/im'; } from '@/apis/interfaces/im';
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 {
data() { data() {
return { return {
// indexs: [], searchTxt: '',
// friends: [], targetId: '',
// pendingCount: 0,
// searchTxt: '',
// checkboxValue: [],
targetId: '',
indexs: [], indexs: [],
friends: [], friends: [],
checkboxValue: [] checkboxValue: [],
selectValue:[]
}; };
}, },
computed: { computed: {
@@ -78,19 +63,6 @@
} }
} }
}, },
// onLoad() {
// this.getFriendList()
// this.checkNewFriendPending()
// uni.$on('onContactNotification', this.checkNewFriendPending)
// },
// methods: {
// // group事件
// checkboxChange(n) {
// console.log('change', n);
// },
// getFriendList() {
// getFriendsLetter().then(res => {
// console.log(res)
onLoad(e) { onLoad(e) {
this.targetId = e.targetId this.targetId = e.targetId
this.getFriendList() this.getFriendList()
@@ -101,34 +73,30 @@
this.indexs = res.indexList this.indexs = res.indexList
this.friends = res.itemArr this.friends = res.itemArr
}) })
getGroupUsers(this.targetId).then(res => {
res.map(res => {
this.checkboxValue.push(res.targetId + "")
this.selectValue.push(res.targetId+"")
})
})
}, },
// 点击名字新增或删除选中数据
// selectFriend(targetId) {
// console.log(targetId,typeof targetId)
// let arr = this.checkboxValue
// let index = arr.findIndex(item => item === targetId)
// if(index>0){
// console.log('选择了再次点击清除数据le')
// }else{
// console.log('没有选择过,添加数据')
// }
// console.log(this.checkboxValue,index)
// console.log('奥克兰打开',targetId)
// },
addContact(targetId) { addContact(targetId) {
if (!this.checkboxValue.find(item => item == targetId)) { const index = this.checkboxValue.findIndex(item => item == targetId)
if (index === -1) {
this.checkboxValue.push(targetId) this.checkboxValue.push(targetId)
} else { } else {
const index = this.checkboxValue.findIndex(item => item == targetId) this.checkboxValue.splice(index, 1)
this.checkboxValue = this.checkboxValue.splice(index, 1)
} }
}, },
onInvite() { onInvite() {
inviteGroupUser(this.targetId, this.checkboxValue).then(res => { inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
uni.navigateBack() console.log(res,'res')
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 200
});
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@@ -198,18 +166,61 @@
background-color: #fff; background-color: #fff;
} }
.search { .invite {
background-color: #fff; position: relative;
padding: 30rpx; padding: 100rpx 0;
box-sizing: border-box;
z-index: 0;
.search-input { .bottom {
padding: 10rpx $padding; position: fixed;
bottom: 0;
width: 100%; width: 100%;
height: 120rpx;
background-color: $window-color;
z-index: 100;
color: #fff;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
padding-right: 30rpx;
padding-bottom: 10rpx;
.onInvite {
background-color: $main-color;
font-size: $title-size;
display: inline-block;
padding: 10rpx 30rpx;
border-radius: 10rpx;
span {
font-size: $title-size - 2;
}
}
} }
.searchTxt {} .search {
background-color: #fff;
padding: 30rpx;
position: fixed;
width: 100%;
box-sizing: border-box;
top: 0;
z-index: 100;
.search-input {
padding: 10rpx $padding;
width: 100%;
}
.searchTxt {}
}
} }
.no-lists { .no-lists {
padding-top: $padding * 3; padding-top: $padding * 3;
display: flex; display: flex;

View File

@@ -4,10 +4,10 @@
<view class="reviewed-item"> <view class="reviewed-item">
<u-avatar class="avatar" src="require('@/static/user/cover.png')" shape="square" size="36" /> <u-avatar class="avatar" src="require('@/static/user/cover.png')" shape="square" size="36" />
<view style="flex:1;"> <view style="flex:1;">
<view class="nickname"><span>{{`艾米的猫儿 `}}</span>想邀请<span>{{` 艾米的猫儿洛基艾米`}}</span>加入群聊</view> <view class="nickname"><span>{{`艾米的猫儿 `}}</span>想邀请<span>{{` 用户8066`}}</span>加入群聊</view>
<view> 申请原因{{`呵呵哒。。`}}</view> <view> 申请原因{{`呵呵哒。。`}}</view>
</view> </view>
<view class="sure" @click="sure(2)"> 去确认 </view> <view class="sure" @click="sure(2)"> 通过 </view>
</view> </view>
</view> </view>
</template> </template>
@@ -60,6 +60,7 @@
span { span {
color: $text-color; color: $text-color;
font-size: $title-size-m +1;
} }
} }