Browse Source

分类及选择题功能

zengyicheng 2 years ago
parent
commit
d3461faf9b

+ 82 - 52
src/components/components/askStatic.vue

@@ -4,12 +4,20 @@
       <div style="font-size: 25px">{{ askJSONC.askTitle }}</div>
     </div>
     <div class="a_addBox">
-      <div class="a_add_box" v-for="(item, index) in askJSONC.askJson" :key="index">
+      <div
+        class="a_add_box"
+        v-for="(item, index) in askJSONC.askJson"
+        :key="index"
+      >
         <div class="a_add_head">
           <div>
             <span>{{ index + 1 + "、" + item.askstitle }}</span>
           </div>
-          <el-button type="primary" @click="getA(checkJson[index].checkPerson, item.checkList)">查看学生</el-button>
+          <el-button
+            type="primary"
+            @click="getA(checkJson[index].checkPerson, item.checkList)"
+            >查看学生</el-button
+          >
         </div>
         <div class="a_add_body">
           <div class="a_add_input width100">
@@ -17,55 +25,78 @@
               <span>选项</span><span>小计</span><span>比例</span>
             </div>
             <div class="a_add_persent">
-              <div class="a_add_persent_div" v-for="(item1, checkIndex) in item.askItem" :key="checkIndex">
-                <span :class="{ right: item.answer == checkIndex }"><span style="max-width: calc(100% - 40px);width: auto;"
-                    v-html="item.checkList[checkIndex]"></span></span>
+              <div
+                class="a_add_persent_div"
+                v-for="(item1, checkIndex) in item.askItem"
+                :key="checkIndex"
+              >
+                <span :class="{ right: item.answer == checkIndex }"
+                  ><span
+                    style="max-width: calc(100% - 40px); width: auto"
+                    v-html="item.checkList[checkIndex]"
+                  ></span
+                ></span>
                 <span>{{
-                checkJson[index].checkCount[checkIndex]
-                ? checkJson[index].checkCount[checkIndex]
-                : 0
+                  checkJson[index].checkCount[checkIndex]
+                    ? checkJson[index].checkCount[checkIndex]
+                    : 0
                 }}</span>
                 <span>
-                  <el-progress :percentage="
-                    checkJson[index].checkPerent[checkIndex]
-                      ? checkJson[index].checkPerent[checkIndex]
-                      : 0
-                  " :show-text="false"></el-progress>
+                  <el-progress
+                    :percentage="
+                      checkJson[index].checkPerent[checkIndex]
+                        ? checkJson[index].checkPerent[checkIndex]
+                        : 0
+                    "
+                    :show-text="false"
+                  ></el-progress>
                 </span>
               </div>
-              <div class="a_add_persent_div"
-                v-if=" item.answer || item.answer == 0">
+              <div
+                class="a_add_persent_div"
+                v-if="item.answer || item.answer == 0"
+              >
                 <span>正确率</span>
                 <span>{{
-                (checkJson[index].right
-                ? checkJson[index].right
-                : 0) +'%'
+                  (checkJson[index].right ? checkJson[index].right : 0) + "%"
                 }}</span>
-                <span>
-                </span>
+                <span> </span>
               </div>
             </div>
           </div>
         </div>
       </div>
     </div>
-    <el-dialog title="查看" :visible.sync="dialogVisible" :append-to-body="true" width="900px" :before-close="handleClose"
-      class="dialog_diy">
+    <el-dialog
+      title="查看"
+      :visible.sync="dialogVisible"
+      :append-to-body="true"
+      width="900px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
       <div>
         <div v-for="(item, index) in timu" :key="index" class="borderB">
           <div v-html="item" class="s_title"></div>
-          <div class="stuBox" style="margin-top: 20px;align-items: flex-start;">
+          <div class="stuBox" style="margin-top: 20px; align-items: flex-start">
             <div style="margin: 0 0 10px 0; min-width: 70px; color: #adadad">
               选择同学:
             </div>
             <div class="stuBox" style="flex-wrap: wrap">
