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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<template>
    <view class="activity-container" :data-theme='theme()' :class="theme() || ''">
        <view class="top-box">
            <view class="index-search-box index-search-box_re d-b-c" id="searchBox">
                <view class="index-search index-search_re t-c flex-1">
                    <text class="icon iconfont icon-sousuo"></text>
                    <input type="text" v-model="keyword" class="flex-1 ml10 f26 gray3" value="" placeholder-class="f26 gray9"
                     placeholder="输入用户昵称/姓名/手机号进行搜索" confirm-type="search" @confirm="searchFunc()" />
                </view>
            </view>
            <view class="inner-tab">
                <view :class="type_active==-1?'item active':'item'" @click="tabTypeFunc(-1)">
                    <view class="box">全部</view>
                </view>
                <view :class="type_active==1?'item active':'item'" @click="tabTypeFunc(1)">
                    <view class="box">已签到</view>
                </view>
                <view :class="type_active==0?'item active':'item'" @click="tabTypeFunc(0)">
                    <view class="box">未签到</view>
                </view>
            </view>
        </view>
        <!--列表-->
        <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50"
         @scrolltolower="scrolltolowerFunc">
            <view class="user-box p-0-20">
                <view class="item bg-white radius24 mt20" v-for="(item,index) in listData" :key="index">
                    <view class="d-b-c">
                        <view class="avatar">
                            <image :src="item.avatarUrl" mode="aspectFill"></image>
                        </view>
                        <view class="flex-1 ml20 f24">
                            <view class="d-b-c mb16 f28 gray3">{{ item.nickName }}</view>
                            <view class="d-b-c mb16 f28 gray3">姓名:{{ item.real_name }}</view>
                            <view class="d-b-c mb16 f28 gray3">手机号:{{ item.mobile }}</view>
                            <view class="d-b-c mb16 f28 gray3">邀请人:{{ item.recommend_name }}</view>
                            <view class="d-b-c mb16 f28 gray3">所属分会:{{ item.branch.name }}</view>
                            <view class="gray9">报名时间:{{ item.create_time }}</view>
                        </view>
                        <view class="f26">
                            <text class="gray3" v-if="item.is_verify==1">已签到</text>
                            <text class="red" v-else>未签到</text>
                        </view>
                    </view>
                </view>
                <!-- 没有记录 -->
                <view class="none-data-box" v-if="listData.length==0 && !loading">
                    <image :src="remoteImg('no_thing')" mode="widthFix"></image>
                    <text>暂无数据</text>
                </view>
                <uni-load-more v-else :loadingType="loadingType"></uni-load-more>
            </view>
        </scroll-view>
 
    </view>
</template>
 
<script>
    import uniLoadMore from "@/components/uni-load-more.vue";
    export default {
        components: {
            uniLoadMore
        },
        data() {
            return {
                /*手机高度*/
                phoneHeight: 0,
                /*可滚动视图区域高度*/
                scrollviewHigh: 0,
                /*状态选中*/
                type_active: -1,
                /*数据列表*/
                listData: [],
                page: 1,
                no_more: false,
                list_rows: 15,
                loading: true,
                activity_id: '',
                keyword: '', // 搜索关键词
            }
        },
        computed: {
            /*加载中状态*/
            loadingType() {
                if (this.loading) {
                    return 1;
                } else {
                    if (this.listData.length != 0 && this.no_more) {
                        return 2;
                    } else {
                        return 0;
                    }
                }
            }
        },
        onLoad(e) {
            this.activity_id = e.activity_id;
        },
        mounted() {
            /*初始化*/
            this.init();
            /*获取数据*/
            this.getData();
        },
        methods: {
            /*初始化*/
            init() {
                let self = this;
                uni.getSystemInfo({
                    success(res) {
                        self.phoneHeight = res.windowHeight;
                        // 计算组件的高度
                        let view = uni.createSelectorQuery().select('.top-box');
                        view.boundingClientRect(data => {
                            let h = self.phoneHeight - data.height;
                            self.scrollviewHigh = h;
                        }).exec();
                    }
                });
            },
            
            /*获取数据*/
            getData() {
                let self = this;
                uni.showLoading({
                    title: '加载中'
                });
                let params = {
                    activity_id: self.activity_id,
                    verify_status: self.type_active,
                    keyword: self.keyword,
                    list_rows: self.list_rows,
                    page: self.page
                };
                self.loading = true;
                self._get('branch.admin.activityUser/lists', params, function(res) {
                    self.listData = self.listData.concat(res.data.list.data);
                    self.last_page = res.data.list.last_page;
                    if (self.last_page <= 1) {
                        self.no_more = true;
                    }
                    uni.hideLoading();
                    self.loading = false;
                });
            },
            
            searchFunc() {
                this.listData = [];
                this.page = 1;
                /*获取列表*/
                this.getData();
            },
 
            /*类别切换*/
            tabTypeFunc(e) {
                let self = this;
                self.listData = [];
                self.page = 1;
                self.no_more = false;
                self.loading = true;
                self.type_active = e;
                self.getData();
            },
 
            /*可滚动视图区域到底触发*/
            scrolltolowerFunc() {
                let self = this;
                if (self.no_more) {
                    return;
                }
                self.page++;
                if (self.page <= self.last_page) {
                    self.getData();
                } else {
                    self.no_more = true;
                }
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .top-box {
        .inner-tab {
            position: relative;
            height: 70rpx;
            display: flex;
            justify-content: space-around;
            align-items: center;
            background: #ffffff;
            z-index: 9;
            .item {
                flex: 1;
                height: 100%;
                line-height: 70rpx;
                position: relative;
                color: #999;
                font-size: 28rpx;
                &.active {
                    color: #333333;
                    font-weight: bold;
                    &::after {
                        content: '';
                        width: 72rpx;
                        height: 4rpx;
                        background: #EE1414;
                        border-radius: 2rpx;
                        position: absolute;
                        bottom: 14rpx;
                        left: 0;
                        right: 0;
                        margin: auto;
                    }
                }
                .box {
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    flex-direction: row;
                }
            }
        }
        .top-add {
            @include background_color('background_color');
            height: 60rpx;
            border-radius: 80rpx;
            color: #ffffff;
            padding: 0 20rpx;
            margin-left: 30rpx;
            
            .iconfont {
                color: #ffffff;
            }
        }
    }
    
    .user-box {
        
        .item {
            padding: 20rpx;
        }
        .avatar {
            
            image {
                width: 80rpx;
                height: 80rpx;
                border-radius: 80rpx;
            }
        }
    }
</style>