registrationReview.vue
9.9 KB
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<template>
<view class="registration_review">
<view class="search_box">
<view class="check">
<u-checkbox-group v-model="checkboxValue" placement="column" @change="checkboxChange">
<u-checkbox :customStyle="{marginBottom: '8px'}" shape="circle"
v-for="(item, index) in checkboxList" :key="index" :label="item.name" :name="item.name"
activeColor="#06B079" size="28rpx" labelSize="28rpx" labelColor="#202131">
</u-checkbox>
</u-checkbox-group>
</view>
<view class="search">
<u-search placeholder="请输入学生姓名/学号/手机号" placeholderColor="#C1C1C9" searchIconSize="36" height="64rpx"
bgColor="#F4F4F4" :showAction="false" shape="square" v-model="keyword" @search="handelSearch"></u-search>
</view>
<u-icon slot="icon" size="32" :name="'/static/img/home/筛选icon@2x.png'" @click="show = true"></u-icon>
</view>
<view class="list_box" v-if="list.length > 0">
<view class="item" v-for="(item, i) in list" :key="i" @click="handelDetail(item)">
<view class="bg_image" v-if="item.status == 'wait'">
<u-image src="/static/img/home/标签背景-绿@2x.png" width="142rpx" height="48rpx"></u-image>
<text>待审核</text>
</view>
<view class="bg_image" v-else>
<u-image src="/static/img/home/标签背景-灰@2x.png" width="142rpx" height="48rpx"></u-image>
<text>已通过</text>
</view>
<view class="name">{{item.name}}</view>
<view class="company">
<u-icon size="32rpx" name="/static/img/home/实习单位icon@2x.png"></u-icon>
<text>实习单位</text>
<text>{{item.companyName || '--'}}</text>
</view>
<view class="company position">
<u-icon size="32rpx" name="/static/img/home/实习岗位icon@2x.png"></u-icon>
<text>实习岗位</text>
<text>{{item.jobName|| '--'}}</text>
</view>
<view class="time">
<text>申请时间</text>
<text>{{timeFormat(item.applyTime, 'yyyy-mm-dd hh:MM')}}</text>
</view>
</view>
<c-loading :loading="loading"></c-loading>
</view>
<view v-else class="no_data">
<c-no-data></c-no-data>
</view>
<u-popup :show="show" mode="right" @close="close" @open="open">
<view class="popup_search">
<view class="content">
<view class="title">按项目筛选</view>
<scroll-view class="scroll" scroll-y="true">
<view class="item" v-for="(item, i) in projectList" :key="i" @click="handelClick(item)">
<view :style="{backgroundColor: '#06B079',color: '#FFFFFF'}" v-if="item.id == projectId">
<text>{{item.name}}</text>
</view>
<view v-else>
<text>{{item.name}}</text>
</view>
</view>
</scroll-view>
<view class="switch">
<text>未审核</text>
<u-switch v-model="switchValue" size="48" activeColor="#06B079" @change="handelChange">
</u-switch>
</view>
</view>
<view class="footer">
<view class="left_btn">
<c-button type="cancel" text="重置" @click="handelCancel">
</c-button>
</view>
<view class="right_btn">
<c-button type="confirm" text="确定" @click="hancelSubmit">
</c-button>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
mapGetters,
mapState,
mapActions
} from 'vuex'
import listMixin from "@/common/mixins/list-mixin.js";
import {
getRegistrationReviewApi,
getProjectListApi,
} from '@/config/api.js';
export default {
mixins: [listMixin],
data() {
return {
checkboxValue: [],
// 基本案列数据
checkboxList: [{
name: '待审核',
disabled: false
}],
keyword: '',
show: false,
list: [], //列表必须为key list的数组
search: {
//搜索对象必须为key search的对象
keySearch: "",
status: 'wait,pass,reject',
},
projectId: '',
switchValue: false,
}
},
onLoad() {},
onShow() {
this.$store.dispatch(`home/getProjectList`, {
pageSize: -1,
})
this.search.keySearch = '';
this.finished = false;
this.loading = "loadmore";
this.page = 0;
this.list = [];
this._getList();
},
computed: {
...mapState('home', {
// 箭头函数可使代码更简练
projectList: 'projectList',
}),
},
methods: {
handelDetail(record) {
this.$u.route({
url: `pages/main/home/registrationDetail/registrationDetail?&id=${record.id}`
})
},
timeFormat(timestamp, format = 'yyyy-mm-dd') {
return timestamp > 0 ? uni.$u.timeFormat(timestamp, format) : '--'
},
checkboxChange(n) {
console.log('change', n);
this.search.status = n.length > 0 ? 'wait' : 'wait,pass,reject';
this.switchValue = n.length > 0 ? true : false;
this.finished = false;
this.loading = "loadmore";
this.page = 0;
this.list = [];
this._getList();
},
handelSearch(value) {
this.finished = false;
this.loading = "loadmore";
this.page = 0;
this.list = [];
this._getList();
},
open() {
// console.log('open');
},
close() {
this.show = false
// console.log('close');
},
// scroll-view到底部加载更多
onreachBottom() {},
// 搜索
searchSubmit() {
// 调用混合搜索
this._searchData();
},
// 模拟后端分页
async getData(requestParams) {
const {
search = {}
} = requestParams;
let params = {};
params.pageNumber = requestParams.page + 1;
params.pageSize = 5;
if (search.status) {
params.status = search.status;
}
if (this.keyword) {
params.keySearch = this.keyword
}
if (this.projectId) {
params.projectId = this.projectId
}
return await getRegistrationReviewApi(params);
},
// 数据请求(没错就是这么少的代码)
async _getList() {
if (this.page == 0) {
this.list = [];
}
// 根据实际情况修改自己修改key
let result = await this.getData({
page: this.page, // 传入页码
size: this.size, // 传入每页条数
search: this.search, // 传入搜索的对象
});
this.total = result.total;
if (this.list.length == 0 && result.records.length == 0) {
this.shownoData = false
} else {
this.shownoData = true
}
this.list = this.list.concat(result.records)
},
handelClick(values) {
console.log(values);
this.projectId = values.id;
},
handelChange(e) {
console.log(e)
this.checkboxValue = e ? ['待审核'] : [];
this.search.status = e ? 'wait' : 'wait,pass,reject';
},
handelCancel() {
this.switchValue = false;
this.projectId = '';
},
hancelSubmit() {
this.finished = false;
this.loading = "loadmore";
this.page = 0;
this.list = [];
this._getList();
this.show = false;
},
}
}
</script>
<style lang="scss" scoped>
.registration_review {
width: 100%;
min-height: 100%;
height: auto;
background-color: #F7F7F7;
.search_box {
padding: 36rpx 30rpx 12rpx;
background-color: #FFFFFF;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
.check {
padding: 20rpx 0 0 0;
}
.search {
width: 468rpx;
}
}
.list_box {
padding: 0 0 50rpx 0;
.item {
position: relative;
width: 630rpx;
margin: 30rpx auto;
padding: 30rpx;
border-radius: 12rpx;
background-color: #FFFFFF;
.bg_image {
position: absolute;
top: 0;
right: 0;
text {
position: absolute;
top: 12rpx;
right: 30rpx;
font-size: 24rpx;
line-height: 24rpx;
color: #FFFFFF;
}
}
.name {
font-size: 32rpx;
line-height: 44rpx;
color: #202131;
font-weight: 500;
margin: 0 0 30rpx 0;
}
.company {
display: flex;
flex-flow: row nowrap;
margin: 0 0 30rpx 0;
text {
font-size: 28rpx;
line-height: 32rpx;
color: #909097;
margin: 0 0 0 16rpx;
}
text:last-child {
color: #202131;
margin: 0 0 0 30rpx;
}
}
.time {
border-top: 2rpx solid #E2E2E8;
padding: 28rpx 0 0 0;
text {
font-size: 28rpx;
line-height: 32rpx;
color: #909097;
}
text:last-child {
color: #202131;
margin: 0 0 0 78rpx;
}
}
}
}
.popup_search {
width: 640rpx;
position: relative;
.content {
padding: 0 40rpx;
.title {
padding: 24rpx 0;
font-size: 28rpx;
line-height: 36rpx;
color: #202131;
}
.scroll {
max-height: 60vh;
.item {
width: 540rpx;
height: 96rpx;
border-radius: 4rpx;
border: 2rpx solid #C1C1C9;
margin: 0 10rpx 20rpx;
font-size: 24rpx;
line-height: 32rpx;
color: #C0C0C9;
display: flex;
flex-flow: row wrap;
align-items: center;
text {
display: inline-block;
width: 500rpx;
height: 64rpx;
padding: 16rpx 20rpx;
}
}
}
.switch {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
padding: 40rpx 0 0 0;
text {
font-size: 28rpx;
line-height: 36rpx;
color: #202131;
}
}
}
.footer {
width: 560rpx;
height: 96rpx;
padding: 28rpx 40rpx;
background: #FFFFFF;
position: fixed;
bottom: 0;
right: 0;
z-index: 99;
border-top: 2rpx solid #E2E2E8;
view {
display: inline-block;
}
.left_btn {
width: 194rpx;
margin: 0 20rpx 0 0;
}
.right_btn {
width: 346rpx;
}
}
}
}
</style>