智慧保安互联网APP
zengh
2022-06-21 4efeb31d5b4921d7e851c256009486ad86bc70e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<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>