lsc 2 years ago
parent
commit
e40e8dae05

+ 92 - 22
src/components/pages/addCourse.vue

@@ -15,7 +15,7 @@
             </div>
             <div>填写基本信息</div>
           </div>
-          <div v-show="cid == ''" class="secondNo">
+          <div v-show="cidType === 0" class="secondNo">
             <div v-if="steps == 2" class="newSteps second" @click="navSteps(2)">
               <div style="margin: 5px 10px 0 0; width: 2rem">
                 <img src="../../assets/icon/second.png" alt />
@@ -56,7 +56,7 @@
           </div>
         </div>
         <!-- <div style="display: flex; margin-top: 20px; position: relative"> -->
-        <div style="width: 100%; height: 100%; overflow: auto">
+        <div style="width: 100%; height: 100%; overflow: auto" ref="stepBox">
           <div class="courseTop">
             <div class="stepsNav">
               <h3 class="info_title" v-if="steps == 1">课程内容填写</h3>
@@ -570,6 +570,7 @@
                 >
                   <div>
                     <div>
+                      <div style="font-size: 22px;color: #8e8e8e;">任务{{ itemTaskIndex + 1 }}</div>
                       <div
                         class="chapter_contentbox"
                         style="
@@ -2193,7 +2194,6 @@
                   type="primary"
                   size="small"
                   @click="addcheckList(askJson.askJson[index1])"
-                  v-if="askJson.askJson[index1].askItem < 4"
                   >添加</el-button
                 >
                 <el-button
