Prechádzať zdrojové kódy

ai选择题判分状态优化

dengshaobo 1 týždeň pred
rodič
commit
485243486f

+ 2 - 0
package.json

@@ -5,6 +5,8 @@
   "type": "module",
   "scripts": {
     "dev": "vite",
+    "serve": "vite",
+    "start": "vite",
     "build:test": "vite build --mode test",
     "build:dev": "vite build --mode production",
     "preview": "vite preview"

+ 0 - 21
src/views/exam/components/stepItem.vue

@@ -169,27 +169,6 @@ const activeIndex = computed(() => {
 
 // --- 方法 ---
 
-// 获取模板数据
-const GetExamProcess = () => {
-  if (!examSubjectId.value) return
-
-  const param = {
-    examSubjectId: examSubjectId.value
-  }
-  //获取考试流程状态
-  getExamProcess(param).then((res: any) => {
-    console.log('获取模板相关数据 包含第三方卡和系统卡', res)
-    if (res.code === 200) {
-      localStorage.setItem('templateData', JSON.stringify(res.data.examCardPageVOS))
-      localStorage.setItem('usedCardType', res.data.usedCardType)
-      
-      // 替换为 Store Commit/Action
-      // makeTemplateStore.setMarkType(res.data.markType)
-      // makeTemplateStore.setUsedCardType(res.data.usedCardType)
-      console.warn('请在此处调用 Store 的 action 更新 markType 和 usedCardType')
-    }
-  })
-}
 
 // 获取考试流程状态
 const GetExamState = () => {

+ 45 - 3
src/views/exam/question.vue

@@ -170,7 +170,7 @@ import ChooseTemplate from './components/chooseTemplate.vue';
 import EditorQuestion from './components/EditorQuestion.vue';
 
 import { ElMessageBox,ElMessage } from 'element-plus' 
-import { getSmartQuestionList,getTemplateInfo,setQuestion,saveQuestion,deleteAllQuestion,deleteSingleQuestion} from '@/api/exam'
+import { getSmartQuestionList,getTemplateInfo,setQuestion,saveQuestion,deleteAllQuestion,deleteSingleQuestion,getExamProcess} from '@/api/exam'
 import scanCommon from '@/utils/scanCommon.ts'
 import { useThrottleFn } from '@vueuse/core';
 
@@ -339,6 +339,11 @@ const MultiClick=(answer:any,item:any)=>{
 
 //删除全部 需要二次弹窗确认提示
 const DeleteAll=()=>{
+    if(tableData.value.length==0)
+    {
+        ElMessage.error("您还没有添加题目哦!")
+        return
+    }
     console.log("打印删除全部")
     ElMessageBox.confirm('确认删除所有题目吗?', '提示', {
         confirmButtonText: '确定',
@@ -354,7 +359,8 @@ const DeleteAll=()=>{
         if(res.code == 200) 
         {
             ElMessage.success("删除成功!")
-            GetSmartQuestionList();
+            GetExamStatus();//获取考试状态
+            // GetSmartQuestionList();
         }
         else
         {
@@ -366,6 +372,12 @@ const DeleteAll=()=>{
 //确定完成
 const FinishQuestion=async ()=>{
     console.log("打印完成")
+
+    if(tableData.value.length==0)
+    {
+        ElMessage.error("请添加题目!")
+        return
+    }
     ElMessageBox.confirm('确认完成吗?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -378,7 +390,8 @@ const FinishQuestion=async ()=>{
         if(res.code == 200) 
         {
             ElMessage.success("保存成功!")
-            GetSmartQuestionList();
+           
+            GetExamStatus();//获取考试状态
         }
         else
         {
@@ -387,6 +400,32 @@ const FinishQuestion=async ()=>{
     })
 }
 
+//获取考试状态
+const GetExamStatus=async ()=>{ 
+     const param = {
+        examSubjectId:examSubjectId.value
+    }
+    getExamProcess(param).then((res: any) => {
+        console.log('打印考试流程状态返回', res)
+        if (res.code === 200) {
+            const newStateStr = res.data;
+            console.log('打印考试流程状态', newStateStr)
+            // 替换为 Store Commit/Action
+            examStore.setExamState(newStateStr);//设置状态数据
+            if(newStateStr.includes(1))
+            {
+
+                router.push('/exam/scanList')
+            }
+            else
+            {
+                //未完成 不跳转
+                GetSmartQuestionList();
+            }
+        }
+    })
+}
+
 //确定编辑
 const EditorAnswerEnter=async (item:any)=>{
     console.log("打印确定编辑",item)
@@ -438,6 +477,9 @@ const EditorSingle=(item:any)=>{
 }
 // 打开扫描仪器
 const GotoScan = useThrottleFn(() => {
+
+    ElMessage.warning("暂未开放,敬请期待!")
+    return;
 //   showSelectType.value = 'scan';
     console.log("打印打开扫描仪器",scanCommon.isClientConnected())
     if (!scanClientConnected.value) {