student.vue
8.46 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
<template>
<div>
<back-box>
<template slot="title">
<span>教师管理</span>
</template>
<template slot="btns">
<el-tooltip effect="dark" content="添加学生" placement="bottom">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
plain
circle
></el-button>
</el-tooltip>
</template>
</back-box>
<div class="page-content">
<div class="stu-box">
<div class="stu-list">
<div class="h-title">
<el-select
class="sel"
v-model="query.gradeName"
placeholder="选择年级"
@change="changeGrade"
>
<el-option
v-for="item in gradeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<ul class="stu-ul">
<li
class="stu-item"
v-for="item in classList"
:key="item.classCode"
:class="query.classId == item.classCode ? 'avtive' : ''"
@click="classDetail(item.classCode)"
>
<i class="el-icon-edit-outline"></i>
{{ item.className }}({{ item.studentCount }})
</li>
</ul>
</div>
<div class="stu-detail">
<div class="answer-header">
<div class="sel-box">
<el-input
placeholder="请输入学生姓名"
v-model="query.studentName"
class="input-with-select"
@keyup.enter.native="_QueryData(1)"
>
<el-button
slot="append"
icon="el-icon-search"
@click="_QueryData(1)"
></el-button>
</el-input>
<el-input
placeholder="请输入学生学号"
v-model="query.studentCode"
class="input-with-select"
@keyup.enter.native="_QueryData(2)"
>
<el-button
slot="append"
icon="el-icon-search"
@click="_QueryData(2)"
></el-button>
</el-input>
</div>
</div>
<ul class="s-ul" v-loading="loading">
<li class="s-li" v-for="item in studentList" :key="item.id">
<i class="el-icon-delete"></i>
<p class="name">{{ item.studentName }}</p>
<p class="p1">
答题器:{{ (item.clickerList.length && item.clickerList[0].clickerSn) || "--" }}
</p>
<p class="p1">长学号:{{ item.studentCode }}</p>
<p class="p1">短学号:{{ item.shortNumber || "--" }}</p>
</li>
</ul>
<el-empty
:image-size="100"
v-if="!studentList.length && loading == false"
description="没有更多数据"
></el-empty>
</div>
</div>
</div>
<el-dialog title="导入学校名单" :visible.sync="diaUp" width="400">
<up-load id="downTeacher" :url="url" fileName="教师名单">
<p class="down-txt" slot="down">
通过Excel名单导入教师名单,点击
<el-link type="danger" @click="downExcel">模板下载</el-link> 。
</p>
</up-load>
<div class="dialog-footer" slot="footer">
<el-button @click="diaUp = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { downloadFile } from "@/utils";
export default {
data() {
return {
url: "",
diaUp: false,
query: {
gradeName: "",
classId: "",
studentCode: "",
studentName: "",
},
gradeName: "",
gradeList: [],
classList: [],
studentList: [],
teacherDetail: {
teacherName: "",
loginName: "",
sex: "",
available: "",
managerList: [],
teacherCourseList: [],
teacherGradeList: [],
},
};
},
async created() {
await this._QueryDataGrade();
this._QueryClass();
this._QueryData(3);
},
methods: {
changeGrade(val) {
this.query.classId = "";
this._QueryClass(val);
this._QueryData(3);
},
classDetail(id) {
this.query.classId = id;
this._QueryData(3);
},
async _QueryData(type) {
let query = {};
query.gradeName = this.query.gradeName;
query.classId = this.query.classId;
if (type == 1) {
query.studentName = this.query.studentName;
this.query.studentCode = "";
} else if (type == 2) {
query.studentCode = this.query.studentCode;
this.query.studentName = "";
} else if (type == 3) {
this.query.studentName = "";
this.query.studentCode = "";
}
this.loading = true;
const { data, status, info } = await this.$request.studentList({
...query,
});
this.loading = false;
console.log(status);
if (status === 0) {
this.studentList = data.list || [];
} else {
this.$message.error(info);
}
},
async _QueryDataGrade() {
this.loading = true;
const { data, status, info } = await this.$request.gradeList();
if (status === 0) {
this.gradeList =
data.list?.map((item) => {
return {
value: item.gradeName,
label: item.gradeName,
};
}) || [];
this.query.gradeName = this.gradeList[0]?.value;
} else {
this.$message.error(info);
}
},
async _QueryClass(value) {
const { data, status, info } = await this.$request.schoolClassList({
gradeName: value || this.query.gradeName,
});
if (status === 0) {
this.classList = [...data.list] || [];
} else {
this.$message.error(info);
}
},
async downExcel() {
let data = await this.$request.downDevice({
id: this.id,
});
if (data && !data.code) {
let blob = new Blob([data], {
type: "application/vnd.ms-excel;charset=utf-8",
});
downloadFile(`设备信息.xlsx`, blob);
} else {
this.$message.error(data.message);
}
},
},
};
</script>
<style lang="scss" scoped>
.page-content {
padding: 20px;
}
.stu-box {
display: flex;
background: #f8f8f8;
border-radius: 10px;
overflow: hidden;
.stu-list {
max-height: 80vh;
.h-title {
height: 40px;
overflow-y: scroll;
line-height: 40px;
background: #eee;
}
.stu-item {
font-size: 16px;
color: #7f7f7f;
line-height: 36px;
cursor: pointer;
padding-left: 12px;
position: relative;
.el-icon-edit-outline {
position: absolute;
top: 8px;
right: 12px;
font-size: 20px;
display: none;
&:hover {
color: #667ffd;
}
}
&:hover {
background: #eee;
.el-icon-edit-outline {
display: block;
}
}
&.active {
color: #667ffd;
}
}
.sel {
width: 180px;
:deep(.el-input__inner) {
font-size: 16px;
padding-left: 0;
border: none;
background: transparent;
}
:deep(.el-icon-arrow-up:before) {
content: "\e78f";
}
}
}
.stu-detail {
flex: 1;
border-left: 0.5px solid #eee;
.s-ul {
display: flex;
flex-wrap: wrap;
padding-left: 20px;
.s-li {
width: 180px;
height: 120px;
box-shadow: 2px 2px 5px #7f7f7f;
border-radius: 10px;
margin: 0 20px 20px 0;
padding: 0 12px 5px;
position: relative;
.el-icon-delete {
position: absolute;
top: 8px;
right: 8px;
font-size: 18px;
padding: 2px;
display: none;
cursor: pointer;
&:hover {
color: #667ffd;
}
}
&:hover {
.el-icon-delete {
display: block;
}
}
.name {
text-align: center;
font-size: 16px;
line-height: 18px;
padding: 10px 0;
}
.p1 {
color: #7f7f7f;
line-height: 20px;
padding-bottom: 5px;
}
}
}
}
}
</style>