<template>
|
<view class="container">
|
|
<u-navbar style="position: relative;" :is-fixed="false" :border-bottom="true" :is-back="true"
|
title="好友申请" back-icon-color="#fff" :background="{ background: '#0BB9C8' }" title-color="#fff">
|
|
</u-navbar>
|
|
<view class="main">
|
<u-empty class="friendEmpty" v-if="requestList.length == 0" text="暂无好友申请" mode="list"></u-empty>
|
<view class="requestr" v-for="(item, index) in requestList" :key="index">
|
|
<view class="request-top">
|
<view @click="reject(item)" class="reject btn">拒绝</view>
|
<view class="header-img">
|
<image :src="item.avatar" mode="" class="header-img" />
|
</view>
|
<view @click="aggree(item)" class="aggree btn">同意</view>
|
</view>
|
|
<view class="request-center">
|
<view class="title">{{ item.realName }}</view>
|
<view class="time">{{ item.time | date }}</view>
|
</view>
|
|
<view class="notic">
|
<text>留言:</text>
|
<text>{{ item.bz }}</text>
|
</view>
|
</view>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import datas from '@/debugdate/debugdate.js'
|
import filter from '@/config/filter.js'
|
import WxStorage from "../../static/lib/wxStorage.js"
|
export default {
|
onLoad(option) {
|
this.friendApplication();
|
},
|
data() {
|
return {
|
requestList: []
|
};
|
},
|
|
methods: {
|
// 返回键
|
backOne() {
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
_FriendRequest() {
|
this.requestList = datas.firendsRequest()
|
},
|
friendApplication() {
|
//获取所有好友申请
|
uni.request({
|
url: this.$store.state.piAPI + "/friend/friendApplication",
|
method: "GET",
|
data: {
|
applicant: WxStorage.get("ids")
|
},
|
success: (res) => {
|
var resdata = res.data.data.records;
|
for (var i = 0; i < resdata.length; i++) {
|
if (resdata[i].avatar == null || resdata[i].avatar == "") {
|
resdata[i].avatar = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20191109%2F1d3d4d82715444c4b8284f65e3feed10.jpeg&refer=http%3A%2F%2F5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1632484198&t=1f4086a5894cbf83b311fa37c276405c";
|
}
|
}
|
this.requestList = resdata;
|
}
|
});
|
},
|
aggree(item) {
|
var that = this;
|
uni.request({
|
url: this.$store.state.piAPI + "/friend/submit",
|
method: "POST",
|
data: {
|
id: item.id,
|
type: 1
|
},
|
success: (res) => {
|
uni.showToast({
|
title: '操作成功',
|
icon: "none",
|
duration: 1000
|
});
|
that.friendApplication();
|
}
|
});
|
},
|
reject(item) {
|
var that = this;
|
uni.request({
|
url: this.$store.state.piAPI + "/friend/submit",
|
method: "POST",
|
data: {
|
id: item.id,
|
type: 2
|
},
|
success: (res) => {
|
uni.showToast({
|
title: '操作成功',
|
icon: "none",
|
duration: 1000
|
});
|
that.friendApplication();
|
}
|
});
|
}
|
},
|
filters: {
|
date(time) {
|
return filter.date(time)
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '../../common/style/common.scss';
|
|
.friendEmpty {
|
position: absolute;
|
margin: auto;
|
top: 0;
|
left: 0;
|
bottom: 0;
|
right: 0;
|
}
|
|
.main {
|
padding: 16rpx 32upx;
|
background: rgba(255, 255, 255, .6);
|
|
.requestr {
|
margin-top: 112rpx;
|
padding: 32upx;
|
background: rgba(255, 255, 255, 1);
|
border-radius: 20upx;
|
box-shadow: 0px 24rpx 64rpx -8rpx rgba(0, 0, 0, .1);
|
|
.request-top {
|
display: flex;
|
flex-direction: row;
|
|
.btn {
|
flex: none;
|
width: 160rpx;
|
height: 64rpx;
|
background: rgba(255, 93, 91, .1);
|
border-radius: 40rpx;
|
text-align: center;
|
font-size: 32upx;
|
font-weight: 400;
|
line-height: 64rpx;
|
}
|
|
.reject {
|
color: rgba(255, 93, 91, 1);
|
background-color: rgba(255, 93, 91, .1);
|
}
|
|
.aggree {
|
color: rgba(39, 40, 50, 1);
|
background-color: rgba(255, 228, 49, 1);
|
}
|
|
.header-img {
|
margin-top: -52rpx;
|
flex: auto;
|
text-align: center;
|
|
image {
|
width: 144rpx;
|
height: 144rpx;
|
border-radius: 50%;
|
}
|
}
|
|
}
|
|
.request-center {
|
text-align: center;
|
padding-top: 20rpx;
|
padding-bottom: 40rpx;
|
|
.title {
|
font-size: 36rpx;
|
font-weight: 500;
|
color: rgba(39, 40, 50, 1);
|
line-height: 50rpx;
|
}
|
|
.time {
|
font-size: 24upx;
|
color: rgba(39, 40, 50, 0.4);
|
line-height: 34rpx;
|
}
|
|
}
|
|
.notic {
|
font-size: 28upx;
|
color: rgba(39, 40, 50, 1);
|
line-height: 40rpx;
|
padding: 10px 32upx;
|
border-radius: 20upx;
|
background: rgba(243, 244, 246, 1);
|
}
|
}
|
|
}
|
</style>
|