84 lines
2.6 KiB
Vue
84 lines
2.6 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 applyFriend from '@/components/friend-apply-reject-agree';
|
|
export default {
|
|
components: {
|
|
applyFriend
|
|
},
|
|
data() {
|
|
return {
|
|
// pedings: [{userId:10990,name:'张三'}]
|
|
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() {
|
|
getPedings().then(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>
|