Browse Source

选择题判分试题结构设置优化

dengshaobo 3 weeks ago
parent
commit
0a72800144

+ 2 - 1
src/styles/common.scss

@@ -4760,8 +4760,9 @@ body {
   }
 
   .full_mark_input {
-    width: 88px;
+    width: 65px;
     margin: auto;
+    text-align: center;
   }
 
   //表格内 通用输入框

+ 3 - 1
src/views/exam/abnormal/tableList.vue

@@ -1131,11 +1131,13 @@ const UploadDelete = async (item: any) => {
     console.log("已上传删除item",item);
     try {
         // 显示确认对话框
-        await ElMessageBox.confirm('是否要删除此条数据?', '提示', {
+        let msg = `确定要删除当前选择的学生<span style="color:#F56C6C;font-weight:600;">「${item.studentName}」</span>的答题卡吗?`;
+        await ElMessageBox.confirm(msg, '提示', {
             confirmButtonText: '确定',
             cancelButtonText: '取消',
             closeOnClickModal: false,
             type: 'warning',
+            dangerouslyUseHTMLString: true,
             customClass: 'page_dialog'
         });
         

+ 26 - 5
src/views/exam/question.vue

@@ -60,7 +60,7 @@
         <div class="page_jg_16"></div>
         <div class="table_42">
             <el-table :data="tableData" v-loading="tableLoading" element-loading-text="加载中……" element-loading-spinner="el-icon-loading" element-loading-background="#ffffff" style="width: 100%" :height="tableHeight">
-                <el-table-column prop="questionName" label="题目名称" width="100">
+                <el-table-column prop="questionName" label="题目名称" width="80">
                 </el-table-column>
                 <!-- 题目类型 questionType 1 单校  2多选 -->
                 <el-table-column prop="questionType" label="题目类型" width="120">
@@ -71,7 +71,7 @@
                         </el-select>
                     </template>
                 </el-table-column>
-                <el-table-column prop="date" label="标注答案" width="242">
+                <el-table-column prop="date" label="标注答案" width="442">
                     <template v-slot="scope">
                         <div class="answer_input">
                             <!-- 单选题 -->
@@ -91,7 +91,7 @@
                         </div>
                     </template>
                 </el-table-column>
-                <el-table-column prop="fullScore" label="满分" width="120">
+                <el-table-column prop="fullScore" label="满分" width="90">
                     <template v-slot="scope">
                         <div class="full_mark_input">
                             <el-input v-model="scope.row.fullScore" maxlength="3" @input="(val: any) => onScoreInput(scope.row, 'fullScore', val)"></el-input>
@@ -126,7 +126,7 @@
                         </div>
                     </template>
                 </el-table-column>
-                <el-table-column prop="name" label="操作" width="150">
+                <el-table-column prop="name" label="操作" width="100">
                     <template v-slot="scope">
                         <div class="ele_button table_row_button">
                             <span class="btn_editor" @click="EditorSingle(scope.row)">编辑</span>
@@ -520,10 +520,12 @@ const EditorAnswerEnter=async (item:any)=>{
 //删除单个题目 需要二次弹窗确认提示
 const DeleteSingle=(item:any)=>{
     console.log("打印删除单个",item)
-    ElMessageBox.confirm('确认删除该题目吗?', '提示', {
+    let msg = `确定要删除当前选择的<span style="color:#F56C6C;font-weight:600;">「${item.questionName}」</span>题吗?`;
+    ElMessageBox.confirm(msg, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         customClass:'page_dialog',
+        dangerouslyUseHTMLString: true,
         type: 'warning'
     }).then(async () => {
         console.log('删除考试')
@@ -822,13 +824,32 @@ const GetSmartQuestionList=()=>{
             // 增加空值保护,确保 tableData 始终是数组
             tableData.value = Array.isArray(res.data) ? res.data : [];
             let result={};
+            let maxQuestionNo = 0;//已有试题的最大题号
             for (const item of tableData.value) {
                 // name转数字作为key
                 const key = (item.questionName);
                 result[key] = item.standardAnswer;
+                // 提取 questionName 中的数字题号,兼容 "1" / "第1题" 等格式
+                const match = String(item.questionName ?? '').match(/\d+/);
+                if (match) {
+                    const no = Number(match[0]);
+                    if (no > maxQuestionNo) maxQuestionNo = no;
+                }
             }
             previewAnswerData.value=result;
             console.log("打印转换后的数据",result)
+
+            // 根据已有试题列表设置题目范围默认值
+            // 规则:已有题目 1-10,则 start 从 11 开始,end 为模板最大题数
+            const endMax = Number(templateQuestionEnd.value) || 0;
+            if (tableData.value.length > 0) {
+                queryParams.value.start = maxQuestionNo + 1;
+                queryParams.value.end = endMax;
+            } else {
+                // 无已有试题时,回退为模板完整范围
+                queryParams.value.start = Number(templateQuestionStart.value) || 1;
+                queryParams.value.end = endMax;
+            }
         }
     }).finally(()=>{
         tableLoading.value = false;//关闭表格loading

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

@@ -882,10 +882,12 @@ const OptionDelete=(row: any) => {
     
     if(row.scanUserName==currentUserName.value)
     {
-        ElMessageBox.confirm('确定要删除该批次吗?', '提示', {
+        let msg = `确定要删除当前选择的<span style="color:#F56C6C;font-weight:600;">「批次${row.batchNo}」</span>的数据吗?`;
+        ElMessageBox.confirm(msg, '提示', {
             confirmButtonText: '确定',
             cancelButtonText: '取消',
             customClass:'page_dialog',
+            dangerouslyUseHTMLString: true,
             type: 'warning'
         }).then(() => {
             // 删除操作