-              <span class="studentClass" v-for="(pe, pi) in person[index]" :key="index + '-' + pi">{{ pe }}</span>
+              <span
+                class="studentClass"
+                v-for="(pe, pi) in person[index]"
+                :key="index + '-' + pi"
+                >{{ pe }}</span
+              >
             </div>
           </div>
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
+        <el-button type="primary" @click="dialogVisible = false"
+          >关 闭</el-button
+        >
       </span>
     </el-dialog>
   </div>
@@ -80,7 +111,7 @@ export default {
       dialogVisible: false,
       person: [],
       timu: [],
-      checkJson2:[]
+      checkJson2: [],
     };
   },
   watch: {
@@ -104,24 +135,23 @@ export default {
       deep: true,
       handler(newValue, oldValue) {
         this.askJSONC = this.askJSON ? this.askJSON : {};
-        for(var i = 0;i<this.checkJson.length;i++){
+        for (var i = 0; i < this.checkJson.length; i++) {
           // debuggerA
-          let el = this.checkJson[i]
-          console.log(el)
+          let el = this.checkJson[i];
+          console.log(el);
         }
-        this.checkJson2 = this.checkJson
-      }
-    }
+        this.checkJson2 = this.checkJson;
+      },
+    },
   },
   mounted() {
     // this.askJSONC = this.askJSON ? JSON.parse(this.askJSON)[0] : {};
     this.askJSONC = this.askJSON ? this.askJSON : {};
-    for(var i = 0;i<this.checkJson.length;i++){
-      let el = this.checkJson[i]
-      console.log(el)
+    for (var i = 0; i < this.checkJson.length; i++) {
+      let el = this.checkJson[i];
+      console.log(el);
     }
-    this.checkJson2 = this.checkJson
-    
+    this.checkJson2 = this.checkJson;
   },
 };
 </script>
@@ -166,7 +196,7 @@ export default {
   width: 23px;
 }
 
