|
@@ -1,98 +1,85 @@
|
1
|
1
|
<template>
|
2
|
2
|
<view class="page">
|
3
|
3
|
<cu-custom :isBack="false"></cu-custom>
|
4
|
|
- <view class="header" :style="[{top:topHeader + 'px'}]">
|
|
4
|
+ <view class="header" :style="[{ top: topHeader + 'px' }]">
|
5
|
5
|
<view class="header-title header-switch">
|
6
|
|
- <view class="header-title-main" @tap="changeTab('schedule')" :class="{'cur':type==='schedule'}">
|
|
6
|
+ <view class="header-title-main" @tap="changeTab('schedule')" :class="{ cur: type === 'schedule' }">
|
7
|
7
|
<view class="margin-bottom-xs">日程表</view>
|
8
|
8
|
<view class="point"></view>
|
9
|
9
|
</view>
|
10
|
|
- <view class="header-title-main margin-left-lg" @tap="changeTab('mine')" :class="{'cur':type==='mine'}">
|
|
10
|
+ <view class="header-title-main margin-left-lg" @tap="changeTab('mine')" :class="{ cur: type === 'mine' }">
|
11
|
11
|
<view class="margin-bottom-xs">我的</view>
|
12
|
12
|
<view class="point"></view>
|
13
|
13
|
</view>
|
14
|
14
|
</view>
|
15
|
|
- <view style="width:120px;" v-if="type==='mine'">
|
|
15
|
+ <view style="width: 120px;" v-if="type === 'mine'">
|
16
|
16
|
<swiper-tab :menuList="menuList" @changeTab="swipe" :activeTab="currentIndex"></swiper-tab>
|
17
|
17
|
</view>
|
18
|
18
|
</view>
|
19
|
19
|
<!-- 日程表 -->
|
20
|
|
- <view v-if="type==='schedule'">
|
21
|
|
- <scroll-view scroll-y="true" :style="[{marginTop:'56px',height:'calc(100vh - 114px - '+ topHeader+'px)'}]">
|
|
20
|
+ <view v-if="type === 'schedule'">
|
|
21
|
+ <scroll-view scroll-y="true" :style="[{ marginTop: '56px', height: 'calc(100vh - 114px - ' + topHeader + 'px)' }]">
|
22
|
22
|
<view class="calendar padding-tb solid-bottom bg-white">
|
23
|
23
|
<view class="calendar-header flex justify-between padding-lr-sm">
|
24
|
24
|
<view>
|
25
|
|
- <picker mode="date" :value="info.chooseDate" :fields="info.fields" @change="bindDateChange"
|
26
|
|
- :start="info.start" :end="info.end">
|
|
25
|
+ <picker mode="date" :value="info.chooseDate" :fields="info.fields" @change="bindDateChange" :start="info.start" :end="info.end">
|
27
|
26
|
<view class="picker text-student text-xl">
|
28
|
|
- {{info.chooseDate}}
|
|
27
|
+ {{ info.chooseDate }}
|
29
|
28
|
<text class="cuIcon-right lg"></text>
|
30
|
29
|
</view>
|
31
|
30
|
</picker>
|
32
|
31
|
</view>
|
33
|
|
- <view>
|
34
|
|
- 共{{present.attendance_data.length}}天
|
35
|
|
- </view>
|
|
32
|
+ <view> 共{{ present.attendance_data.length }}天 </view>
|
36
|
33
|
</view>
|
37
|
34
|
<view class="calendar-main">
|
38
|
|
- <calendar :year="year" :month="month" :showBusiness="true" @changeDate="chooseDay" ref="calendar">
|
39
|
|
- </calendar>
|
|
35
|
+ <calendar :year="year" :month="month" :showBusiness="true" @changeDate="chooseDay" ref="calendar"> </calendar>
|
40
|
36
|
</view>
|
41
|
37
|
<view class="calendar-marks flex justify-end padding-lr-sm">
|
42
|
|
- <view class="margin-left-sm">
|
43
|
|
- <view class="cu-tag bg-blue margin-right-sm"></view><text class="text-sm">请假</text>
|
44
|
|
- </view>
|
45
|
|
- <view class="margin-left-sm">
|
46
|
|
- <view class="cu-tag bg-yellow margin-right-sm"></view><text class="text-sm">迟到</text>
|
47
|
|
- </view>
|
48
|
|
- <view class="margin-left-sm">
|
49
|
|
- <view class="cu-tag bg-normal margin-right-sm"></view><text class="text-sm">正常</text>
|
50
|
|
- </view>
|
51
|
|
- <view class="margin-left-sm">
|
52
|
|
- <view class="cu-tag bg-red margin-right-sm"></view><text class="text-sm">旷课</text>
|
53
|
|
- </view>
|
|
38
|
+ <view class="margin-left-sm"> <view class="cu-tag bg-blue margin-right-sm"></view><text class="text-sm">请假</text> </view>
|
|
39
|
+ <view class="margin-left-sm"> <view class="cu-tag bg-yellow margin-right-sm"></view><text class="text-sm">迟到</text> </view>
|
|
40
|
+ <view class="margin-left-sm"> <view class="cu-tag bg-normal margin-right-sm"></view><text class="text-sm">正常</text> </view>
|
|
41
|
+ <view class="margin-left-sm"> <view class="cu-tag bg-red margin-right-sm"></view><text class="text-sm">旷课</text> </view>
|
54
|
42
|
</view>
|
55
|
43
|
</view>
|
56
|
44
|
<view class="cu-card margin-top-xs padding-xs">
|
57
|
45
|
<view class="cu-item day-info">
|
58
|
46
|
<view class="day-title flex justify-between solid-bottom padding text-lg">
|
59
|
|
- <view>应到上课节数:{{present.be_section_num}}节</view>
|
60
|
|
- <view>实际上课节数: {{present.actual_section_num}}节</view>
|
|
47
|
+ <view>应到上课节数:{{ present.be_section_num }}节</view>
|
|
48
|
+ <view>实际上课节数: {{ present.actual_section_num }}节</view>
|
61
|
49
|
</view>
|
62
|
50
|
<view class="day-chart flex justify-between padding">
|
63
|
|
- <view v-for="(chart,key) in attendance" :key="key" class="flex-sub">
|
64
|
|
- <canvas :canvas-id="key" style="margin:0 auto;width:100%;height:80px;"></canvas>
|
65
|
|
- <view style="margin-left:18px;">{{chart.title}}</view>
|
|
51
|
+ <view v-for="(chart, key) in attendance" :key="key" class="flex-sub">
|
|
52
|
+ <canvas :canvas-id="key" style="margin: 0 auto; width: 100%; height: 80px;"></canvas>
|
|
53
|
+ <view style="margin-left: 18px;">{{ chart.title }}</view>
|
66
|
54
|
</view>
|
67
|
55
|
</view>
|
68
|
56
|
</view>
|
69
|
57
|
</view>
|
70
|
58
|
<view class="list margin-top-xs">
|
71
|
|
- <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in classList" :key="index">
|
72
|
|
- <view class="cu-item" v-for="(mark,i) in item.mark" :key="i">
|
|
59
|
+ <view class="cu-card margin-top margin-bottom shadow" v-for="(item, index) in classList" :key="index">
|
|
60
|
+ <view class="cu-item" v-for="(mark, i) in item.mark" :key="i">
|
73
|
61
|
<view class="card-header flex justify-end solid-bottom">
|
74
|
62
|
<view class="text-student course-status">
|
75
|
|
- {{mark.status_desc}}
|
|
63
|
+ {{ mark.status_desc }}
|
76
|
64
|
</view>
|
77
|
65
|
</view>
|
78
|
66
|
<view class="card flex">
|
79
|
67
|
<view class="card-left">
|
80
|
|
- <img mode="scaleToFill" :src="mark.avatar" alt="" class="card-image">
|
|
68
|
+ <img mode="scaleToFill" :src="mark.avatar" alt="" class="card-image" />
|
81
|
69
|
</view>
|
82
|
70
|
<view class="card-right margin-left-sm">
|
83
|
|
- <view class="card-title">{{mark.course_name}}</view>
|
|
71
|
+ <view class="card-title">{{ mark.course_name }}</view>
|
84
|
72
|
<view class="card-item margin-top-xs">
|
85
|
|
- <text class="card-text">{{mark.start_at}}</text>
|
|
73
|
+ <text class="card-text">{{ mark.start_at }}</text>
|
86
|
74
|
</view>
|
87
|
75
|
<view class="card-item margin-top-xs">
|
88
|
|
- <text class="card-text">{{mark.end_at}}</text>
|
|
76
|
+ <text class="card-text">{{ mark.end_at }}</text>
|
89
|
77
|
</view>
|
90
|
78
|
<view class="card-item margin-top-xs">
|
91
|
79
|
<button class="cu-btn round line-cyan button-hover" @tap="classOperation(mark.class_plan_id)">
|
92
|
|
- {{mark.status==-1?'查看':'去上课'}}
|
|
80
|
+ {{ mark.status == -1 ? '查看' : '去上课' }}
|
93
|
81
|
</button>
|
94
|
|
- <button class="cu-btn round line-red button-hover margin-left" @tap="askLeave(mark.class_plan_id)"
|
95
|
|
- v-if="mark.status!==-1">去请假</button>
|
|
82
|
+ <button class="cu-btn round line-red button-hover margin-left" @tap="askLeave(mark.class_plan_id)" v-if="mark.status !== -1">去请假</button>
|
96
|
83
|
</view>
|
97
|
84
|
</view>
|
98
|
85
|
</view>
|
|
@@ -102,34 +89,33 @@
|
102
|
89
|
</scroll-view>
|
103
|
90
|
</view>
|
104
|
91
|
<!-- 我的 -->
|
105
|
|
- <view v-if="type==='mine'">
|
106
|
|
- <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-main"
|
107
|
|
- :style="[{height:'calc(100vh - 114px - '+ topHeader+'px)'}]">
|
|
92
|
+ <view v-if="type === 'mine'">
|
|
93
|
+ <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-main" :style="[{ height: 'calc(100vh - 114px - ' + topHeader + 'px)' }]">
|
108
|
94
|
<view class="list">
|
109
|
|
- <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in list" :key="index">
|
|
95
|
+ <view class="cu-card margin-top margin-bottom shadow" v-for="(item, index) in list" :key="index">
|
110
|
96
|
<view class="cu-item">
|
111
|
97
|
<view class="card-header flex justify-between solid-bottom">
|
112
|
|
- <view v-if="item.day">{{item.day}}</view>
|
|
98
|
+ <view v-if="item.day">{{ item.day }}</view>
|
113
|
99
|
<view class="text-student course-status" v-if="item.status">
|
114
|
|
- {{item.status}}
|
|
100
|
+ {{ item.status }}
|
115
|
101
|
</view>
|
116
|
|
- <view class="text-student course-status" v-if="currentIndex===1">
|
|
102
|
+ <view class="text-student course-status" v-if="currentIndex === 1">
|
117
|
103
|
已完结
|
118
|
104
|
</view>
|
119
|
105
|
</view>
|
120
|
106
|
<view class="card flex">
|
121
|
107
|
<view class="card-left">
|
122
|
|
- <img mode="scaleToFill" :src="item.image" alt="" class="card-image">
|
|
108
|
+ <img mode="scaleToFill" :src="item.image" alt="" class="card-image" />
|
123
|
109
|
</view>
|
124
|
110
|
<view class="card-right margin-left-sm">
|
125
|
|
- <view class="card-title">{{item.attend_name}}</view>
|
|
111
|
+ <view class="card-title">{{ item.attend_name }}</view>
|
126
|
112
|
<view class="card-item margin-top-xs">
|
127
|
113
|
<text class="card-label">机构:</text>
|
128
|
|
- <text class="card-text">{{item.agency_name||'-'}}</text>
|
|
114
|
+ <text class="card-text">{{ item.agency_name || '-' }}</text>
|
129
|
115
|
</view>
|
130
|
116
|
<view class="card-item margin-top-xs">
|
131
|
117
|
<text class="card-label">老师:</text>
|
132
|
|
- <text class="card-text">{{item.teacher||'-'}}</text>
|
|
118
|
+ <text class="card-text">{{ item.teacher || '-' }}</text>
|
133
|
119
|
</view>
|
134
|
120
|
</view>
|
135
|
121
|
</view>
|
|
@@ -150,9 +136,10 @@ import { getDate, deepClone } from '@/common/utils'
|
150
|
136
|
import swiperTab from '@/components/swiper-tab.vue'
|
151
|
137
|
export default {
|
152
|
138
|
components: {
|
153
|
|
- swiperTab, calendar
|
|
139
|
+ swiperTab,
|
|
140
|
+ calendar
|
154
|
141
|
},
|
155
|
|
- data () {
|
|
142
|
+ data() {
|
156
|
143
|
return {
|
157
|
144
|
topHeader: this.globalCustomBarHeight,
|
158
|
145
|
type: 'schedule',
|
|
@@ -163,7 +150,8 @@ export default {
|
163
|
150
|
list: [],
|
164
|
151
|
classList: [], // 日程表当天
|
165
|
152
|
courses: [], // 日程表全部
|
166
|
|
- info: { // 日历数据
|
|
153
|
+ info: {
|
|
154
|
+ // 日历数据
|
167
|
155
|
chooseDate: '', // 选中日期
|
168
|
156
|
year: '',
|
169
|
157
|
month: '',
|
|
@@ -181,57 +169,68 @@ export default {
|
181
|
169
|
leave_num: 0,
|
182
|
170
|
normal_num: 0
|
183
|
171
|
}, // 实际出席情况
|
184
|
|
- attendance: { // 出席统计数据
|
|
172
|
+ attendance: {
|
|
173
|
+ // 出席统计数据
|
185
|
174
|
leave_num: {
|
186
|
|
- title: '请假', times: 2, color: '#3390F5'
|
|
175
|
+ title: '请假',
|
|
176
|
+ times: 2,
|
|
177
|
+ color: '#3390F5'
|
187
|
178
|
},
|
188
|
179
|
late_num: {
|
189
|
|
- title: '迟到', times: 1, color: '#fbbd08'
|
|
180
|
+ title: '迟到',
|
|
181
|
+ times: 1,
|
|
182
|
+ color: '#fbbd08'
|
190
|
183
|
},
|
191
|
184
|
normal_num: {
|
192
|
|
- title: '正常', times: 3, color: '#4DB8E4'
|
|
185
|
+ title: '正常',
|
|
186
|
+ times: 3,
|
|
187
|
+ color: '#4DB8E4'
|
193
|
188
|
},
|
194
|
189
|
absenteeism_num: {
|
195
|
|
- title: '旷课', times: 0, color: '#e54d42'
|
|
190
|
+ title: '旷课',
|
|
191
|
+ times: 0,
|
|
192
|
+ color: '#e54d42'
|
196
|
193
|
}
|
197
|
194
|
}
|
198
|
195
|
}
|
199
|
196
|
},
|
200
|
|
- onShow () {
|
|
197
|
+ onShow() {
|
201
|
198
|
const today = getDate(new Date(), 0)
|
202
|
199
|
this.info.year = this.info.year || today.year
|
203
|
200
|
this.info.month = this.info.month || today.month
|
204
|
201
|
this.info.day = this.info.day || today.date
|
205
|
202
|
this.info.chooseDate = this.info.chooseDate || today.fullMonth
|
206
|
|
- this.info.start = (this.info.year - 1) + '-' + '01-01'
|
|
203
|
+ this.info.start = this.info.year - 1 + '-' + '01-01'
|
207
|
204
|
this.info.end = this.info.year + '-' + (Number(this.info.month) + 1) + '-' + this.info.day
|
208
|
205
|
this.init()
|
209
|
206
|
},
|
210
|
207
|
methods: {
|
211
|
|
- init () {
|
|
208
|
+ init() {
|
212
|
209
|
if (this.type === 'mine') {
|
213
|
210
|
this.get_list()
|
214
|
211
|
} else {
|
215
|
212
|
this.getSehedule()
|
216
|
213
|
}
|
217
|
214
|
},
|
218
|
|
- getSehedule () {
|
|
215
|
+ getSehedule() {
|
219
|
216
|
this.setCalendar()
|
220
|
217
|
this.get_attend().then(res => {
|
221
|
218
|
this.present = res.data
|
222
|
|
- this.fix_attend(res.data)// 出席统计
|
223
|
|
- this.setAttendance(res.data.attendance_data)// 日历显示出席日期
|
|
219
|
+ this.fix_attend(res.data) // 出席统计
|
|
220
|
+ this.setAttendance(res.data.attendance_data) // 日历显示出席日期
|
224
|
221
|
this.drawChart()
|
225
|
|
- this.get_dateCourse()// 获取日期课程列表
|
|
222
|
+ this.get_dateCourse() // 获取日期课程列表
|
226
|
223
|
})
|
227
|
224
|
},
|
228
|
|
- classOperation (id) { // 上课
|
|
225
|
+ classOperation(id) {
|
|
226
|
+ // 上课
|
229
|
227
|
this.globalNavigateTo('studentOperation', { id })
|
230
|
228
|
},
|
231
|
|
- askLeave (id) { // 请假
|
|
229
|
+ askLeave(id) {
|
|
230
|
+ // 请假
|
232
|
231
|
this.globalNavigateTo('studentAbsent', { id })
|
233
|
232
|
},
|
234
|
|
- loadMore () {
|
|
233
|
+ loadMore() {
|
235
|
234
|
if (this.noMore) {
|
236
|
235
|
uni.showToast({ title: '没有更多了', icon: 'none' })
|
237
|
236
|
return false
|
|
@@ -239,18 +238,18 @@ export default {
|
239
|
238
|
this.page_num++
|
240
|
239
|
this.get_list()
|
241
|
240
|
},
|
242
|
|
- get_list () {
|
|
241
|
+ get_list() {
|
243
|
242
|
if (this.currentIndex === 0) {
|
244
|
243
|
this.get_course()
|
245
|
244
|
} else {
|
246
|
245
|
this.get_history()
|
247
|
246
|
}
|
248
|
247
|
},
|
249
|
|
- chooseDay (day) {
|
250
|
|
- this.classList = this.courses.filter(item => item.date.replace(/-/g, '') === day)// 匹配当天数据
|
|
248
|
+ chooseDay(day) {
|
|
249
|
+ this.classList = this.courses.filter(item => item.date.replace(/-/g, '') === day) // 匹配当天数据
|
251
|
250
|
this.classList = this.classList.length > 0 ? this.classList : deepClone(this.courses)
|
252
|
251
|
},
|
253
|
|
- get_course () {
|
|
252
|
+ get_course() {
|
254
|
253
|
_nowCourse({ page_num: this.page_num }).then(res => {
|
255
|
254
|
if (this.page_num > 1) {
|
256
|
255
|
if (res.data.length < this.page_size) this.noMore = true
|
|
@@ -261,7 +260,7 @@ export default {
|
261
|
260
|
}
|
262
|
261
|
})
|
263
|
262
|
},
|
264
|
|
- get_history () {
|
|
263
|
+ get_history() {
|
265
|
264
|
_courseHistory({ page_num: this.page_num }).then(res => {
|
266
|
265
|
if (this.page_num > 1) {
|
267
|
266
|
if (res.data.length < this.page_size) this.noMore = true
|
|
@@ -272,23 +271,23 @@ export default {
|
272
|
271
|
}
|
273
|
272
|
})
|
274
|
273
|
},
|
275
|
|
- drawChart () {
|
|
274
|
+ drawChart() {
|
276
|
275
|
for (var key in this.attendance) {
|
277
|
276
|
this.draw(this.attendance[key], key)
|
278
|
277
|
}
|
279
|
278
|
},
|
280
|
|
- changeTab (type) {
|
|
279
|
+ changeTab(type) {
|
281
|
280
|
this.type = type
|
282
|
281
|
this.$nextTick(() => {
|
283
|
282
|
this.init()
|
284
|
283
|
})
|
285
|
284
|
},
|
286
|
|
- swipe (index) {
|
|
285
|
+ swipe(index) {
|
287
|
286
|
this.currentIndex = index
|
288
|
287
|
this.page_num = 1
|
289
|
288
|
this.get_list()
|
290
|
289
|
},
|
291
|
|
- bindDateChange (e) {
|
|
290
|
+ bindDateChange(e) {
|
292
|
291
|
const value = e.detail.value
|
293
|
292
|
const [year, month] = value.split('-')
|
294
|
293
|
this.info.year = year
|
|
@@ -296,36 +295,42 @@ export default {
|
296
|
295
|
this.info.chooseDate = value
|
297
|
296
|
this.getSehedule()
|
298
|
297
|
},
|
299
|
|
- setCalendar () {
|
|
298
|
+ setCalendar() {
|
300
|
299
|
this.$refs.calendar.selCalendar(this.info.year, this.info.month)
|
301
|
300
|
},
|
302
|
|
- setAttendance (attendance) { // 补充出席情况
|
|
301
|
+ setAttendance(attendance) {
|
|
302
|
+ // 补充出席情况
|
303
|
303
|
if (!attendance) return
|
304
|
304
|
this.$refs.calendar.setAttendance(attendance)
|
305
|
305
|
},
|
306
|
|
- get_attend () { // 获取出席情况
|
|
306
|
+ get_attend() {
|
|
307
|
+ // 获取出席情况
|
307
|
308
|
const date = this.info.year + '-' + this.info.month
|
308
|
309
|
return new Promise((resolve, reject) => {
|
309
|
310
|
const info = _attendance({ date })
|
310
|
311
|
resolve(info)
|
311
|
312
|
})
|
312
|
313
|
},
|
313
|
|
- fix_attend (info) { // 补充出席实际数据
|
|
314
|
+ fix_attend(info) {
|
|
315
|
+ // 补充出席实际数据
|
314
|
316
|
Object.keys(this.attendance).forEach(key => {
|
315
|
317
|
this.attendance[key].times = info[key]
|
316
|
318
|
})
|
317
|
319
|
},
|
318
|
|
- get_dateCourse () { // 获取对应日期数据
|
|
320
|
+ get_dateCourse() {
|
|
321
|
+ // 获取对应日期数据
|
319
|
322
|
_dateCourse({ year: this.info.year, month: this.info.month }).then(res => {
|
320
|
323
|
this.classList = res.data
|
321
|
324
|
this.courses = res.data
|
|
325
|
+ const days = this.courses.map(item => parseInt(item.day))
|
|
326
|
+ this.$refs.calendar.setClass(days)
|
322
|
327
|
})
|
323
|
328
|
},
|
324
|
|
- draw (ele, key) {
|
|
329
|
+ draw(ele, key) {
|
325
|
330
|
const ctx = uni.createCanvasContext(key)
|
326
|
|
- const value = NP.divide(ele.times, this.present.be_section_num) * 100// 次数转化对应百分比值
|
|
331
|
+ const value = NP.divide(ele.times, this.present.be_section_num) * 100 // 次数转化对应百分比值
|
327
|
332
|
const startAngle = 1.5
|
328
|
|
- const endAngle = 1.5 + value * 2 / 100
|
|
333
|
+ const endAngle = 1.5 + (value * 2) / 100
|
329
|
334
|
// 画圆环
|
330
|
335
|
ctx.beginPath()
|
331
|
336
|
ctx.arc(34, 40, 28, 0, 2 * Math.PI)
|