Просмотр исходного кода

...默认选择第一个科目的第一题

la 1 год назад
Родитель
Сommit
9e194b5870
2 измененных файлов с 62 добавлено и 54 удалено
  1. 2 2
      src/pages/ksfx/apiItem.js
  2. 60 52
      src/pages/ksfx/sjfx_kgtfx/[ykj_id].vue

+ 2 - 2
src/pages/ksfx/apiItem.js

@@ -22,10 +22,10 @@ export const normalSubject_list = (data = {}) => {
   })
 }
 
-//通用接口-题目(考试计划列表-筛选出题目)
+//通用接口-题目(阅卷-附件试卷-试卷详情-筛选出题目)
 export const normalToppic_list = (data = {}) => {
   return request({
-    url: '/index.php',
+    url: '/yzy/jspyrw/fj_zs_detail',
     data,
   })
 }

+ 60 - 52
src/pages/ksfx/sjfx_kgtfx/[ykj_id].vue

@@ -3,7 +3,7 @@
     <NavHeader />
     <bread-crumb />
 
-    <div class="w-1200px m-auto flex flex-row justify-between">
+    <div class="w-1200px m-auto flex flex-row justify-between mainCotent">
       <div class="w-188px">
         <leftSider :ykjId="ykjId" :activeIndex="activeIndex" @parentClick="parentClick" />
       </div>
@@ -94,14 +94,7 @@ let normal_topic = ref("");
 
 const school_list = ref([])
 const subject_list = ref([]);
-
-let topic_list = ref([{
-  value: '1',
-  label: '主观题'
-}, {
-  value: '2',
-  label: '客观题'
-}]);
+const topic_list = ref([]);
 
 
 const school_id = ref("");
@@ -117,7 +110,7 @@ const parentClick = (val: string) => {
 ykjId.value = route.params.ykj_id;
 onMounted(() => {
   initOption();
-  initData();
+  // initData();
 })
 //初始化option
 const initOption = () => {
@@ -170,14 +163,20 @@ const initOption = () => {
 //初始化数据
 const initData = () => {
   let transObj = {
-    school_id: school_id.value,
-    xueke_id: xueke_id.value,
-    hq_id:hq_id.value,//试题
-    jh_id:route.params.ykj_id
+    // school_id: school_id.value,
+    // xueke_id: xueke_id.value,
+    // hq_id:hq_id.value,//试题
+    // jh_id: route.params.ykj_id,
+
+    school_id: normal_school.value,
+    xueke_id: normal_subject.value,
+    hq_id:normal_topic.value,//试题
+    jh_id: route.params.ykj_id,
   }
   cjfx_kgtfx_list(transObj)
     .then(res => {
       if (res.code == "1") {
+        // dialogArr.value = res.data.data.dialogArr;
         initbarChart(res.data.data.barChartData);
         initcircleChart(res.data.data.circleChartData);
       }
@@ -285,57 +284,37 @@ const openDialog = () => {
 
 let dialogArr = [
   {
-    option: "选项A",
+    option: "单选题1",
     stuNum: 23,
     detail: [
       {
-        stuSchool: "苏州小学",
+        stuSchool: "博智测试学校",
         classRomm: "初一(2)班",
-        stuName: "张大大",
+        stuName: "李文1",
       }
     ]
   },
   {
-    option: "选项B",
+    option: "单选题2",
     stuNum: 23,
     detail: [
       {
-        stuSchool: "苏州小学",
+        stuSchool: "博智测试学校",
         classRomm: "初一(2)班",
-        stuName: "张大大",
+        stuName: "李文1",
       },
       {
-        stuSchool: "苏州小学",
+        stuSchool: "博智测试学校",
         classRomm: "初一(2)班",
-        stuName: "张大大",
+        stuName: "李文1",
       }, {
-        stuSchool: "苏州小学",
+        stuSchool: "博智测试学校",
         classRomm: "初一(2)班",
-        stuName: "张大大",
+        stuName: "李文1",
       }
     ]
   },
-  {
-    option: "选项C",
-    stuNum: 23,
-    detail: [
-      {
-        stuSchool: "苏州小学",
-        classRomm: "初一(2)班",
-        stuName: "张大大",
-      }]
-  },
-  {
-    option: "选项D",
-    stuNum: 23,
-    detail: [
-      {
-        stuSchool: "苏州小学",
-        classRomm: "初一(2)班",
-        stuName: "张大大",
-      }
-    ]
-  }
+
 ]
 
 //option 学校
@@ -347,24 +326,50 @@ const handelOption = (val, marklabel) => {
     initTopic(val);
   } else {
     hq_id.value = val;
+    initData();
   }
-  initData();
-
 }
 
 // option 题目
-const initTopic = (sjID) => {
+const initTopic = (sjID: any) => {
   let transObj = {
-    // zs_id:sjID,
-    zs_id:2727
+    ze_id:sjID,
   }
   normalToppic_list(transObj)
     .then(res => {
-      if(res.code=="1"){
-        console.log(res, "876445");
+      if (res.code == "1") {
+        let allDataFilter = res.data.zs.typeList;
+
+        if (allDataFilter.length == 0) {//默认第一个考试没有试题
+          ElMessage({
+            message: '此试卷暂无试题,无统计数据~',
+            type: 'warning',
+          });
+          return
+        } else {// 默认第一个试卷 是有题目的
+          let emptyArr: { value: any; label: any; }[] = [];
+          allDataFilter.forEach((item: { label: any; content: any[]; }) => {
+            let firstLabel = item.label
+            item.content.forEach((secItem: { hq_id: any; shunxu_id: any; }) => {
+              emptyArr.push({
+                value: secItem.hq_id,
+                label: firstLabel+secItem.shunxu_id
+              })
+            })
+          })
+          topic_list.value = emptyArr;
+          normal_topic.value = emptyArr[0].value;
+
+          initData();
+        }
+
+
+
+
       }
     })
   .catch(error=>{console.log(error)})
+
 }
 
 </script>
@@ -372,4 +377,7 @@ const initTopic = (sjID) => {
 
 <style lang="scss" scoped>
 @import '@/styles/ksfx.css';
+.mainCotent{
+  min-height:665px;
+}
 </style>