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
<template>
<div class="teacher">
<div class="header">
<el-row>
<el-col :span="6">
<label>老师:</label>{{detail.type | teacherType}} {{detail.name}}
</el-col>
<el-col :span="6">
<label>微信号:</label> {{detail.alias}}
</el-col>
<el-col :span="6">
<label>二维码:</label>
<a :href="detail.qr">
<img class="avatar" :src="detail.qr"/>
</a>
</el-col>
<el-col :span="6">
<label>老师状态:</label>{{detail.status === 0 ? '正常' : '禁用'}}
</el-col>
</el-row>
<el-row v-if="detail.user_info">
<el-col :span="6">
<label>绑定用户:</label>
<a :href="detail.user_info.avatar" target="_blank">
<img class="avatar" :src="detail.user_info.avatar"/>
</a>
{{detail.user_info.nickname}}(ID:{{detail.user_info.user_id}})
</el-col>
</el-row>
</div>
<el-table
@expand-change="changeRow"
:data="list"
style="width: 100%">
<el-table-column type="expand">
<template slot-scope="scope">
<el-table
:data="[scope.row]"
style="width: 100%">
<el-table-column
label="到课率">
<template slot-scope="scope2">
<span>{{ scope2.row.arrive_course_rate | percent}}</span>
</template>
</el-table-column>
<el-table-column
label="看课率">
<template slot-scope="scope2">
<span>{{ scope2.row.watch_course_rate | percent}}</span>
</template>
</el-table-column>
<el-table-column
label="完课率">
<template slot-scope="scope2">
<span>{{ scope2.row.over_course_rate | percent}}</span>
</template>
</el-table-column>
<el-table-column
label="作业率">
<template slot-scope="scope2">
<span>{{ scope2.row.work_rate | percent}}</span>
</template>
</el-table-column>
<el-table-column
label="全勤作业率">
<template slot-scope="scope2">
<span>{{ scope2.row.over_work_rate | percent}}</span>
</template>
</el-table-column>
<el-table-column
label="打卡率">
<template slot-scope="scope2">
<span>{{ scope2.row.clock_rate | percent}}</span>
</template>
</el-table-column>
<el-table-column
label="全勤打卡率">
<template slot-scope="scope2">
<span>{{ scope2.row.over_clock_rate | percent}}</span>
</template>
</el-table-column>
<el-table-column
label="转化率">
<template slot-scope="scope2">
<span>{{ scope2.row.transform_rate | percent}}</span>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column
prop="id"
label="班级ID">
</el-table-column>
<el-table-column
prop="periods_title"
label="期数名称">
</el-table-column>
<el-table-column
prop="join_num"
label="参加人数">
</el-table-column>
<el-table-column
prop="max_join_num"
label="最大班级人数">
</el-table-column>
<el-table-column
prop="start_at"
label="开始时间">
</el-table-column>
<el-table-column
prop="created_at"
label="创建时间">
</el-table-column>
</el-table>
<page :total="total" :limit="limit" @pageChange="onPageChange"/>
</div>
</template>
<script>
import {getTeacherDetailApi,getClassStatisticsApi} from "../../service/api";
import {TEACHERTYPE} from "../../util/wordbook";
import page from '../framework/page'
export default {
name: "index",
components:{
page
},
data(){
return {
list:[],
id: '',
detail: {},
total: 0,
limit: 10,
nowPage: 1
}
},
methods:{
changeRow(data,b){
if(b.indexOf(data)>-1){
getClassStatisticsApi(data.periods_id,data.id).then(res=>{
data.arrive_course_rate = res.arrive_course_rate;
data.watch_course_rate = res.watch_course_rate;
data.over_course_rate = res.over_course_rate;
data.work_rate = res.work_rate;
data.over_work_rate = res.over_work_rate;
data.clock_rate = res.clock_rate;
data.over_clock_rate = res.over_clock_rate;
data.transform_rate = res.transform_rate;
})
}
},
onPageChange(val){
this.nowPage = val
this.getTeacherDetail()
},
getTeacherDetail(){
let id = this.id;
let json = {
limit: this.limit,
page: this.nowPage
}
getTeacherDetailApi(id, json).then((res)=>{
if (res.class_list) {
res.class_list.list.forEach(data=>{
data.arrive_course_rate = 0;
data.watch_course_rate = 0;
data.over_course_rate = 0;
data.work_rate = 0;
data.over_work_rate = 0;
data.clock_rate = 0;
data.over_clock_rate = 0;
data.transform_rate = 0;
});
this.list = res.class_list.list || [];
this.total = res.class_list.total;
}
this.detail = res;
})
}
},
filters:{
teacherType(value){
return TEACHERTYPE[value]
},
percent(val){
return (val * 100).toFixed(2)+'%'
}
},
mounted(){
this.id = this.$route.params.id;
this.getTeacherDetail();
}
}
</script>
<style scoped lang="less">
.teacher {
padding: 20px 0;
}
.avatar {
width: 80px;
margin-right: 5px;
}
.header {
padding: 0 20px;
margin-bottom: 20px;
}
.el-row {
display: flex;
justify-content: flex-start;
align-items: center;
color: #666;
font-size: 16px;
label{
margin-right: 10px;
}
}
.el-col{
/*height: 50px;*/
display: flex;
justify-content: flex-start;
align-items: center;
img{
width: 50px;
border-radius: 100px;
}
label{
color: #5982e6;
}
}
</style>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 90px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
width: 50%;
}
</style>