Jelajahi Sumber

选择题判分系统 选择班级名单改造

dengshaobo 2 minggu lalu
induk
melakukan
0b5700a923

+ 6 - 1
src/router/index.ts

@@ -59,10 +59,15 @@ const routes: Array<RouteRecordRaw> = [
         name: 'scanDetail',
         component: () => import('@/views/exam/scanDetail.vue')
       },
+      // {
+      //   path: 'selectExamination',
+      //   name: 'selectExamination',
+      //   component: () => import('@/views/exam/selectExamination.vue')
+      // },
       {
         path: 'selectExamination',
         name: 'selectExamination',
-        component: () => import('@/views/exam/selectExamination.vue')
+        component: () => import('@/views/exam/selectStudent.vue')
       },
       {
         path: 'examList',

+ 3 - 3
src/styles/common.scss

@@ -151,7 +151,7 @@ body {
     cursor: pointer;
     border: 1px solid #bbbbbb;
     font-weight: 400;
-    font-size: 16px;
+    font-size: 14px;
     color: #bbbbbb;
     cursor: pointer;
   }
@@ -165,7 +165,7 @@ body {
 
     border: 1px solid #bbbbbb;
     font-weight: 400;
-    font-size: 16px;
+    font-size: 14px;
     color: #bbbbbb;
     cursor: pointer;
   }
@@ -173,7 +173,7 @@ body {
   .select_cur {
     background: #2e64fa;
     font-weight: 400;
-    font-size: 16px;
+    font-size: 14px;
     color: #ffffff;
     cursor: pointer;
     border: 1px solid #2e64fa;

+ 0 - 1
src/views/exam/scanList.vue

@@ -264,7 +264,6 @@ const HasImportStudent = async () => {
         //跳转导入学生名单界面
         router.push({
             name: 'selectExamination',
-           
         });
     }
 }

+ 1 - 1
src/views/exam/selectExamination.vue

@@ -81,7 +81,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
 import SelectStudent from './components/selectStudent.vue'
 // import SelectHistoryList from './ReviewBlock/SelectHistoryList.vue'
 import { useExamStore } from '@/store/exam'
-
+ 
 const route = useRoute()
 const router = useRouter()
 const examStore = useExamStore()

+ 228 - 0
src/views/exam/selectStudent.vue

@@ -0,0 +1,228 @@
+<template>
+<div class="select_class">
+    
+    <div class="message_title">
+      请选择参加考试的班级,再点击确认按钮
+    </div>
+    <div class="class_type">
+      <div class="right_user_tab">
+          <!-- 按考场 1  按班级 2 -->
+          <div class="tab_system_user" :class="activeName == 1?'select_cur':''" @click="ChangeClassType(1)">
+              行政班
+          </div>
+          <div class="tab_temporay_user" :class="activeName == 2?'select_cur':''" @click="ChangeClassType(2)">
+              教学班
+          </div>
+      </div>
+    </div>
+    <div class="page_jg_20">
+
+    </div>
+    <div class="class_list" >
+      <div class="list_item" :class="selectedIds.includes(item.classId) ? 'list_item_cur' : ''" v-for="(item,index) in tableData"  @click="SelectClass(item)">
+        <span>
+          {{ item.className }}{{ item.className.includes('班') ? '' : '班' }}
+        </span>
+        <span>
+          {{item.userTotal}}人
+        </span>
+      </div>
+      
+    </div>
+    <div class="class_button">
+       <el-button type="primary" :loading="loading" @click="HandleSubmit">确定</el-button>
+    </div>
+   
+</div>
+</template>
+
+<script lang="ts" setup>
+import { ref, reactive, computed, watch,onMounted } from 'vue'
+import type { ElTableColumn, FormInstance, FormRules } from 'element-plus'
+import { ElMessage,ElTable } from 'element-plus'
+import { useRouter,useRoute} from 'vue-router'
+const router = useRouter()
+// 1. 确保导入接口函数,请根据实际路径调整
+import { getClassList,useClassList } from '@/api/exam' 
+import { useExamStore } from '@/store/exam'
+
+
+const route = useRoute()
+// 实例化 Store
+const examStore = useExamStore()
+
+//定义用于存储下拉菜单选项的响应式数据
+const tableData=ref<any[]>([]);
+
+const selectedIds=ref<any[]>([]);//选中的班级id列表
+
+const loading=ref(false);//加载状态
+const activeName=ref(1);//1-行政班 2-教学班
+
+// 考试科目 ID
+const examSubjectId = computed(() => {
+  // 替换为: return makeTemplateStore.examTempDetail?.id
+  return examStore.currentExam?.id
+})//计算属性
+
+//切换班级类型
+const ChangeClassType=async(type:number)=>{
+  activeName.value=type;
+  GetClassList();
+}
+
+// 选中班级id
+const SelectClass=(item:any)=>{
+
+  const index = selectedIds.value.indexOf(item.classId)
+  if (index > -1) {
+    selectedIds.value.splice(index, 1)
+  } else {
+    selectedIds.value.push(item.classId)
+  }
+}
+
+onMounted(()=>{
+  GetClassList();
+})
+
+// 获取班级列表
+const GetClassList=async()=>{
+  const params={
+    examSubjectId:examSubjectId.value,
+    schoolId:0,
+  };
+  const res:any = await getClassList(params);
+  console.log("打印获取的结果",res)
+  if(res.code==200 && res.data)
+  {
+    tableData.value=res.data.adminClasses;
+    console.log("打印formData",tableData.value)
+    // selectedId.value=tableData.value[0].classId;
+
+   
+  }
+}
+
+
+
+
+// 确定按钮
+const HandleSubmit= () => { 
+  console.log("确定选择模板")
+
+  console.log("examSubjectId",examSubjectId.value)
+  if(selectedIds.value.length==0)
+  {
+    ElMessage.error("请至少选择一个班级!");
+    return;
+  }
+  const params={
+    examSubjectId:examSubjectId.value,
+    classIds:selectedIds.value,
+    reuse:Number(route.query.reuse) || 0,//是否是重新使用名单 0-否 1-是
+    schoolId:0,//学校id
+  };
+  loading.value=true;
+  useClassList(params).then((res:any)=>{
+    loading.value=false;
+    if(res.code==200)
+    {
+      ElMessage.success("操作成功!");
+      
+      router.push({
+          name: 'scanList',
+      });
+    }
+    else
+    {
+      ElMessage.error(res.msg || "操作失败!");
+    }
+  })
+}
+
+
+</script>
+
+<style lang="scss" scoped>
+.select_class
+{
+  width: 100%;
+  height: 100%;
+  background: #FFFFFF;
+  border-radius: 5px 5px 5px 5px;
+  padding: 20px;
+  box-sizing: border-box;
+
+  .message_title
+  {
+    font-weight: 550;
+    font-size: 16px;
+    color: #333333;
+
+  }
+  .class_type
+  {
+    width: 100%;
+    .right_user_tab
+    {
+      width:124px;
+      margin-left: 0px;
+    }
+  }
+
+  .class_list
+  {
+    display: flex;
+    justify-content: flex-start;
+    flex-wrap: wrap;
+    gap: 20px;
+    height: calc(100% - 160px);
+    overflow-y: auto;
+    .list_item
+    {
+      width:154px;
+      height:60px;
+      border-radius: 8px 8px 8px 8px;
+      border: 1px solid #E0E0E0;
+      line-height: 60px;
+      padding-left: 20px;
+      padding-right: 20px;
+      box-sizing: border-box;
+
+      font-weight: 400;
+      font-size: 16px;
+      color: #333333;
+
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+
+      cursor: pointer;
+    }
+
+    .list_item_cur
+    {
+      font-weight: 400;
+      font-size: 16px;
+      color: #2E64FA;
+      background: rgba(46,100,250,0.1);
+      border: 1px solid #2E64FA;
+    }
+  }
+
+  .class_button
+  {
+    width: 100%;
+    display: flex;
+    justify-content: center;
+    height: 60px;
+
+    padding-top: 20px;
+    .el-button
+    {
+      width: 200px;
+    }
+  }
+}
+</style>