104 lines
3.4 KiB
Vue
104 lines
3.4 KiB
Vue
<!--
|
|
* @Description:新朋友即新增好友申请列表 可以搜索跳转
|
|
* @Author: Aimee·Zhang
|
|
* @Date: 2022-01-24 10:49:15
|
|
* @LastEditors: Aimee·Zhang
|
|
* @LastEditTime: 2022-01-25 10:18:26
|
|
-->
|
|
|
|
<template>
|
|
<view class="pending">
|
|
<u-sticky>
|
|
<view class="header-search" @click="$Router.push({ name: 'SearchFriend' })">
|
|
<u-search placeholder="输入手机号码搜索" height="74" searchIcon="search" inputAlign="center" bgColor="white"
|
|
:disabled="true" :show-action="false" />
|
|
</view>
|
|
</u-sticky>
|
|
<block v-if="pedings.length > 0">
|
|
<applyFriend :lists="pedings" :isAgree="true" :isReject="false" @action="action" />
|
|
</block>
|
|
<view class="no-lists" v-else>
|
|
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
|
:src="require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
|
<span>暂无申请记录~</span>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getPedings,
|
|
resolveFriend,
|
|
rejectFriend
|
|
} from '@/apis/interfaces/im.js'
|
|
import * as RongIMLib from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
|
import applyFriend from '@/components/friend-apply-reject-agree'
|
|
|
|
export default {
|
|
components: {
|
|
applyFriend
|
|
},
|
|
data() {
|
|
return {
|
|
pedings: []
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getPeddingList()
|
|
},
|
|
methods: {
|
|
// 操作同意或拒绝
|
|
action(e) {
|
|
let url = e.type === 'agree' ? resolveFriend : rejectFriend
|
|
uni.showModal({
|
|
title: e.type === 'agree' ? '通过' : '拒绝',
|
|
content: e.type === 'agree' ? '通过后即可与该用户畅所欲言' : '拒绝后将不会收到该用户发来信息',
|
|
success: res => {
|
|
if (res.confirm) {
|
|
url(e.item.userId).then(res => {
|
|
this.getPeddingList()
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
getPeddingList() {
|
|
// 获取系统中的好友关系会话列表
|
|
// RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], 50, 0, (res) => {
|
|
// if (res.code === 0) {
|
|
// this.pedings = res.conversations.filter((item) => {
|
|
// return item.objectName == RongIMLib.ObjectName.ContactNotification
|
|
// })
|
|
// }
|
|
// })
|
|
getPedings().then(res => {
|
|
console.log(res)
|
|
this.pedings = res
|
|
})
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.header-search {
|
|
padding: $padding/2 $padding;
|
|
background: $window-color;
|
|
}
|
|
|
|
.no-lists {
|
|
padding-top: $padding * 3;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-sizing: border-box;
|
|
font-size: $title-size-m;
|
|
color: $text-gray-m;
|
|
|
|
span {
|
|
padding-top: $padding;
|
|
}
|
|
}
|
|
</style>
|