zengyicheng 2 years ago
parent
commit
962bd0b186

BIN
src/assets/icon/answerBgNew.png


BIN
src/assets/icon/comment/comment.png


BIN
src/assets/icon/comment/likes.png


BIN
src/assets/icon/comment/noLikes.png


+ 29 - 23
src/components/study.vue

@@ -228,7 +228,7 @@
                     >
                       <div class="title">查看文档</div>
                       <el-form class="textBox">
-                        <el-form-item label="文档标题" class="textTitle">
+                        <el-form-item class="textTitle">
                           <div
                             style="
                               font-size: 22px;
@@ -239,7 +239,7 @@
                             {{ textList[jdIndex][rwIndex][0].name }}
                           </div>
                         </el-form-item>
-                        <div style="color: #918f8f; width: 85%">文档内容</div>
+                        <!-- <div style="color: #918f8f; width: 85%">文档内容</div> -->
                         <div
                           v-html="textList[jdIndex][rwIndex][0].url"
                           class="textContent"
@@ -311,7 +311,7 @@
                           vedio[jdIndex][rwIndex].length > 0
                         "
                       >
-                        <div
+                        <!-- <div
                           class="vedioNav"
                           style="
                             width: 80px;
@@ -323,12 +323,12 @@
                           "
                         >
                           视频
-                        </div>
+                        </div> -->
                         <div
                           class="vedioTimeBox"
                           v-for="(media, vedioIndex) in vedio[jdIndex][rwIndex]"
                           :key="vedioIndex + '1'"
-                          @click="lookVedio(media.url, jdIndex, rwIndex)"
+                          @click="lookVedio(media.url, jdIndex, rwIndex,vedioIndex)"
                         >
                           <div
                             class="media"
@@ -353,7 +353,7 @@
                               {{ vedioTime[jdIndex][rwIndex][vedioIndex] }}
                             </div> -->
                           </div>
-                          <div class="vedioName">{{ media.name }}</div>
+                          <div class="vedioName" :class="isClickNavOne[jdIndex][rwIndex][vedioIndex] == vedioIndex ? 'isClickNavOne' : '' ">{{ media.name }}</div>
                         </div>
                       </div>
                       <div
@@ -367,7 +367,7 @@
                         :key="textIndex + '2'"
                         @click="lookText(jdIndex, rwIndex, textIndex)"
                       >
-                        <div
+                        <!-- <div
                           class="vedioNav"
                           style="
                             width: 80px;
@@ -379,9 +379,9 @@
                           "
                         >
                           文档
-                        </div>
+                        </div> -->
                         <div style="width: calc(100% - 115px)">
