<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-search style="z-index: 9999;" :show-action="true" @custom="search" @search="search" :clearabled="true" placeholder="请输入姓名或手机号" action-text="搜索" :animation="true"></u-search>
|
<!-- <image class="friendEmpty" src="../../static/wjg.png"></image> -->
|
<view v-if="fempty" class="friendEmpty">
|
<u-empty text="无搜索结果" mode="list"></u-empty>
|
</view>
|
<view class="requestr" v-for="(item, index) in requestList" :key="index">
|
<view class="request-top">
|
<view 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.phone}}</view>
|
</view>
|
|
<view class="notic">
|
<text>留言:</text>
|
<u-input placeholder="请输入留言" v-model="item.bz"/>
|
</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) {
|
},
|
data() {
|
return {
|
requestList: [],
|
fempty:false,
|
fvalue:"",
|
};
|
},
|
|
methods: {
|
// 返回键
|
backOne() {
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
_FriendRequest() {
|
this.requestList = datas.firendsRequest()
|
},
|
aggree(item) {
|
var that = this;
|
var date = that.currTime();
|
uni.request({
|
url: this.$store.state.piAPI + "/friend/submit",
|
method: "POST",
|
data: {
|
applicant:WxStorage.get("ids"),
|
type: 0,
|
friend:item.friendid,
|
bz:item.bz,
|
time:date
|
},
|
success: (res) => {
|
uni.showToast({
|
title: '申请成功',
|
icon: "none",
|
duration: 1000
|
});
|
}
|
});
|
},
|
currTime(){
|
var date = new Date();
|
var Y = date.getFullYear() + '-';
|
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
|
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
|
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
|
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
|
var s = (date.getSeconds() < 10 ? '0' + date.getSeconds(): date.getSeconds());
|
return Y + M + D + h + m + s;
|
},
|
search(value){
|
var that = this;
|
uni.request({
|
url: this.$store.state.piAPI + "/friend/addFriend",
|
method: "GET",
|
data: {
|
applicant: value,
|
},
|
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";
|
}
|
}
|
that.requestList = resdata;
|
if(resdata.length == 0){
|
that.fempty = true;
|
}else{
|
that.fempty = false;
|
}
|
}
|
});
|
},
|
|
},
|
filters: {
|
date(time) {
|
return filter.date(time)
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '../../common/style/common.scss';
|
|
.friendEmpty {
|
width: 200upx;
|
height: 200upx;
|
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, 255, 255, 0.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>
|