@@ -2800,7 +2800,22 @@ export default {
       }
     },
     navSteps(s) {
+      if (this.courseName == "") {
+        this.$message.error("请将信息填写完整");
+        return;
+      }
       if (this.cidType == 0) {
+        if (this.steps == 1) {
+          if (this.cid == "" || this.cid == undefined) {
+            this.addWork();
+          } else {
+            if (this.userid != this.courseUserid) {
+              // this.updateWork2();
+            } else {
+              this.updateWork();
+            }
+          }
+        }
         if (s == 1) {
           this.steps = 1;
           setTimeout(() => {
@@ -2819,6 +2834,17 @@ export default {
           }, 1000);
         }
       } else {
+        if (this.steps == 1) {
+          if (this.cid == "" || this.cid == undefined) {
+            this.addWork();
+          } else {
+            if (this.userid != this.courseUserid) {
+              // this.updateWork2();
+            } else {
+              this.updateWork();
+            }
+          }
+        }
         if (s == 1) {
           this.steps = 1;
           setTimeout(() => {
@@ -2834,6 +2860,7 @@ export default {
           }, 1000);
         }
       }
+      this.$refs.stepBox.scrollTop = 0;
     },
     nextSteps() {
       if (this.cidType == 1) {
@@ -2843,6 +2870,15 @@ export default {
             setTimeout(() => {
               this.checkEva(this.checkId);
             }, 1000);
+            if (this.cid == "" || this.cid == undefined) {
+              this.addWork();
+            } else {
+              if (this.userid != this.courseUserid) {
+                // this.updateWork2();
+              } else {
+                this.updateWork();
+              }
+            }
           } else {
             this.$message.error("请将信息填写完整");
             return;
@@ -2873,6 +2909,15 @@ export default {
       } else {
         if (this.steps == 1) {
           if (this.courseName != "") {
+            if (this.cid == "" || this.cid == undefined) {
+              this.addWork();
+            } else {
+              if (this.userid != this.courseUserid) {
+                // this.updateWork2();
+              } else {
+                this.updateWork();
+              }
+            }
             this.steps++;
           } else {
             this.$message.error("请将信息填写完整");
@@ -2911,6 +2956,7 @@ export default {
           }
         }
       }
+      this.$refs.stepBox.scrollTop = 0;
     },
     unitSet(i) {
       this.unitIndex = i;
@@ -3522,12 +3568,17 @@ export default {
       this.ajax
         .post(this.$store.state.api + "addWorkNew2", params)
         .then((res) => {
-          this.$message({
-            message: "新增成功",
-            type: "success",
-          });
+          console.log(this.steps);
+          if (this.steps != 1 && this.steps != 2 && this.steps != 3) {
+            this.$message({
+              message: "新增成功",
+              type: "success",
+            });
+          }
           this.number = res.data.ordernumber;
           this.courseId = res.data.courseId;
+          this.cid = res.data.courseId;
+          this.courseUserid = this.userid;
           this.islogin = true;
         })
         .catch((err) => {
@@ -3647,7 +3698,17 @@ export default {
           cid: this.cid,
           title: this.courseName,
           brief: this.courseText.replace(/%/g, "%25"),
-          cover: this.cover.length > 0 ? JSON.stringify(this.cover) : "",
+          cover:
+            this.cover.length > 0
+              ? JSON.stringify(this.cover)
+              : JSON.stringify([
+                  {
+                    name: "noBanner.jpg",
+                    url: "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/noBanner1656409780264.jpg",
+                    uid: 1656409780264,
+                    status: "success",
+                  },
+                ]),
           evaId: this.evalua,
           astudent:
             this.checkboxList2.length > 0 ? this.checkboxList2.join(",") : "",
@@ -3663,10 +3724,19 @@ export default {
       this.ajax
         .post(this.$store.state.api + "updateWorkNew2", params)
         .then((res) => {
-          this.$message({
-            message: "修改成功",
-            type: "success",
-          });
+          if (this.steps != 1 && this.steps != 2 && this.steps != 3) {
+            if (this.cidType == 1) {
+              this.$message({
+                message: "修改成功",
+                type: "success",
+              });
+            } else {
+              this.$message({
+                message: "新增成功",
+                type: "success",
+              });
+            }
+          }
           this.number = this.nbOrder;
           this.courseId = this.cid;
         })
@@ -4043,11 +4113,11 @@ export default {
           this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
             .toolChoose[toolIndex].askJson[0].checkList < 2
         ) {
-          this.openTools(itemTaskIndex, 4, toolIndex)
-          this.$message({
-            message: "请填写完整问卷内容",
-            type: "error",
-          });
+          this.openTools(itemTaskIndex, 4, toolIndex);
+          // this.$message({
+          //   message: "请填写完整问卷内容",
+          //   type: "error",
+          // });
           return;
         }
       }
@@ -4058,11 +4128,11 @@ export default {
           this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
             .toolChoose[toolIndex].answerQ == ""
         ) {
-          this.openTools(itemTaskIndex, 15, toolIndex)
-          this.$message({
-            message: "请填写问答内容",
-            type: "error",
-          });
+          this.openTools(itemTaskIndex, 15, toolIndex);
+          // this.$message({
+          //   message: "请填写问答内容",
+          //   type: "error",
+          // });
           return;
         }
       }

+ 37 - 8
src/components/pages/components/report/studentInfo.vue

@@ -22,7 +22,7 @@
       <div class="si_course_content">
         <div class="si_course_box">
           <div>{{ ccount }}</div>
-          <div>全部项目</div>
+          <div>全部任务</div>
         </div>
         <div class="si_course_box">
           <div>{{ iscount }}</div>
@@ -42,8 +42,10 @@
 </template>
 
 <script>
+import { F } from "caniuse-lite/data/browserVersions";
+
 export default {
-  props: ["userid"],
+  props: ["userid", "courseid"],
   data() {
     return {
       userinfo: {},
@@ -70,6 +72,7 @@ export default {
     getInfo() {
       let params = {
         uid: this.userid,
+        cid: this.courseid,
       };
       console.log(this.userid);
       if (!this.userid) {
@@ -78,14 +81,40 @@ export default {
       this.ajax
         .get(this.$store.state.api + "getUserInfo", params)
         .then((res) => {
+          let chapters = JSON.parse(res.data[2][0].chapters);
+          var tool = 0;
+          for (var i = 0; i < chapters.length; i++) {
+            for (
+              var j = 0;
+              j < chapters[i].chapterInfo[0].taskJson.length;
+              j++
+            ) {
+              // 1、电子白板,3、思维导图,6协同文档,7思维网格 16、作业提交
+              let _toolsAarry = [1, 3, 6, 7, 16, 15, 4];
+              for (
+                var k = 0;
+                k < chapters[i].chapterInfo[0].taskJson[j].toolChoose.length;
+                k++
+              ) {
+                if (
+                  _toolsAarry.indexOf(
+                    chapters[i].chapterInfo[0].taskJson[j].toolChoose[k].tool[0]
+                  ) != -1
+                ) {
+                  tool++;
+                }
+              }
+              // tool += chapters[i].chapterInfo[0].taskJson[j].toolChoose.length;
+            }
+          }
           this.userinfo = res.data[0][0];
-          this.ccount = res.data[1][0].ccount;
-          this.islearn =
-            parseInt(res.data[1][0].ccount) - parseInt(res.data[1][0].vcount);
+          // this.ccount = res.data[1][0].ccount;
+          this.ccount = tool;
+          this.islearn = tool - parseInt(res.data[1][0].vcount);
 
-          let count = this.randomNum(0, parseInt(res.data[1][0].vcount));
-          this.vcount = res.data[1][0].vcount - count;
-          this.iscount = count;
+          // let count = this.randomNum(0, parseInt(res.data[1][0].vcount));
+          this.iscount = res.data[1][0].vcount;
+          this.vcount = 0;
         })
         .catch((err) => {
           console.error(err);

+ 41 - 1
src/components/pages/works.vue

@@ -193,6 +193,26 @@
       class="dialog_diy check_diy"
     >
       <div>
+        <div class="student_search" style="margin-bottom: 10px">
+          <div>筛选</div>
+          <div style="display: flex; width: 90%">
+            <el-select
+              class="r_select"
+              v-model="uname"
+              placeholder="请选择学生"
+              filterable
+              @change="searchWork2"
+            >
+              <el-option label="所有学生" value></el-option>
+              <el-option
+                v-for="item in userAarray"
+                :key="item.userid"
+                :label="item.username"
+                :value="item.userid"
+              ></el-option>
+            </el-select>
+          </div>
+        </div>
         <div>
           <el-table
             v-loading="isLoading2"
@@ -252,6 +272,7 @@
 import WorkDate from "./components/workData";
 import Report from "./components/report";
 import studentReport from "./components/studentReport";
+import { T } from "caniuse-lite/data/browserVersions";
 export default {
   components: {
     WorkDate,
@@ -287,6 +308,8 @@ export default {
       checkCourse: "",
       reportVisible: false,
       checkStudent: "",
+      userAarray: [],
+      uname: "",
     };
   },
   mounted() {
@@ -386,6 +409,9 @@ export default {
       this.reportVisible = false;
       this.signDialog = true;
     },
+    searchWork2() {
+      (this.page2 = 1), this.getStudnet();
+    },
     getStudnet(row) {
       //获取作业
       this.signDialog = true;
@@ -393,7 +419,7 @@ export default {
       this.checkCourse = row ? row.courseId : this.checkCourse;
       let params = {
         cid: this.checkCourse,
-        uname: "",
+        uname: this.uname,
         stage: "",
         task: "",
         page: this.page2,
@@ -404,12 +430,26 @@ export default {
           this.isLoading2 = false;
           this.total2 = res.data[0].length > 0 ? res.data[0][0].num : 0;
           this.res2 = res.data[0];
+          this.getCourseDetail();
         })
         .catch((err) => {
           this.isLoading2 = false;
           console.error(err);
         });
     },
+    getCourseDetail() {
+      let params = {
+        cid: this.checkCourse,
+      };
+      this.ajax
+        .get(this.$store.state.api + "getCourseWorksReport", params)
+        .then((res) => {
+          this.userAarray = res.data[1];
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     getReport(row) {
       this.checkStudent = row.userid;
       this.reportVisible = true;