From 3980b7b055eb1d790a5fe1f588a1a6441fc50472 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 28 十月 2024 18:31:47 +0800
Subject: [PATCH] 12.学生列表中的添加学生 14.题目难度导入 17.建议时长

---
 src/views/class-management/ClassStaff.vue |   94 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 60 insertions(+), 34 deletions(-)

diff --git a/src/views/class-management/ClassStaff.vue b/src/views/class-management/ClassStaff.vue
index e737a14..18b7d74 100644
--- a/src/views/class-management/ClassStaff.vue
+++ b/src/views/class-management/ClassStaff.vue
@@ -85,24 +85,35 @@
       :before-close="handleAddClose"
       :close-on-click-modal="false">
       <el-form :model="studentForm" :rules="studentRules" ref="studentForm" label-width="100px" class="demo-ruleForm">
-        <el-form-item label="濮撳悕" prop="realName">
-          <el-input v-model="studentForm.realName"></el-input>
-        </el-form-item>
-        <el-form-item label="鎬у埆" prop="sex">
-          <el-select v-model="studentForm.sex">
-            <el-option label="鐢�" :value="1"></el-option>
-            <el-option label="濂�" :value="2"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="鐢佃瘽" prop="phone">
-          <el-input v-model="studentForm.phone"></el-input>
-        </el-form-item>
-        <el-form-item label="鐧诲綍璐﹀彿" prop="account">
-          <el-input v-model="studentForm.account"></el-input>
-        </el-form-item>
-        <el-form-item label="鐧诲綍瀵嗙爜" prop="password">
-          <el-input v-model="studentForm.password" show-password placeholder="涓嶅~鍐欎細浣跨敤榛樿202406"></el-input>
-        </el-form-item>
+        <el-form-item label="鐪熷疄濮撳悕锛�" prop="realName" required>
+        <el-input v-model="studentForm.realName"></el-input>
+      </el-form-item>
+      <el-form-item label="鎵嬫満鍙风爜锛�" prop="phone" required>
+        <el-input v-model="studentForm.phone"></el-input>
+      </el-form-item>
+      <el-form-item label="鐧诲綍璐﹀彿锛�" prop="userName" required>
+        <el-input v-model="studentForm.userName" autocomplete="off"></el-input>
+      </el-form-item>
+      <el-form-item v-if="!studentForm.id" label="鐧诲綍瀵嗙爜锛�" prop="password" required>
+        <el-input v-model="studentForm.password" show-password autocomplete="off"></el-input>
+      </el-form-item>
+      <el-form-item label="骞撮緞锛�">
+        <el-input v-model="studentForm.age"></el-input>
+      </el-form-item>
+      <el-form-item label="鎬у埆锛�">
+        <el-select v-model="studentForm.sex" placeholder="鎬у埆" clearable>
+          <el-option v-for="item in sexEnum" :key="item.key" :value="item.key" :label="item.value"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="鍑虹敓鏃ユ湡锛�">
+        <el-date-picker v-model="studentForm.birthDay" type="date" value-format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡"/>
+      </el-form-item>
+
+      <el-form-item label="鐘舵�侊細" required>
+        <el-select v-model="studentForm.status" placeholder="鐘舵��">
+          <el-option v-for="item in statusEnum" :key="item.key" :value="item.key" :label="item.value"></el-option>
+        </el-select>
+      </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="handleAddClose">鍙� 娑�</el-button>
@@ -139,6 +150,7 @@
 <script>
 // 寮曞叆褰堝嚭绐楀彛绲勪欢
 import UserApi from '@/api/user'
+import { mapGetters, mapState } from 'vuex'
 import {
   updateClassesUser,
   getClassesUsers,
@@ -147,7 +159,6 @@
   editClassesUser
 } from '@/api/classesUser'
 import Pagination from '@/components/Pagination'
-import {deleteExamById} from "@/api/exam";
 
 export default {
   components: { Pagination },
@@ -158,22 +169,23 @@
         realName: '',
         sex: 1,
         phone: '',
+        birthDay: '',
         age: null,
-        account: '',
+        userName: '',
         password: ''
       },
       studentRules: {
         realName: [
-          { required: true, message: '璇峰~鍐欏鍛樺鍚�', trigger: 'blur' },
+          { required: true, message: '璇峰~鍐欏鍛樺鍚�', trigger: 'blur' }
         ],
         sex: [
-          { required: true, message: '璇烽�夋嫨瀛﹀憳鎬у埆', trigger: 'change' },
+          { required: true, message: '璇烽�夋嫨瀛﹀憳鎬у埆', trigger: 'change' }
         ],
         phone: [
-          { required: true, message: '璇峰~鍐欏鍛樼數璇�', trigger: 'blur' },
+          { required: true, message: '璇峰~鍐欏鍛樼數璇�', trigger: 'blur' }
         ],
-        account: [
-          { required: true, message: '璇峰~鍐欏鍛樼櫥褰曡处鍙�', trigger: 'blur' },
+        userName: [
+          { required: true, message: '璇峰~鍐欏鍛樼櫥褰曡处鍙�', trigger: 'blur' }
         ]
       },
       studentTitle: '鏂板瀛﹀憳',
@@ -196,9 +208,9 @@
       formLabelAlign: {
         type: '',
         user: '',
-        region: '',
+        region: ''
       },
-      tableData: [],
+      tableData: []
     }
   },
   mounted () {
@@ -229,7 +241,7 @@
               this.page()
               this.resetStudentForm()
             })
-          }else {
+          } else {
             addClassesUser(this.studentForm).then(res => {
               this.addOpen = false
               this.$message.success(res.data.message)
@@ -242,10 +254,14 @@
     },
     resetStudentForm () {
       this.studentForm = {
+        id: null,
         realName: '',
-        sex: '',
+        sex: 1,
         phone: '',
-        age: null
+        birthDay: '',
+        age: null,
+        userName: '',
+        password: ''
       }
     },
     handleAddClose () {
@@ -322,17 +338,28 @@
     // 鐢熸垚璇曞嵎
     getCreate () {
       // 璺宠浆鍒扮敓鎴愰〉闈�
-      //璺宠浆鍒板搴旂殑绠$悊椤甸潰
+      // 璺宠浆鍒板搴旂殑绠$悊椤甸潰
       this.$router.push({
-        path: '/manage/test-paper-generation',
+        path: '/manage/test-paper-generation'
       })
     },
     // 寮圭獥
     // 鎺ユ敹寮圭獥缁勪欢杩斿洖鐨勮〃鍗曞��
     parentGoods (obj) {
       console.log(obj, '寮圭獥缁勪欢鐨勮〃鍗曞��')
-    },
+    }
   },
+  computed: {
+    ...mapGetters('enumItem', [
+      'enumFormat'
+    ]),
+    ...mapState('enumItem', {
+      sexEnum: state => state.user.sexEnum,
+      roleEnum: state => state.user.roleEnum,
+      statusEnum: state => state.user.statusEnum,
+      levelEnum: state => state.user.levelEnum
+    })
+  }
 }
 </script>
 <style scoped lang="scss">
@@ -351,4 +378,3 @@
   margin-right: 5px;
 }
 </style>
-

--
Gitblit v1.8.0