-.a_add_head_div img+img {
+.a_add_head_div img + img {
   margin-left: 10px;
 }
 
@@ -253,39 +283,39 @@ export default {
   margin: 0 10px;
 }
 
-.dialog_diy>>>.el-dialog__header,
-.dialog_diy1>>>.el-dialog__header {
+.dialog_diy >>> .el-dialog__header,
+.dialog_diy1 >>> .el-dialog__header {
   background: #002e81 !important;
   padding: 15px 20px;
 }
 
-.dialog_diy>>>.el-dialog__title,
-.dialog_diy1>>>.el-dialog__title {
+.dialog_diy >>> .el-dialog__title,
+.dialog_diy1 >>> .el-dialog__title {
   color: #fff;
 }
 
-.dialog_diy>>>.el-dialog__headerbtn,
-.dialog_diy1>>>.el-dialog__headerbtn {
+.dialog_diy >>> .el-dialog__headerbtn,
+.dialog_diy1 >>> .el-dialog__headerbtn {
   top: 19px;
 }
 
-.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close,
-.dialog_diy1>>>.el-dialog__headerbtn .el-dialog__close {
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close,
+.dialog_diy1 >>> .el-dialog__headerbtn .el-dialog__close {
   color: #fff;
 }
 
-.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover,
-.dialog_diy1>>>.el-dialog__headerbtn .el-dialog__close:hover {
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover,
+.dialog_diy1 >>> .el-dialog__headerbtn .el-dialog__close:hover {
   color: #fff;
 }
 
-.dialog_diy1>>>.el-dialog__body {
+.dialog_diy1 >>> .el-dialog__body {
   padding: 0;
 }
 
-.dialog_diy>>>.el-dialog__body,
-.dialog_diy>>>.el-dialog__footer,
-.dialog_diy1>>>.el-dialog__footer {
+.dialog_diy >>> .el-dialog__body,
+.dialog_diy >>> .el-dialog__footer,
+.dialog_diy1 >>> .el-dialog__footer {
   background: #fafafa;
 }
 

+ 107 - 50
src/components/components/askStatic2.vue

@@ -4,12 +4,20 @@
       <div style="font-size: 25px">{{ askJSONC.testTitle }}</div>
     </div>
     <div class="a_addBox">
-      <div class="a_add_box" v-for="(item, index) in askJSONC.testJson.testJson" :key="index">
+      <div
+        class="a_add_box"
+        v-for="(item, index) in askJSONC.testJson.testJson"
+        :key="index"
+      >
         <div class="a_add_head">
           <div>
             <span>{{ index + 1 + "、" + item.teststitle }}</span>
           </div>
-          <el-button type="primary" @click="getA(checkJson[index].checkPerson, item.checkList)">查看学生</el-button>
+          <el-button
+            type="primary"
+            @click="getA(checkJson[index].checkPerson, item.checkList)"
+            >查看学生</el-button
+          >
         </div>
         <div class="a_add_body">
           <div class="a_add_input width100">
@@ -17,54 +25,94 @@
               <span>选项</span><span>小计</span><span>比例</span>
             </div>
             <div class="a_add_persent">
-              <div class="a_add_persent_div" v-for="(item1, checkIndex) in item.testItem" :key="checkIndex">
-                <span :class="{ right: item.answer.length ? item.answer.indexOf(checkIndex) != -1 : item.answer == checkIndex }"><span style="max-width: calc(100% - 40px);width: auto;"
-                    v-html="item.checkList[checkIndex]"></span></span>
+              <div
+                class="a_add_persent_div"
+                v-for="(item1, checkIndex) in item.testItem"
+                :key="checkIndex"
+              >
+                <span
+                  :class="{
+                    right: item.answer.length
+                      ? item.answer.indexOf(checkIndex) != -1
+                      : item.answer == checkIndex,
+                  }"
+                >
+                  <div
+                    style="margin-right: 10px"
+                    v-if="
+                      item.checkList[checkIndex] &&
+                      item.checkList[checkIndex].imgType &&
+                      item.checkList[checkIndex].imgType == 1
+                    "
+                  >
+                    <div class="inImg">
+                      <img :src="item.checkList[checkIndex].src" alt="" />
+                    </div>
+                  </div>
+                  <span
+                    v-else
+                    style="max-width: calc(100% - 40px); width: auto"
+                    v-html="item.checkList[checkIndex]"
+                  ></span>
+                </span>
                 <span>{{
-                checkJson[index].checkCount[checkIndex]
-                ? checkJson[index].checkCount[checkIndex]
-                : 0
+                  checkJson[index].checkCount[checkIndex]
+                    ? checkJson[index].checkCount[checkIndex]
+                    : 0
                 }}</span>
                 <span>
-                  <el-progress :percentage="
-                    checkJson[index].checkPerent[checkIndex]
-                      ? checkJson[index].checkPerent[checkIndex]
-                      : 0
-                  " :show-text="false"></el-progress>
+                  <el-progress
+                    :percentage="
+                      checkJson[index].checkPerent[checkIndex]
+                        ? checkJson[index].checkPerent[checkIndex]
+                        : 0
+                    "
+                    :show-text="false"
+                  ></el-progress>
                 </span>
               </div>
               <div class="a_add_persent_div">
                 <span>正确率</span>
                 <span>{{
-                (checkJson[index].right
-                ? checkJson[index].right
-                : 0) +'%'
+                  (checkJson[index].right ? checkJson[index].right : 0) + "%"
                 }}</span>
-                <span>
-                </span>
+                <span> </span>
               </div>
             </div>
           </div>
         </div>
       </div>
     </div>
-    <el-dialog title="查看" :visible.sync="dialogVisible" :append-to-body="true" width="900px" :before-close="handleClose"
-      class="dialog_diy">
+    <el-dialog
+      title="查看"
+      :visible.sync="dialogVisible"
+      :append-to-body="true"
+      width="900px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
       <div>
         <div v-for="(item, index) in timu" :key="index" class="borderB">
           <div v-html="item" class="s_title"></div>
-          <div class="stuBox" style="margin-top: 20px;align-items: flex-start;">
+          <div class="stuBox" style="margin-top: 20px; align-items: flex-start">
             <div style="margin: 0 0 10px 0; min-width: 70px; color: #adadad">
               选择同学:
             </div>
             <div class="stuBox" style="flex-wrap: wrap">
-              <span class="studentClass" v-for="(pe, pi) in person[index]" :key="index + '-' + pi">{{ pe }}</span>
+              <span
+                class="studentClass"
+                v-for="(pe, pi) in person[index]"
+                :key="index + '-' + pi"
+                >{{ pe }}</span
+              >
             </div>
           </div>
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
+        <el-button type="primary" @click="dialogVisible = false"
+          >关 闭</el-button
+        >
       </span>
     </el-dialog>
   </div>
@@ -79,7 +127,7 @@ export default {
       dialogVisible: false,
       person: [],
       timu: [],
-      checkJson2:[]
+      checkJson2: [],
     };
   },
   watch: {
@@ -103,24 +151,23 @@ export default {
       deep: true,
       handler(newValue, oldValue) {
         this.askJSONC = this.askJSON ? this.askJSON : {};
-        for(var i = 0;i<this.checkJson.length;i++){
+        for (var i = 0; i < this.checkJson.length; i++) {
           // debuggerA
-          let el = this.checkJson[i]
-          console.log(el)
+          let el = this.checkJson[i];
+          console.log(el);
         }
-        this.checkJson2 = this.checkJson
-      }
-    }
+        this.checkJson2 = this.checkJson;
+      },
+    },
   },
   mounted() {
     // this.askJSONC = this.askJSON ? JSON.parse(this.askJSON)[0] : {};
     this.askJSONC = this.askJSON ? this.askJSON : {};
-    for(var i = 0;i<this.checkJson.length;i++){
-      let el = this.checkJson[i]
-      console.log(el)
+    for (var i = 0; i < this.checkJson.length; i++) {
+      let el = this.checkJson[i];
+      console.log(el);
     }
-    this.checkJson2 = this.checkJson
-    
+    this.checkJson2 = this.checkJson;
   },
 };
 </script>
@@ -165,7 +212,7 @@ export default {
   width: 23px;
 }
 
-.a_add_head_div img+img {
+.a_add_head_div img + img {
   margin-left: 10px;
 }
 
@@ -252,39 +299,39 @@ export default {
   margin: 0 10px;
 }
 
-.dialog_diy>>>.el-dialog__header,
-.dialog_diy1>>>.el-dialog__header {
+.dialog_diy >>> .el-dialog__header,
+.dialog_diy1 >>> .el-dialog__header {
   background: #002e81 !important;
   padding: 15px 20px;
 }
 
-.dialog_diy>>>.el-dialog__title,
-.dialog_diy1>>>.el-dialog__title {
+.dialog_diy >>> .el-dialog__title,
+.dialog_diy1 >>> .el-dialog__title {
   color: #fff;
 }
 
-.dialog_diy>>>.el-dialog__headerbtn,
-.dialog_diy1>>>.el-dialog__headerbtn {
+.dialog_diy >>> .el-dialog__headerbtn,
+.dialog_diy1 >>> .el-dialog__headerbtn {
   top: 19px;
 }
 
-.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close,
-.dialog_diy1>>>.el-dialog__headerbtn .el-dialog__close {
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close,
+.dialog_diy1 >>> .el-dialog__headerbtn .el-dialog__close {
   color: #fff;
 }
 
-.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover,
-.dialog_diy1>>>.el-dialog__headerbtn .el-dialog__close:hover {
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover,
+.dialog_diy1 >>> .el-dialog__headerbtn .el-dialog__close:hover {
   color: #fff;
 }
 
-.dialog_diy1>>>.el-dialog__body {
+.dialog_diy1 >>> .el-dialog__body {
   padding: 0;
 }
 
-.dialog_diy>>>.el-dialog__body,
-.dialog_diy>>>.el-dialog__footer,
-.dialog_diy1>>>.el-dialog__footer {
+.dialog_diy >>> .el-dialog__body,
+.dialog_diy >>> .el-dialog__footer,
+.dialog_diy1 >>> .el-dialog__footer {
   background: #fafafa;
 }
 
@@ -323,4 +370,14 @@ export default {
   margin-bottom: 10px;
   border-bottom: 1px solid #d8d8d8;
 }
+
+.inImg {
+  width: 100px;
+  height: 100px;
+}
+.inImg > img {
+  width: 100%;
+  height: 100%;
+  object-fit: cover;
+}
 </style>

+ 60 - 4
src/components/index.vue

@@ -256,7 +256,7 @@ export default {
     },
     getCourse(typeName, ftypeId, typeid, type) {
       this.page = 1;
-      this.zoneClass = []
+      this.zoneClass = [];
       if (typeName == "年级") {
         if (type == 1) {
           if (this.typeE.indexOf(typeid) != -1) {
@@ -417,9 +417,10 @@ export default {
           this.zoneClass = res.data[0];
           this.total = res.data[0].length ? res.data[0][0].num : 0;
 
-          this.selectType({
-            data: [res.data[1], res.data[2], res.data[3], res.data[4]],
-          });
+          // this.selectType({
+          //   data: [res.data[1], res.data[2], res.data[3], res.data[4]],
+          // });
+          this.selectAllType();
           this.getBanner({
             data: [res.data[6], res.data[5], res.data[7]],
           });
@@ -497,6 +498,61 @@ export default {
       //   console.error(err);
       // });
     },
+    selectAllType() {
+      let params = {
+        org: this.org && this.org != "" ? this.org : "",
+        oid: this.oid && this.oid != "" ? this.oid : "",
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectAllType", params)
+        .then((res) => {
+          this.CourseTypeJson = {};
+          this.CourseType = res.data;
+          for (var i = 0; i < res.data[0].length; i++) {
+            if (!this.cid) {
+              this.courseTypeId[res.data[0][i].id] = "";
+            }
+            if (!this.CourseTypeJson[res.data[0][i].id]) {
+              this.CourseTypeJson[res.data[0][i].id] = [];
+            }
+            if (this.oid == "69893dca-1d47-11ed-8c78-005056b86db5") {
+              if (res.data[0][i].name == "栏目") {
+                this.CourseType[0][i].name = "主题";
+              }
+            }
+
+            if (res.data[2].length == 0 && res.data[3].length == 0) {
+              for (var j = 0; j < res.data[1].length; j++) {
+                if (res.data[0][i].id == res.data[1][j].pid) {
+                  if (!this.CourseTypeJson[res.data[0][i].id]) {
+                    this.CourseTypeJson[res.data[0][i].id] = [];
+                  }
+                  this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]); // 去除公共分类
+                }
+              }
+            } else {
+              if (res.data[2].length > 0) {
+                for (var j = 0; j < res.data[2].length; j++) {
+                  if (res.data[0][i].id == res.data[2][j].pid) {
+                    this.CourseTypeJson[res.data[0][i].id].push(res.data[2][j]); // 去除公共分类
+                  }
+                }
+              }
+              if (res.data[3].length > 0) {
+                for (var j = 0; j < res.data[3].length; j++) {
+                  if (res.data[0][i].id == res.data[3][j].pid) {
+                    this.CourseTypeJson[res.data[0][i].id].push(res.data[3][j]); // 去除公共分类
+                  }
+                }
+              }
+            }
+          }
+          this.$forceUpdate();
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     selectType(res) {
       // this.ajax
       //   .get(this.$store.state.api + "selectType")

File diff suppressed because it is too large
+ 502 - 237
src/components/studyStudent.vue


Some files were not shown because too many files changed in this diff