Commit 0a4de03499b57d999a0ee53a3aedbdeca18c5d25
1 parent
bb4c8454
教师管理,学生管理班级设置
Showing
3 changed files
with
123 additions
and
27 deletions
src/views/down/client.vue
| ... | ... | @@ -228,7 +228,7 @@ |
| 228 | 228 | :step="1" |
| 229 | 229 | :step-strictly="true" |
| 230 | 230 | ></el-input-number> |
| 231 | - {{ examsDuration ? "秒" : "" }} | |
| 231 | + {{ examsDuration ? "分" : "" }} | |
| 232 | 232 | </el-form-item> |
| 233 | 233 | <el-form-item label="答题结构展示:" prop="displayModel"> |
| 234 | 234 | <el-radio-group v-model="formData.displayModel"> |
| ... | ... | @@ -327,7 +327,7 @@ export default { |
| 327 | 327 | multipleChoiceNum: 4, |
| 328 | 328 | singleTypeNum: 20, |
| 329 | 329 | askCountdown: 30, |
| 330 | - examsDuration: 5400, | |
| 330 | + examsDuration: 90, | |
| 331 | 331 | displayModel: 0, |
| 332 | 332 | languageSet: 0, |
| 333 | 333 | otherSet: [], |
| ... | ... | @@ -401,6 +401,9 @@ export default { |
| 401 | 401 | for (let key in this.formData) { |
| 402 | 402 | content[key] ? (this.formData[key] = content[key]) : ""; |
| 403 | 403 | } |
| 404 | + this.formData.examsDuration = (this.formData.examsDuration / 60).toFixed( | |
| 405 | + 0 | |
| 406 | + ); | |
| 404 | 407 | this.type = 2; |
| 405 | 408 | (this.configId = obj.id), (this.dialogVis = true); |
| 406 | 409 | }, |
| ... | ... | @@ -418,7 +421,7 @@ export default { |
| 418 | 421 | }, |
| 419 | 422 | examsDurationChange(val) { |
| 420 | 423 | if (val) { |
| 421 | - this.formData.examsDuration = 5400; | |
| 424 | + this.formData.examsDuration = 90; | |
| 422 | 425 | } else { |
| 423 | 426 | this.formData.examsDuration = 0; |
| 424 | 427 | } |
| ... | ... | @@ -430,6 +433,7 @@ export default { |
| 430 | 433 | content[key] = this.formData[key]; |
| 431 | 434 | } |
| 432 | 435 | } |
| 436 | + content.examsDuration = content.examsDuration * 60; | |
| 433 | 437 | |
| 434 | 438 | if (this.type == 1) { |
| 435 | 439 | this.addAppConfig({ | ... | ... |
src/views/setUp/student.vue
| ... | ... | @@ -44,7 +44,7 @@ |
| 44 | 44 | :class="query.classId == item.id ? 'active' : ''" |
| 45 | 45 | @click="classDetail(item)" |
| 46 | 46 | > |
| 47 | - <i class="el-icon-edit-outline"></i> | |
| 47 | + <i class="el-icon-edit-outline" @click.stop="setClass(item)"></i> | |
| 48 | 48 | {{ item.className }}({{ item.studentCount }}) |
| 49 | 49 | </li> |
| 50 | 50 | </ul> |
| ... | ... | @@ -79,12 +79,16 @@ |
| 79 | 79 | </div> |
| 80 | 80 | </div> |
| 81 | 81 | <ul class="s-ul" v-loading="loading"> |
| 82 | - <li class="s-li" v-for="(item,index) in studentList" :key="item.id"> | |
| 82 | + <li | |
| 83 | + class="s-li" | |
| 84 | + v-for="(item, index) in studentList" | |
| 85 | + :key="item.id" | |
| 86 | + > | |
| 83 | 87 | <el-popconfirm |
| 84 | - title="确定删除吗?" | |
| 85 | - @confirm="removeStu(item,index)" | |
| 86 | - > | |
| 87 | - <i class="el-icon-delete" slot="reference"></i> | |
| 88 | + title="确定删除吗?" | |
| 89 | + @confirm="removeStu(item, index)" | |
| 90 | + > | |
| 91 | + <i class="el-icon-delete" slot="reference"></i> | |
| 88 | 92 | </el-popconfirm> |
| 89 | 93 | <p class="name">{{ item.studentName }}</p> |
| 90 | 94 | <p class="p1"> |
| ... | ... | @@ -147,6 +151,38 @@ |
| 147 | 151 | <el-button @click="diaStu = false">取 消</el-button> |
| 148 | 152 | </div> |
| 149 | 153 | </el-dialog> |
| 154 | + <el-dialog title="修改班级" :visible.sync="diaClass" width="400"> | |
| 155 | + <el-form | |
| 156 | + class="form-box" | |
| 157 | + ref="formClass" | |
| 158 | + :model="formClass" | |
| 159 | + :rules="rulesClass" | |
| 160 | + label-width="160px" | |
| 161 | + > | |
| 162 | + <el-form-item label="所在年级:"> | |
| 163 | + <span>{{ formClass.gradeName }}</span> | |
| 164 | + </el-form-item> | |
| 165 | + <el-form-item label="班级名称:" prop="studentName"> | |
| 166 | + <el-col :span="10"> | |
| 167 | + <el-input maxlength="30" v-model.trim="formClass.className" /> | |
| 168 | + </el-col> | |
| 169 | + </el-form-item> | |
| 170 | + <el-form-item label="入学年份:" prop="studentCode"> | |
| 171 | + <el-col :span="10"> | |
| 172 | + <el-date-picker | |
| 173 | + v-model="formClass.intoSchoolYear" | |
| 174 | + type="year" | |
| 175 | + placeholder="选择年" | |
| 176 | + > | |
| 177 | + </el-date-picker> | |
| 178 | + </el-col> | |
| 179 | + </el-form-item> | |
| 180 | + </el-form> | |
| 181 | + <div class="dialog-footer" slot="footer"> | |
| 182 | + <el-button @click="saveClass">确 定</el-button> | |
| 183 | + <el-button @click="diaClass = false">取 消</el-button> | |
| 184 | + </div> | |
| 185 | + </el-dialog> | |
| 150 | 186 | </div> |
| 151 | 187 | </template> |
| 152 | 188 | |
| ... | ... | @@ -157,6 +193,7 @@ export default { |
| 157 | 193 | return { |
| 158 | 194 | url: "", |
| 159 | 195 | diaStu: false, |
| 196 | + diaClass: false, | |
| 160 | 197 | query: { |
| 161 | 198 | gradeName: "", |
| 162 | 199 | classId: "", |
| ... | ... | @@ -179,6 +216,16 @@ export default { |
| 179 | 216 | { required: true, message: "请输入学生长学号", trigger: "blur" }, |
| 180 | 217 | ], |
| 181 | 218 | }, |
| 219 | + formClass: { | |
| 220 | + gradeName: "", | |
| 221 | + className: "", | |
| 222 | + intoSchoolYear: "", | |
| 223 | + }, | |
| 224 | + rulesClass: { | |
| 225 | + className: [ | |
| 226 | + { required: true, message: "请输入班级名称", trigger: "blur" }, | |
| 227 | + ], | |
| 228 | + }, | |
| 182 | 229 | gradeName: "", |
| 183 | 230 | gradeList: [], |
| 184 | 231 | classList: [], |
| ... | ... | @@ -213,13 +260,41 @@ export default { |
| 213 | 260 | this.formStu.className = obj.className; |
| 214 | 261 | this._QueryData(3); |
| 215 | 262 | }, |
| 216 | - async removeStu(obj,index) { | |
| 217 | - const { data, status, info } = await this.$request.delStudent({ | |
| 263 | + setClass(obj) { | |
| 264 | + this.formClass.gradeName = obj.gradeName; | |
| 265 | + this.formClass.classId = obj.id; | |
| 266 | + this.formClass.className = obj.className; | |
| 267 | + this.formClass.intoSchoolYear = obj.intoSchoolYear + ""; | |
| 268 | + this.diaClass = true; | |
| 269 | + }, | |
| 270 | + saveClass() { | |
| 271 | + this.$refs.formClass.validate(async (valid) => { | |
| 272 | + if (valid) { | |
| 273 | + const { data, status, info } = await this.$request.updateClass({ | |
| 274 | + classId: this.formClass.classId, | |
| 275 | + className: this.formClass.className, | |
| 276 | + intoSchoolYear: this.formClass.intoSchoolYear, | |
| 277 | + }); | |
| 278 | + if (status === 0) { | |
| 279 | + this.$message.success("修改成功"); | |
| 280 | + this.diaClass = false; | |
| 281 | + this._QueryClass(); | |
| 282 | + } else { | |
| 283 | + this.$message.error(info); | |
| 284 | + } | |
| 285 | + } else { | |
| 286 | + console.log("输入有误请检查!"); | |
| 287 | + return false; | |
| 288 | + } | |
| 289 | + }); | |
| 290 | + }, | |
| 291 | + async removeStu(obj, index) { | |
| 292 | + const { data, status, info } = await this.$request.delStudent({ | |
| 218 | 293 | studentId: obj.id, |
| 219 | 294 | }); |
| 220 | 295 | if (status === 0) { |
| 221 | 296 | this.$message.success("删除成功"); |
| 222 | - this.studentList.splice(index,1) | |
| 297 | + this.studentList.splice(index, 1); | |
| 223 | 298 | } else { |
| 224 | 299 | this.$message.error(info); |
| 225 | 300 | } | ... | ... |
src/views/setUp/teacher.vue
| ... | ... | @@ -94,8 +94,11 @@ |
| 94 | 94 | </div> |
| 95 | 95 | <div class="teacher-detail"> |
| 96 | 96 | <div class="icon-box"> |
| 97 | - <i class="icon el-icon-edit-outline" @click="editTeacher"></i> | |
| 98 | - <i class="icon el-icon-circle-plus-outline"></i> | |
| 97 | + <i class="icon el-icon-edit-outline" @click="editTeacher(1)"></i> | |
| 98 | + <i | |
| 99 | + class="icon el-icon-circle-plus-outline" | |
| 100 | + @click="editTeacher(2)" | |
| 101 | + ></i> | |
| 99 | 102 | </div> |
| 100 | 103 | <div class="detail-top"> |
| 101 | 104 | <p class="p-item">手机号码:{{ teacherDetail.loginName }}</p> |
| ... | ... | @@ -210,7 +213,11 @@ |
| 210 | 213 | <el-button @click="diaUp = false">取 消</el-button> |
| 211 | 214 | </div> |
| 212 | 215 | </el-dialog> |
| 213 | - <el-dialog title="添加教师" :visible.sync="diaTeacher" width="400"> | |
| 216 | + <el-dialog | |
| 217 | + :title="isAdd ? '添加教师' : setTercherType==1?'编辑教师信息':'管理班级'" | |
| 218 | + :visible.sync="diaTeacher" | |
| 219 | + width="400" | |
| 220 | + > | |
| 214 | 221 | <el-form |
| 215 | 222 | class="form-box" |
| 216 | 223 | ref="formTeacher" |
| ... | ... | @@ -218,23 +225,30 @@ |
| 218 | 225 | :rules="rulesTeacher" |
| 219 | 226 | label-width="160px" |
| 220 | 227 | > |
| 221 | - <el-form-item label="手机号码:" prop="loginName"> | |
| 228 | + <el-form-item v-show="isAdd || (!isAdd && setTercherType == 2)" label="教师姓名:"> | |
| 229 | + <span>{{formTeacher.teacherName}}</span> | |
| 230 | + </el-form-item> | |
| 231 | + <el-form-item | |
| 232 | + v-show="isAdd || (!isAdd && setTercherType == 1)" | |
| 233 | + label="手机号码:" | |
| 234 | + prop="loginName" | |
| 235 | + > | |
| 222 | 236 | <el-col :span="10"> |
| 223 | 237 | <el-input maxlength="11" v-model.trim="formTeacher.loginName" /> |
| 224 | 238 | </el-col> |
| 225 | 239 | </el-form-item> |
| 226 | - <el-form-item label="教师姓名:" prop="teacherName"> | |
| 240 | + <el-form-item v-show="isAdd || (!isAdd && setTercherType == 1)" label="教师姓名:" prop="teacherName"> | |
| 227 | 241 | <el-col :span="10"> |
| 228 | 242 | <el-input maxlength="30" v-model.trim="formTeacher.teacherName" /> |
| 229 | 243 | </el-col> |
| 230 | 244 | </el-form-item> |
| 231 | - <el-form-item label="性别:" prop="sex"> | |
| 245 | + <el-form-item v-show="isAdd || (!isAdd && setTercherType == 1)" label="性别:" prop="sex"> | |
| 232 | 246 | <el-radio-group v-model="formTeacher.sex"> |
| 233 | 247 | <el-radio :label="1">男</el-radio> |
| 234 | 248 | <el-radio :label="2">女</el-radio> |
| 235 | 249 | </el-radio-group> |
| 236 | 250 | </el-form-item> |
| 237 | - <el-form-item label="教师角色:" prop="roleList"> | |
| 251 | + <el-form-item v-show="isAdd || (!isAdd && setTercherType == 2)" label="教师角色:" prop="roleList"> | |
| 238 | 252 | <div |
| 239 | 253 | class="role-list" |
| 240 | 254 | v-for="(item, index) in formTeacher.roleList" |
| ... | ... | @@ -247,7 +261,7 @@ |
| 247 | 261 | @change="item.classId = []" |
| 248 | 262 | > |
| 249 | 263 | <el-option |
| 250 | - v-for="item in teacherTypeList" | |
| 264 | + v-for="item in teacherRoleList" | |
| 251 | 265 | :key="item.value" |
| 252 | 266 | :label="item.label" |
| 253 | 267 | :value="item.value" |
| ... | ... | @@ -292,7 +306,7 @@ |
| 292 | 306 | </el-form-item> |
| 293 | 307 | </el-form> |
| 294 | 308 | <div class="dialog-footer" slot="footer"> |
| 295 | - <el-button @click="addTeacher">确 定</el-button> | |
| 309 | + <el-button type="primary" @click="addTeacher">确 定</el-button> | |
| 296 | 310 | <el-button @click="diaTeacher = false">取 消</el-button> |
| 297 | 311 | </div> |
| 298 | 312 | </el-dialog> |
| ... | ... | @@ -309,6 +323,7 @@ export default { |
| 309 | 323 | diaUp: false, |
| 310 | 324 | diaTeacher: false, |
| 311 | 325 | isAdd: false, |
| 326 | + setTercherType: 1, | |
| 312 | 327 | query: { |
| 313 | 328 | gradeName: "", |
| 314 | 329 | teacherName: "", |
| ... | ... | @@ -320,7 +335,8 @@ export default { |
| 320 | 335 | gradeClassList: [], |
| 321 | 336 | gradeSubList: [], |
| 322 | 337 | teacherList: [], |
| 323 | - teacherTypeList: [ | |
| 338 | + teacherRoleList: [ | |
| 339 | + //角色 | |
| 324 | 340 | { |
| 325 | 341 | value: 6, |
| 326 | 342 | label: "班主任", |
| ... | ... | @@ -409,7 +425,8 @@ export default { |
| 409 | 425 | this.showTId = obj.id; |
| 410 | 426 | this.teacherDetail = { ...obj }; |
| 411 | 427 | }, |
| 412 | - editTeacher() { | |
| 428 | + editTeacher(type) { | |
| 429 | + this.setTercherType = type | |
| 413 | 430 | this.isAdd = false; |
| 414 | 431 | for (let key in this.teacherDetail) { |
| 415 | 432 | if (key == "realName") { |
| ... | ... | @@ -476,14 +493,14 @@ export default { |
| 476 | 493 | classId: item.classId[1], |
| 477 | 494 | className: this.classList.find( |
| 478 | 495 | (items) => items.value == item.classId[1] |
| 479 | - ).label, | |
| 496 | + )?.label||"", | |
| 480 | 497 | }); |
| 481 | 498 | } else if (item.roleId == 7) { |
| 482 | 499 | teacherCourseList.push({ |
| 483 | 500 | classId: item.classId[0], |
| 484 | 501 | className: this.classList.find( |
| 485 | 502 | (items) => items.value == item.classId[0] |
| 486 | - ).label, | |
| 503 | + )?.label||"", | |
| 487 | 504 | subjectName: item.classId[1], |
| 488 | 505 | }); |
| 489 | 506 | } else { |
| ... | ... | @@ -491,7 +508,7 @@ export default { |
| 491 | 508 | grade: item.classId[0], |
| 492 | 509 | gradeName: this.gradeList.find( |
| 493 | 510 | (items) => items.id == item.classId[0] |
| 494 | - ).label, | |
| 511 | + )?.label||"", | |
| 495 | 512 | subjectName: item.classId[1], |
| 496 | 513 | }); |
| 497 | 514 | } |
| ... | ... | @@ -578,7 +595,7 @@ export default { |
| 578 | 595 | query = { ...this.query }; |
| 579 | 596 | } |
| 580 | 597 | this.loading = true; |
| 581 | - this.teacherList=[] | |
| 598 | + this.teacherList = []; | |
| 582 | 599 | const { data, status, info } = await this.$request.teacherList({ |
| 583 | 600 | ...query, |
| 584 | 601 | }); | ... | ... |