-                          <div class="navText">
+                          <div class="navText" :class="isClickNavOne[jdIndex][rwIndex][textIndex] == textIndex ? 'isClickNavOne' : ''">
                             {{
                               textList[jdIndex][rwIndex].length > 0
                                 ? text.name
@@ -401,7 +401,7 @@
                         :key="lineIndex + '4'"
                         @click="doUrl(lines.url)"
                       >
-                        <div
+                        <!-- <div
                           class="vedioNav"
                           style="
                             width: 80px;
@@ -413,7 +413,7 @@
                           "
                         >
                           链接
-                        </div>
+                        </div> -->
                         <div style="width: calc(100% - 115px)">
                           <div class="navText">
                             <a
@@ -435,7 +435,7 @@
                         :key="fileIndex"
                         @click="downFile(f, fileIndex, jdIndex, rwIndex)"
                       >
-                        <div
+                        <!-- <div
                           class="vedioNav"
                           style="
                             width: 80px;
@@ -447,9 +447,9 @@
                           "
                         >
                           文档
-                        </div>
+                        </div> -->
                         <div style="width: calc(100% - 115px)">
-                          <div class="navText">
+                          <div class="navText" :class="isClickNavOne[jdIndex][rwIndex][fileIndex] == fileIndex ? 'isClickNavOne' : ''">
                             {{ f.name }}
                           </div>
                         </div>
@@ -2185,6 +2185,7 @@ export default {
       answerDialogVisible: false,
       timeDialogVisible: false,
       radio: [],
+      isClickNavOne:[],
       isAsk: false,
       askJson: {
         askCount: 1,
@@ -2582,20 +2583,14 @@ export default {
                   var data = b[j];
                   if (i == b[j].tool) {
                     if (data.type == 2) {
-                      console.log(this.checkJson);
                       for (var z = 0; z < this.checkJson[q][w][i].length; z++) {
-                        console.log(this.checkJson[q][w][i]);
-                        console.log(this.checkJson[q][w][i][z]);
-                        console.log(this.checkJson[q][w][i][z].checkPerent);
                         this.checkJson[q][w][i][z].checkPerent = [];
-                        console.log(this.checkJson[q][w][i][z]);
 
                         for (
                           var k = 0;
                           k < this.checkJson[q][w][i][z].checkCount.length;
                           k++
                         ) {
-                          console.log(this.checkJson[q][w][i][z]);
                           this.checkJson[q][w][i][z].checkPerent.push(
                             Math.round(
                               (this.checkJson[q][w][i][z].checkCount[k] /
@@ -3023,6 +3018,7 @@ export default {
             this.chapToolList[i] = [];
             this.file[i] = [];
             this.playerO[i] = [];
+            this.isClickNavOne[i] = [];
             for (var j = 0; j < c.length; j++) {
               var d = c[j].chapterData;
               this.vedio[i][j] = [];
@@ -3030,6 +3026,7 @@ export default {
               this.lineList[i][j] = [];
               this.chapToolList[i][j] = [];
               this.file[i][j] = [];
+              this.isClickNavOne[i][j] = [];
               for (var z = 0; z < d.length; z++) {
                 if (d[z].type == 7) {
                   this.chapToolList[i][j].push(d[z]);
@@ -3271,16 +3268,20 @@ export default {
     //   this.playerO = this.playerOptions;
     // },
     // onPlayerPlay() {},
-    lookVedio(u, i, j) {
+    lookVedio(u, i, j,v) {
+      this.isClickNavOne[i][j] = [];
       var e = JSON.parse(JSON.stringify(this.playerOptions));
       e.sources[0].src = u;
       this.playerO[i][j] = e;
       this.showType[i][j] = 0;
+      this.isClickNavOne[i][j][v] = v;
     },
     lookText(i, j, t) {
+      this.isClickNavOne[i][j] = [];
       // this.textList[i][j][t] = this.textList[i][j][t];
       // this.dialogVisible1 = true;
       this.showType[i][j] = 1;
+      this.isClickNavOne[i][j][t] = t;
     },
     lookTools(i, t) {
       this.chapTools = this.chapToolList[i][t];
@@ -3306,6 +3307,7 @@ export default {
       }
     },
     downFile(f, i, j, k) {
+      this.isClickNavOne[j][k] = [];
       this.pptImgUrl1[j][k] = [];
       var a = ["PPT", "PPTX", "XLSX", "XLS", "DOC", "DOCX"]; //"PDF",
       if (
@@ -3334,6 +3336,7 @@ export default {
       } else {
         window.open(this.file[i].url);
       }
+      this.isClickNavOne[j][k][i] = i;
     },
     downFileList(i) {
       window.open(this.noImgList[i].url);
@@ -3897,7 +3900,7 @@ export default {
       document.getElementsByClassName("vedioList")[0].style.height = a + "px";
       document.getElementsByClassName("navBox")[0].style.height = a - 40 + "px";
     });
-    let _this = this 
+    let _this = this;
     setTimeout(() => {
       // this.vedioTime = document.getElementsByClassName(
       //   "vjs-duration-display"
@@ -4585,7 +4588,7 @@ export default {
   left: 110px;
   height: 60px;
   overflow: hidden;
-  width:auto;
+  width: auto;
   word-break: break-all;
 }
 .vedioTime {
@@ -5484,4 +5487,7 @@ export default {
   border-radius: 10px;
   margin: 10px 0;
 }
+.isClickNavOne {
+  color: #499eef;
+}
 </style>

+ 194 - 26
src/components/studyStudent.vue

@@ -257,7 +257,7 @@
                   >
                     <div class="title">查看文档</div>
                     <el-form class="textBox">
-                      <el-form-item label="文档标题" class="textTitle">
+                      <el-form-item class="textTitle">
                         <div
                           style="
                             font-size: 22px;
@@ -268,7 +268,7 @@
                           {{ text.name }}
                         </div>
                       </el-form-item>
-                      <div style="color: #918f8f; width: 85%">文档内容</div>
+                      <!-- <div style="color: #918f8f; width: 85%">文档内容</div> -->
                       <div v-html="text.url" class="textContent"></div>
                     </el-form>
                   </div>
@@ -346,7 +346,7 @@
                         vedio[taskCount].length > 0
                       "
                     >
-                      <div
+                      <!-- <div
                         class="vedioNav"
                         style="
                           width: 80px;
@@ -358,12 +358,12 @@
                         "
                       >
                         视频
-                      </div>
+                      </div> -->
                       <div
                         class="vedioTimeBox"
                         v-for="(media, vedioIndex) in vedio[taskCount]"
                         :key="vedioIndex + '1'"
-                        @click="lookVedio(media.url)"
+                        @click="lookVedio(media.url, vedioIndex)"
                       >
                         <div
                           class="media"
@@ -385,7 +385,12 @@
                           </div> -->
                           <!-- <div class="vedioName">{{ media.name }}</div> -->
                         </div>
-                        <div class="vedioName">{{ media.name }}</div>
+                        <div
+                          class="vedioName"
+                          :class="isClickNav == vedioIndex ? 'isClickNav' : ''"
+                        >
+                          {{ media.name }}
+                        </div>
                       </div>
                     </div>
                     <div
@@ -399,7 +404,7 @@
                       :key="textIndex + '2'"
                       @click="lookText(taskCount, textIndex)"
                     >
-                      <div
+                      <!-- <div
                         class="vedioNav"
                         style="
                           width: 80px;
@@ -411,9 +416,12 @@
                         "
                       >
                         文档
-                      </div>
+                      </div> -->
                       <div style="width: calc(100% - 115px)">
-                        <div class="navText">
+                        <div
+                          class="navText"
+                          :class="isClickNav == textIndex ? 'isClickNav' : ''"
+                        >
                           {{
                             textList[taskCount].length > 0 ? text.name : ""
                           }}.doc
@@ -451,9 +459,9 @@
                       class="newNav"
                       v-for="(lines, lineIndex) in lineList[taskCount]"
                       :key="lineIndex + '4'"
-                      @click="doUrl(lines.url)"
+                      @click="doUrl(lines.url, lineIndex)"
                     >
-                      <div
+                      <!-- <div
                         class="vedioNav"
                         style="
                           width: 80px;
@@ -465,9 +473,12 @@
                         "
                       >
                         链接
-                      </div>
+                      </div> -->
                       <div style="width: calc(100% - 115px)">
-                        <div class="navText">
+                        <div
+                          class="navText"
+                          :class="isClickNav == lineIndex ? 'isClickNav' : ''"
+                        >
                           <a
                             style="text-decoration: none; color: #000"
                             target="_Blank"
@@ -487,7 +498,7 @@
                       :key="fileIndex"
                       @click="downFile(f, fileIndex)"
                     >
-                      <div
+                      <!-- <div
                         class="vedioNav"
                         style="
                           width: 80px;
@@ -499,9 +510,12 @@
                         "
                       >
                         文档
-                      </div>
+                      </div> -->
                       <div style="width: calc(100% - 115px)">
-                        <div class="navText">
+                        <div
+                          class="navText"
+                          :class="isClickNav == fileIndex ? 'isClickNav' : ''"
+                        >
                           {{ f.name }}
                         </div>
                       </div>
@@ -1302,13 +1316,22 @@
                         v-for="(w, wIndex) in worksStudent[toolIndex]"
                         :key="wIndex"
                       >
-                        <div class="workImg">
+                        <div
+                          class="workImg"
+                          style="
+                            border-radius: 15px;
+                            box-shadow: 0px 0px 10px 10px #f2f2f2;
+                          "
+                        >
                           <!-- <img
                             src="../assets/icon/works/noImg.png"
                             @click="openTools(15, toolIndex, taskCount, w.works)"
                             alt=""
                           />-->
-                          <div class="answerBg">
+                          <div
+                            class="answerBg"
+                            style="border-radius: 15px 15px 0 0"
+                          >
                             <div>{{ w.sName }}</div>
                             <el-tooltip
                               class="item"
@@ -1321,6 +1344,31 @@
                               </div>
                             </el-tooltip>
                           </div>
+                          <div class="comment">
+                            <div class="commentList">
+                              <div
+                                class="commentImg"
+                                @click="
+                                  isLikes(w.wid, userid, 1, null, w.isLikes)
+                                "
+                              >
+                                <img
+                                  :src="w.isLikes == true ? likes : noLikes"
+                                  alt=""
+                                />
+                              </div>
+                              <div>{{ w.likesCount }}</div>
+                            </div>
+                            <!-- <div class="commentList">
+                              <div class="commentImg">
+                                <img
+                                  src="../assets/icon/comment/comment.png"
+                                  alt=""
+                                />
+                              </div>
+                              <div>{{ w.commentCount }}</div>
+                            </div> -->
+                          </div>
                         </div>
                       </div>
                     </div>
@@ -2361,12 +2409,15 @@ export default {
       ],
       mr: require("../assets/vedioPic.png"),
       word: require("../assets/uploadMp4.png"),
+      noLikes: require("../assets/icon/comment/noLikes.png"),
+      likes: require("../assets/icon/comment/likes.png"),
       courseDetail: {},
       chapInfo: [],
       chapInfoList: [],
       taskCount: 0,
       imgList: [],
       noImgList: [],
+      isClickNav: "",
       navId: "",
       playerOptions: {
         playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
@@ -2629,6 +2680,7 @@ export default {
         });
     },
     selectStudent() {
+      //学生查看自己作业
       let params = {
         uid: this.userid,
         cid: this.id,
@@ -2698,7 +2750,51 @@ export default {
           console.error(err);
         });
     },
+    isLikes(wid, uid, t, c, isLikes) {
+      if (isLikes == false) {
+        let params = [
+          {
+            wid: wid,
+            lid: uid,
+            t: t,
+            c: c,
+          },
+        ];
+        this.ajax
+          .post(this.$store.state.api + "insertComment", params)
+          .then((res) => {
+            this.$message({
+              message: "点赞成功",
+              type: "success",
+            });
+            this.selectSWorks();
+          })
+          .catch((err) => {
+            this.$message.error("点赞失败");
+            console.error(err);
+          });
+      } else {
+        let params = {
+          wid: wid,
+          lid: uid,
+          type: 1,
+        };
+        this.ajax
+          .get(this.$store.state.api + "deleteComment", params)
+          .then((res) => {
+            this.$message({
+              message: "取消点赞成功",
+              type: "success",
+            });
+            this.selectSWorks();
+          })
+          .catch((err) => {
+            console.error(err);
+          });
+      }
+    },
     selectSWorks() {
+      //教师查看全部作业
       let params = {
         cid: this.id,
         s: this.courseType,
@@ -2713,12 +2809,17 @@ export default {
             ].toolChoose;
           var b = res.data[0];
           var c = ["PDF", "DOC", "DOCX", "PPT", "PPTX", "XLSX", "XLS"];
+          var d = res.data[1];
+          var e = res.data[2];
 
           for (var i = 0; i < a.length; i++) {
             this.worksStudent[i] = [];
             this.isWorksS[i] = [];
             this.checkJson[i] = [];
             for (var j = 0; j < b.length; j++) {
+              var likesCount = 0;
+            var commentCount = 0;
+            var isLikes = false;
               var data = b[j];
               if (i == b[j].tool) {
                 if (data.type == 2 && a[i].tool[0] == 4) {
@@ -2742,6 +2843,22 @@ export default {
                         ] = 1);
                   }
                 }
+                for (var k = 0; k < d.length; k++) {
+                  //点赞
+                  if (d[k].workId == b[j].id) {
+                    likesCount++;
+
+                    if (d[k].likesId == this.userid) {
+                      isLikes = true;
+                    }
+                  }
+                }
+                for (var l = 0; l < e.length; l++) {
+                  //评论
+                  if (d[k].workId == b[j].id) {
+                    commentCount++;
+                  }
+                }
                 if (
                   (b[j].type == 1 || b[j].type == 4) &&
                   a[i].tool[0] != 15 &&
@@ -2755,32 +2872,48 @@ export default {
                     ) != -1
                   ) {
                     this.worksStudent[i].push({
+                      wid: b[j].id,
                       works: b[j].content,
                       sName: b[j].name,
                       type: 1,
                       time: b[j].time,
+                      likesCount: likesCount,
+                      commentCount: commentCount,
+                      isLikes: isLikes,
                     });
                   } else {
                     this.worksStudent[i].push({
+                      wid: b[j].id,
                       works: b[j].content,
                       sName: b[j].name,
                       type: 0,
                       time: b[j].time,
+                      likesCount: likesCount,
+                      commentCount: commentCount,
+                      isLikes: isLikes,
                     });
                   }
                 } else if (b[j].type == 3 && a[i].tool[0] == 15) {
                   this.worksStudent[i].push({
+                    wid: b[j].id,
                     works: b[j].content,
                     sName: b[j].name,
                     type: 2,
                     time: b[j].time,
+                    likesCount: likesCount,
+                    commentCount: commentCount,
+                    isLikes: isLikes,
                   });
                 } else if (b[j].type == 2 && a[i].tool[0] == 4) {
                   this.worksStudent[i].push({
+                    wid: b[j].id,
                     works: b[j].content,
                     sName: b[j].name,
                     type: 2,
                     time: b[j].time,
+                    likesCount: likesCount,
+                    commentCount: commentCount,
+                    isLikes: isLikes,
                   });
                 }
 
@@ -3331,11 +3464,6 @@ export default {
                   this.text = this.textList[this.taskCount][0];
                 }
               } else {
-                console.log(
-                  this.chapInfoList[this.courseType].chapterInfo[0].taskJson[
-                    this.taskCount
-                  ].chapterData
-                );
                 for (
                   var y = 0;
                   y <
@@ -3504,18 +3632,22 @@ export default {
       this.playerO = this.playerOptions;
     },
     onPlayerPlay() {},
-    lookVedio(u) {
+    lookVedio(u, i) {
+      this.isClickNav = "";
       // this.playerOptions.sources[0].src = u;
       var d = JSON.parse(JSON.stringify(this.playerOptions));
       d.sources[0].src = u;
       this.playerO[this.taskCount] = d;
       this.showType = 0;
+      this.isClickNav = i;
       this.$forceUpdate();
     },
     lookText(i, t) {
+      this.isClickNav = "";
       this.text = this.textList[i][t];
       // this.dialogVisible1 = true;
       this.showType = 1;
+      this.isClickNav = t;
     },
     lookTools(i, t) {
       this.chapTools = this.chapToolList[i][t];
@@ -3541,6 +3673,7 @@ export default {
       }
     },
     downFile(f, i) {
+      this.isClickNav = "";
       this.pptImgUrl1 = "";
       var a = ["PPT", "PPTX", "XLSX", "XLS", "DOC", "DOCX"]; //"PDF",
       if (
@@ -3569,6 +3702,7 @@ export default {
       } else {
         window.open(this.file[i].url);
       }
+      this.isClickNav = i;
     },
     downFileList(i) {
       window.open(this.noImgList[i].url);
@@ -3743,11 +3877,13 @@ export default {
       //   this.answerDialogVisible = true;
       // }
     },
-    doUrl(url) {
+    doUrl(url, i) {
+      this.isClickNav = "";
       if (url.indexOf("https://") == -1 && url.indexOf("http://") == -1) {
         url = "https://" + url;
       }
       window.open(url);
+      this.isClickNav = i;
     },
     addTools(t, i, index) {
       var a = 0;
@@ -5291,7 +5427,7 @@ export default {
   line-height: 30px;
 }
 .answerBg {
-  background: url("../assets/icon/answerBg.png") no-repeat;
+  background: url("../assets/icon/answerBgNew.png") no-repeat;
   background-size: 100% 100%;
   width: 100%;
   height: 100%;
@@ -5653,4 +5789,36 @@ export default {
   align-items: center;
   justify-content: center;
 }
+.isClickNav {
+  color: #499eef;
+}
+.commentImg {
+  width: 25px;
+  height: 25px;
+  cursor: pointer;
+}
+.commentImg > img {
+  width: 100%;
+  height: 100%;
+}
+.comment {
+  background: #f9f9f9;
+  border-radius: 0 0 15px 15px;
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+  justify-content: flex-end;
+  height: 35px;
+  padding-right: 15px;
+}
+.commentList {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+  justify-content: center;
+  align-content: center;
+  margin-left: 15px;
+}
 </style>