home.vue
11.1 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
<template>
<view class="home_box">
<view class="home">
<view class="bar"></view>
<view class="info" v-if="hasLogin">
<u-row justify="space-between" customStyle="margin-bottom: 24rpx">
<u-col span="5">
<view class="name">
<text>{{teacher.name}}</text>
<text>老师您好!</text>
</view>
</u-col>
<u-col span="3">
<view class="identity" @click="handelChange">
<u-icon size="36rpx" :label="doneRoles" labelPos="right" labelSize="24rpx"
labelColor="#202131" name="/static/img/home/切换身份@2x.png"></u-icon>
</view>
</u-col>
</u-row>
</view>
<view class="info" v-else>
<u-row justify="space-between" customStyle="margin-bottom: 24rpx">
<u-col span="5">
<view class="name" @click="handelLOgin">
<text>未登录</text>
<text>您还没有登录</text>
</view>
</u-col>
</u-row>
</view>
<view class="gate">
<u-row justify="space-between" gutter="16rpx" customStyle="margin-bottom: 10px">
<u-col span="4">
<view class="box">
<view class="item review" data-type="review" @click="handelGate">
<u-image src="/static/img/home/报名审核背景@2x.png" width="220rpx" height="256rpx" />
<view class="copywriting">
<text>报名审核</text>
<text>提供简单描述文字</text>
</view>
</view>
</view>
</u-col>
<u-col span="4">
<view class="box">
<view class="item signIn" :style="{marginBottom:'16rpx'}" data-type="signin"
@click="handelGate">
<u-image src="/static/img/home/学生签到背景@2x.png" width="220rpx" height="120rpx" />
<view>
<u-icon size="48rpx" label="学生签到" labelPos="right" labelSize="28rpx"
labelColor="#1F71DE" name="/static/img/home/icon-学生签到@2x.png"></u-icon>
<text>提供简单描述文字</text>
</view>
</view>
<view class="item report" data-type="report" @click="handelGate">
<u-image src="/static/img/home/报告审批背景@2x.png" width="220rpx" height="120rpx" />
<view>
<u-icon size="48rpx" label="报告审核" labelPos="right" labelSize="28rpx"
labelColor="#FD9A03" name="/static/img/home/icon-报名审批@2x.png"></u-icon>
<text>提供简单描述文字</text>
</view>
</view>
</view>
</u-col>
<u-col span="4">
<view class="box">
<view class="item signIn" :style="{marginBottom:'16rpx'}" data-type="log"
@click="handelGate">
<u-image src="/static/img/home/日志批阅背景@2x.png" width="220rpx" height="120rpx" />
<view>
<u-icon size="48rpx" label="日志批阅" labelPos="right" labelSize="28rpx"
labelColor="#7A7EF9" name="/static/img/home/icon-日志批阅@2x.png"></u-icon>
<text>提供简单描述文字</text>
</view>
</view>
<view class="item report" data-type="achievement" @click="handelGate">
<u-image src="/static/img/home/成绩鉴定背景@2x.png" width="220rpx" height="120rpx" />
<view>
<u-icon size="48rpx" label="成绩鉴定" labelPos="right" labelSize="28rpx"
labelColor="#FF6363" name="/static/img/home/icon-成绩鉴定@2x.png"></u-icon>
<text>提供简单描述文字</text>
</view>
</view>
</view>
</u-col>
</u-row>
</view>
<view class="todoList">
<view class="title">待办事项</view>
<view v-if="hasLogin">
<view class="cell">
<u-cell-group :border="false">
<u-cell v-if="statistics && statistics.internshipApply && statistics.internshipApply > 0"
:isLink="true" url="/pages/main/home/registrationReview/registrationReview"
arrow-direction="right" :rightIconStyle="{fontSize:'24rpx'}" :border="false">
<view slot="title" class="u-slot-title">
<view class="u-cell-title">实习申请</view>
<view class="u-cell-text">
您有<text>{{statistics.internshipApply}}</text>条<text>实习申请</text>待处理!</view>
</view>
<text slot="value" class="u-slot-value">立即处理</text>
</u-cell>
<u-cell
v-if="statistics && statistics.formLogWaitReview && statistics.formLogWaitReview > 0"
:isLink="true" url="/pages/main/home/logReview/logReview" arrow-direction="right"
:rightIconStyle="{fontSize:'24rpx'}" :border="false">
<view slot="title" class="u-slot-title">
<view class="u-cell-title">日志批阅</view>
<view class="u-cell-text">
您有<text>{{statistics.formLogWaitReview}}</text>篇<text>日志</text>待批阅!</view>
</view>
<text slot="value" class="u-slot-value">立即批阅</text>
</u-cell>
<u-cell v-if="statistics && statistics.reportWaitReview && statistics.reportWaitReview > 0"
:isLink="true" url="/pages/main/home/reportReview/reportReview" arrow-direction="right"
:rightIconStyle="{fontSize:'24rpx'}" :border="false">
<view slot="title" class="u-slot-title">
<view class="u-cell-title">报告批阅</view>
<view class="u-cell-text">
您有<text>{{statistics.reportWaitReview}}</text>篇<text>实习报告</text>待批阅!</view>
</view>
<text slot="value" class="u-slot-value">立即批阅</text>
</u-cell>
<u-cell
v-if="statistics && statistics.achievementWaitAppraisal && statistics.achievementWaitAppraisal > 0"
:isLink="true" url="/pages/main/home/achievementAppraisal/achievementAppraisal"
arrow-direction="right" :rightIconStyle="{fontSize:'24rpx'}" :border="false">
<view slot="title" class="u-slot-title">
<view class="u-cell-title">成绩评定</view>
<view class="u-cell-text">
您有<text>{{statistics.achievementWaitAppraisal}}</text>个<text>成绩</text>待评定!
</view>
</view>
<text slot="value" class="u-slot-value">立即评定</text>
</u-cell>
</u-cell-group>
</view>
</view>
<view class="no_login" v-else>
<text>登录后可查看待办事项</text>
<u-button type="primary" text="登录" color="#06B079" :customStyle="{width:'340rpx'}"
@click="handelLOgin"></u-button>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapGetters,
mapState,
mapActions
} from 'vuex'
import {
putTeacherRolesApi,
getTodoListStatisticsApi,
} from '@/config/api.js';
export default {
data() {
return {
statistics: {}
}
},
onLoad() {
},
onShow() {
if (this.hasLogin) {
getTodoListStatisticsApi().then(data => {
if (data) {
this.statistics = data;
}
})
}
},
computed: {
...mapGetters([
'doneRoles',
]),
...mapState({
hasLogin: 'hasLogin',
vuex_user: 'vuex_user',
teacher: (state) => state.vuex_user.teacher,
}),
},
methods: {
handelLOgin() {
this.$u.route('/pages/main/my/login/login');
},
handelChange() {
let {
roles = []
} = this.teacher;
if (roles.length < 2) {
this.$u.toast('暂无可切换权限')
} else {
let selectRoles = roles.filter(item => item.id != this.teacher.roleId);
putTeacherRolesApi(this.teacher.id, {
roleId: selectRoles[0].id
}).then(data => {
if (data) {
console.log(data)
this.$store.dispatch(`user/getUserInfo`)
}
})
}
},
handelGate(even) {
if (!this.hasLogin) {
this.$u.route('/pages/main/my/login/login');
return;
}
let {
type = ''
} = even.currentTarget.dataset;
switch (type) {
case 'review':
this.$u.route('/pages/main/home/registrationReview/registrationReview');
break;
case 'signin':
this.$u.route('/pages/main/home/studentSignIn/studentSignIn');
break;
case 'log':
this.$u.route('/pages/main/home/logReview/logReview');
break;
case 'report':
this.$u.route('/pages/main/home/reportReview/reportReview');
break;
case 'achievement':
this.$u.route('/pages/main/home/achievementAppraisal/achievementAppraisal');
break;
}
},
}
}
</script>
<style lang="scss" scoped>
.cell /deep/ .u-cell {
background-color: #FFFFFF;
border-radius: 12rpx;
margin: 0 0 20rpx 0;
// .u-flex {
// position: relative;
// top: -2rpx;
// }
// .u-cell_title {
// margin: 0 16rpx;
// color: rgba(0, 0, 0, 0.65);
// }
}
.home_box {
background-color: #F7F7F7;
min-height: 100%;
height: auto;
.home {
width: 690rpx;
margin: 0 auto;
.bar {
width: 100%;
height: 288rpx;
background-color: #E4F7F4;
margin: 0 0 34rpx 0;
}
.info {
.name {
text {
font-size: 36rpx;
line-height: 52rpx;
color: #202131;
}
text:last-child {
font-size: 24rpx;
line-height: 36rpx;
color: #909097;
margin: 0 0 0 12rpx;
}
}
.identity {
margin: 0 0 0 10rpx;
}
}
.gate {
margin-bottom: 50rpx;
.box {
width: 220rpx;
height: 256rpx;
.item {
position: relative;
width: 220rpx;
height: 120rpx;
view {
position: absolute;
top: 20rpx;
left: 20rpx;
text {
display: block;
margin: 8rpx 0 0 6rpx;
font-size: 20rpx;
line-height: 20rpx;
color: #909097;
}
}
}
.review {
.copywriting {
position: absolute;
top: 56rpx;
right: 32rpx;
text {
display: block;
font-size: 28rpx;
line-height: 36rpx;
color: #06B079;
margin: 0;
}
text:last-child {
font-size: 20rpx;
line-height: 52rpx;
color: #909097;
}
}
}
}
}
.todoList {
.no_login {
padding: 150rpx 0 0 0;
text-align: center;
text {
font-size: 24rpx;
line-height: 52rpx;
color: #909097;
}
}
.title {
font-size: 32rpx;
line-height: 32rpx;
color: #202131;
}
.title::before {
content: "";
display: inline-block;
width: 6rpx;
height: 32rpx;
background-color: #06B079;
margin: 0 12rpx 0 0;
position: relative;
top: 4rpx;
border-radius: 8rpx;
}
.cell {
margin: 20rpx 0 0 0;
.u-slot-title {
.u-cell-title {
font-size: 24rpx;
line-height: 54rpx;
color: #909097;
}
.u-cell-text {
font-size: 28rpx;
line-height: 60rpx;
color: #202131;
text {
color: #06B079;
}
}
}
.u-slot-value {
font-size: 24rpx;
line-height: 36rpx;
color: #909097;
}
}
}
}
}
</style>