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,7 +228,7 @@ | ||
| 228 | :step="1" | 228 | :step="1" | 
| 229 | :step-strictly="true" | 229 | :step-strictly="true" | 
| 230 | ></el-input-number> | 230 | ></el-input-number> | 
| 231 | - {{ examsDuration ? "秒" : "" }} | 231 | + {{ examsDuration ? "分" : "" }} | 
| 232 | </el-form-item> | 232 | </el-form-item> | 
| 233 | <el-form-item label="答题结构展示:" prop="displayModel"> | 233 | <el-form-item label="答题结构展示:" prop="displayModel"> | 
| 234 | <el-radio-group v-model="formData.displayModel"> | 234 | <el-radio-group v-model="formData.displayModel"> | 
| @@ -327,7 +327,7 @@ export default { | @@ -327,7 +327,7 @@ export default { | ||
| 327 | multipleChoiceNum: 4, | 327 | multipleChoiceNum: 4, | 
| 328 | singleTypeNum: 20, | 328 | singleTypeNum: 20, | 
| 329 | askCountdown: 30, | 329 | askCountdown: 30, | 
| 330 | - examsDuration: 5400, | 330 | + examsDuration: 90, | 
| 331 | displayModel: 0, | 331 | displayModel: 0, | 
| 332 | languageSet: 0, | 332 | languageSet: 0, | 
| 333 | otherSet: [], | 333 | otherSet: [], | 
| @@ -401,6 +401,9 @@ export default { | @@ -401,6 +401,9 @@ export default { | ||
| 401 | for (let key in this.formData) { | 401 | for (let key in this.formData) { | 
| 402 | content[key] ? (this.formData[key] = content[key]) : ""; | 402 | content[key] ? (this.formData[key] = content[key]) : ""; | 
| 403 | } | 403 | } | 
| 404 | + this.formData.examsDuration = (this.formData.examsDuration / 60).toFixed( | ||
| 405 | + 0 | ||
| 406 | + ); | ||
| 404 | this.type = 2; | 407 | this.type = 2; | 
| 405 | (this.configId = obj.id), (this.dialogVis = true); | 408 | (this.configId = obj.id), (this.dialogVis = true); | 
| 406 | }, | 409 | }, | 
| @@ -418,7 +421,7 @@ export default { | @@ -418,7 +421,7 @@ export default { | ||
| 418 | }, | 421 | }, | 
| 419 | examsDurationChange(val) { | 422 | examsDurationChange(val) { | 
| 420 | if (val) { | 423 | if (val) { | 
| 421 | - this.formData.examsDuration = 5400; | 424 | + this.formData.examsDuration = 90; | 
| 422 | } else { | 425 | } else { | 
| 423 | this.formData.examsDuration = 0; | 426 | this.formData.examsDuration = 0; | 
| 424 | } | 427 | } | 
| @@ -430,6 +433,7 @@ export default { | @@ -430,6 +433,7 @@ export default { | ||
| 430 | content[key] = this.formData[key]; | 433 | content[key] = this.formData[key]; | 
| 431 | } | 434 | } | 
| 432 | } | 435 | } | 
| 436 | + content.examsDuration = content.examsDuration * 60; | ||
| 433 | 437 | ||
| 434 | if (this.type == 1) { | 438 | if (this.type == 1) { | 
| 435 | this.addAppConfig({ | 439 | this.addAppConfig({ | 
src/views/setUp/student.vue
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | :class="query.classId == item.id ? 'active' : ''" | 44 | :class="query.classId == item.id ? 'active' : ''" | 
| 45 | @click="classDetail(item)" | 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 | {{ item.className }}({{ item.studentCount }}) | 48 | {{ item.className }}({{ item.studentCount }}) | 
| 49 | </li> | 49 | </li> | 
| 50 | </ul> | 50 | </ul> | 
| @@ -79,12 +79,16 @@ | @@ -79,12 +79,16 @@ | ||
| 79 | </div> | 79 | </div> | 
| 80 | </div> | 80 | </div> | 
| 81 | <ul class="s-ul" v-loading="loading"> | 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 | <el-popconfirm | 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 | </el-popconfirm> | 92 | </el-popconfirm> | 
| 89 | <p class="name">{{ item.studentName }}</p> | 93 | <p class="name">{{ item.studentName }}</p> | 
| 90 | <p class="p1"> | 94 | <p class="p1"> | 
| @@ -147,6 +151,38 @@ | @@ -147,6 +151,38 @@ | ||
| 147 | <el-button @click="diaStu = false">取 消</el-button> | 151 | <el-button @click="diaStu = false">取 消</el-button> | 
| 148 | </div> | 152 | </div> | 
| 149 | </el-dialog> | 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 | </div> | 186 | </div> | 
| 151 | </template> | 187 | </template> | 
| 152 | 188 | ||
| @@ -157,6 +193,7 @@ export default { | @@ -157,6 +193,7 @@ export default { | ||
| 157 | return { | 193 | return { | 
| 158 | url: "", | 194 | url: "", | 
| 159 | diaStu: false, | 195 | diaStu: false, | 
| 196 | + diaClass: false, | ||
| 160 | query: { | 197 | query: { | 
| 161 | gradeName: "", | 198 | gradeName: "", | 
| 162 | classId: "", | 199 | classId: "", | 
| @@ -179,6 +216,16 @@ export default { | @@ -179,6 +216,16 @@ export default { | ||
| 179 | { required: true, message: "请输入学生长学号", trigger: "blur" }, | 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 | gradeName: "", | 229 | gradeName: "", | 
| 183 | gradeList: [], | 230 | gradeList: [], | 
| 184 | classList: [], | 231 | classList: [], | 
| @@ -213,13 +260,41 @@ export default { | @@ -213,13 +260,41 @@ export default { | ||
| 213 | this.formStu.className = obj.className; | 260 | this.formStu.className = obj.className; | 
| 214 | this._QueryData(3); | 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 | studentId: obj.id, | 293 | studentId: obj.id, | 
| 219 | }); | 294 | }); | 
| 220 | if (status === 0) { | 295 | if (status === 0) { | 
| 221 | this.$message.success("删除成功"); | 296 | this.$message.success("删除成功"); | 
| 222 | - this.studentList.splice(index,1) | 297 | + this.studentList.splice(index, 1); | 
| 223 | } else { | 298 | } else { | 
| 224 | this.$message.error(info); | 299 | this.$message.error(info); | 
| 225 | } | 300 | } | 
src/views/setUp/teacher.vue
| @@ -94,8 +94,11 @@ | @@ -94,8 +94,11 @@ | ||
| 94 | </div> | 94 | </div> | 
| 95 | <div class="teacher-detail"> | 95 | <div class="teacher-detail"> | 
| 96 | <div class="icon-box"> | 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 | </div> | 102 | </div> | 
| 100 | <div class="detail-top"> | 103 | <div class="detail-top"> | 
| 101 | <p class="p-item">手机号码:{{ teacherDetail.loginName }}</p> | 104 | <p class="p-item">手机号码:{{ teacherDetail.loginName }}</p> | 
| @@ -210,7 +213,11 @@ | @@ -210,7 +213,11 @@ | ||
| 210 | <el-button @click="diaUp = false">取 消</el-button> | 213 | <el-button @click="diaUp = false">取 消</el-button> | 
| 211 | </div> | 214 | </div> | 
| 212 | </el-dialog> | 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 | <el-form | 221 | <el-form | 
| 215 | class="form-box" | 222 | class="form-box" | 
| 216 | ref="formTeacher" | 223 | ref="formTeacher" | 
| @@ -218,23 +225,30 @@ | @@ -218,23 +225,30 @@ | ||
| 218 | :rules="rulesTeacher" | 225 | :rules="rulesTeacher" | 
| 219 | label-width="160px" | 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 | <el-col :span="10"> | 236 | <el-col :span="10"> | 
| 223 | <el-input maxlength="11" v-model.trim="formTeacher.loginName" /> | 237 | <el-input maxlength="11" v-model.trim="formTeacher.loginName" /> | 
| 224 | </el-col> | 238 | </el-col> | 
| 225 | </el-form-item> | 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 | <el-col :span="10"> | 241 | <el-col :span="10"> | 
| 228 | <el-input maxlength="30" v-model.trim="formTeacher.teacherName" /> | 242 | <el-input maxlength="30" v-model.trim="formTeacher.teacherName" /> | 
| 229 | </el-col> | 243 | </el-col> | 
| 230 | </el-form-item> | 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 | <el-radio-group v-model="formTeacher.sex"> | 246 | <el-radio-group v-model="formTeacher.sex"> | 
| 233 | <el-radio :label="1">男</el-radio> | 247 | <el-radio :label="1">男</el-radio> | 
| 234 | <el-radio :label="2">女</el-radio> | 248 | <el-radio :label="2">女</el-radio> | 
| 235 | </el-radio-group> | 249 | </el-radio-group> | 
| 236 | </el-form-item> | 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 | <div | 252 | <div | 
| 239 | class="role-list" | 253 | class="role-list" | 
| 240 | v-for="(item, index) in formTeacher.roleList" | 254 | v-for="(item, index) in formTeacher.roleList" | 
| @@ -247,7 +261,7 @@ | @@ -247,7 +261,7 @@ | ||
| 247 | @change="item.classId = []" | 261 | @change="item.classId = []" | 
| 248 | > | 262 | > | 
| 249 | <el-option | 263 | <el-option | 
| 250 | - v-for="item in teacherTypeList" | 264 | + v-for="item in teacherRoleList" | 
| 251 | :key="item.value" | 265 | :key="item.value" | 
| 252 | :label="item.label" | 266 | :label="item.label" | 
| 253 | :value="item.value" | 267 | :value="item.value" | 
| @@ -292,7 +306,7 @@ | @@ -292,7 +306,7 @@ | ||
| 292 | </el-form-item> | 306 | </el-form-item> | 
| 293 | </el-form> | 307 | </el-form> | 
| 294 | <div class="dialog-footer" slot="footer"> | 308 | <div class="dialog-footer" slot="footer"> | 
| 295 | - <el-button @click="addTeacher">确 定</el-button> | 309 | + <el-button type="primary" @click="addTeacher">确 定</el-button> | 
| 296 | <el-button @click="diaTeacher = false">取 消</el-button> | 310 | <el-button @click="diaTeacher = false">取 消</el-button> | 
| 297 | </div> | 311 | </div> | 
| 298 | </el-dialog> | 312 | </el-dialog> | 
| @@ -309,6 +323,7 @@ export default { | @@ -309,6 +323,7 @@ export default { | ||
| 309 | diaUp: false, | 323 | diaUp: false, | 
| 310 | diaTeacher: false, | 324 | diaTeacher: false, | 
| 311 | isAdd: false, | 325 | isAdd: false, | 
| 326 | + setTercherType: 1, | ||
| 312 | query: { | 327 | query: { | 
| 313 | gradeName: "", | 328 | gradeName: "", | 
| 314 | teacherName: "", | 329 | teacherName: "", | 
| @@ -320,7 +335,8 @@ export default { | @@ -320,7 +335,8 @@ export default { | ||
| 320 | gradeClassList: [], | 335 | gradeClassList: [], | 
| 321 | gradeSubList: [], | 336 | gradeSubList: [], | 
| 322 | teacherList: [], | 337 | teacherList: [], | 
| 323 | - teacherTypeList: [ | 338 | + teacherRoleList: [ | 
| 339 | + //角色 | ||
| 324 | { | 340 | { | 
| 325 | value: 6, | 341 | value: 6, | 
| 326 | label: "班主任", | 342 | label: "班主任", | 
| @@ -409,7 +425,8 @@ export default { | @@ -409,7 +425,8 @@ export default { | ||
| 409 | this.showTId = obj.id; | 425 | this.showTId = obj.id; | 
| 410 | this.teacherDetail = { ...obj }; | 426 | this.teacherDetail = { ...obj }; | 
| 411 | }, | 427 | }, | 
| 412 | - editTeacher() { | 428 | + editTeacher(type) { | 
| 429 | + this.setTercherType = type | ||
| 413 | this.isAdd = false; | 430 | this.isAdd = false; | 
| 414 | for (let key in this.teacherDetail) { | 431 | for (let key in this.teacherDetail) { | 
| 415 | if (key == "realName") { | 432 | if (key == "realName") { | 
| @@ -476,14 +493,14 @@ export default { | @@ -476,14 +493,14 @@ export default { | ||
| 476 | classId: item.classId[1], | 493 | classId: item.classId[1], | 
| 477 | className: this.classList.find( | 494 | className: this.classList.find( | 
| 478 | (items) => items.value == item.classId[1] | 495 | (items) => items.value == item.classId[1] | 
| 479 | - ).label, | 496 | + )?.label||"", | 
| 480 | }); | 497 | }); | 
| 481 | } else if (item.roleId == 7) { | 498 | } else if (item.roleId == 7) { | 
| 482 | teacherCourseList.push({ | 499 | teacherCourseList.push({ | 
| 483 | classId: item.classId[0], | 500 | classId: item.classId[0], | 
| 484 | className: this.classList.find( | 501 | className: this.classList.find( | 
| 485 | (items) => items.value == item.classId[0] | 502 | (items) => items.value == item.classId[0] | 
| 486 | - ).label, | 503 | + )?.label||"", | 
| 487 | subjectName: item.classId[1], | 504 | subjectName: item.classId[1], | 
| 488 | }); | 505 | }); | 
| 489 | } else { | 506 | } else { | 
| @@ -491,7 +508,7 @@ export default { | @@ -491,7 +508,7 @@ export default { | ||
| 491 | grade: item.classId[0], | 508 | grade: item.classId[0], | 
| 492 | gradeName: this.gradeList.find( | 509 | gradeName: this.gradeList.find( | 
| 493 | (items) => items.id == item.classId[0] | 510 | (items) => items.id == item.classId[0] | 
| 494 | - ).label, | 511 | + )?.label||"", | 
| 495 | subjectName: item.classId[1], | 512 | subjectName: item.classId[1], | 
| 496 | }); | 513 | }); | 
| 497 | } | 514 | } | 
| @@ -578,7 +595,7 @@ export default { | @@ -578,7 +595,7 @@ export default { | ||
| 578 | query = { ...this.query }; | 595 | query = { ...this.query }; | 
| 579 | } | 596 | } | 
| 580 | this.loading = true; | 597 | this.loading = true; | 
| 581 | - this.teacherList=[] | 598 | + this.teacherList = []; | 
| 582 | const { data, status, info } = await this.$request.teacherList({ | 599 | const { data, status, info } = await this.$request.teacherList({ | 
| 583 | ...query, | 600 | ...query, | 
| 584 | }); | 601 | }); |