Browse Source

样式及权限问题

zengyicheng 2 years ago
parent
commit
961034897e
2 changed files with 185 additions and 13 deletions
  1. 79 2
      src/components/study.vue
  2. 106 11
      src/components/studyStudent.vue

+ 79 - 2
src/components/study.vue

@@ -85,6 +85,13 @@
               <div class="returnBtn" @click="allScrell" v-if="jdIndex == 0">
                 全屏
               </div>
+              <div
+                class="returnBtn"
+                @click="juriVisible = true"
+                v-if="jdIndex == 0 && tType == 1"
+              >
+                权限
+              </div>
               <div
                 class="returnBtn"
                 style="background: #225bc7"
@@ -891,7 +898,7 @@
                       >
                         <div
                           class="works"
-                          style="width: 240px; height: 170px; overflow: hidden"
+                          style="width: 200px; height: 140px; padding-top: 25px"
                           v-for="(w, wIndex) in worksStudent[jdIndex][rwIndex][
                             toolIndex
                           ]"
@@ -1983,6 +1990,34 @@
         <el-button @click="timeDialogVisible = false">关 闭</el-button>
       </div>
     </el-dialog>
+    <el-dialog
+      title="权限设置"
+      :visible.sync="juriVisible"
+      :append-to-body="true"
+      width="400px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
+      <div>
+        <div>
+          <div>
+            <el-switch
+              v-model="sIsOpen"
+              active-text="学生是否能查看所有作业"
+              class="switchCss"
+              @change="updateSLook"
+            ></el-switch>
+          </div>
+        </div>
+      </div>
+      <div slot="footer">
+        <el-button
+          style="background: #409efe; color: #fff"
+          @click="juriVisible = false"
+          >关 闭</el-button
+        >
+      </div>
+    </el-dialog>
     <el-dialog
       title="查看文档"
       :visible.sync="fullDialogVisible"
@@ -2058,6 +2093,7 @@ export default {
       tType: this.$route.query.tType,
       courseType: this.$route.query.type,
       screenType: this.$route.query.screenType,
+      juriVisible: false,
       pptImgUrl: "",
       pptImgUrl1: [],
       full: false,
@@ -2610,7 +2646,9 @@ export default {
       ];
       if (
         b.indexOf(
-          file.name.split(".")[file.name.split(".").length - 1].toLocaleUpperCase()
+          file.name
+            .split(".")
+            [file.name.split(".").length - 1].toLocaleUpperCase()
         ) != -1
       ) {
         if (file.size / 1024 / 1024 > 10) {
@@ -3140,6 +3178,7 @@ export default {
           _this.timer = setInterval(function () {
             _this.selectSWorks();
             _this.selectStudent();
+            _this.selectSLook();
           }, 5000);
           _this.$nextTick(function () {
             setTimeout(() => {
@@ -3330,6 +3369,30 @@ export default {
           console.error(err);
         });
     },
+    updateSLook() {
+      let params = {
+        sopen: this.sIsOpen == false ? 1 : 2,
+        cid: this.id,
+      };
+      this.ajax
+        .get(this.$store.state.api + "updateCourseSLook", params)
+        .then((res) => {
+          if (this.sIsOpen == true) {
+            this.$message({
+              message: "权限开放成功",
+              type: "success",
+            });
+          } else {
+            this.$message({
+              message: "权限关闭成功",
+              type: "success",
+            });
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     addWork() {
       if (this.studyJuri[0].content == "") {
         this.$message.error("请将信息填写完整");
@@ -3746,6 +3809,19 @@ export default {
           console.error(err);
         });
     },
+    selectSLook() {
+      let params = {
+        cid: this.id,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectCourseSLook", params)
+        .then((res) => {
+          this.sIsOpen = res.data[0][0].sopen == 1 ? false : true;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     setMindData() {
       this.data.data = [];
       this.data.data.push({ id: "root", isroot: true, topic: this.eTitle });
@@ -3814,6 +3890,7 @@ export default {
     this.getCourseDetail();
     this.selectCount();
     this.getHomeWork();
+    this.selectSLook();
     document.scrollingElement.scrollTop = 0;
     window.addEventListener("resize", () => {
       var a = document.getElementsByClassName("box_course")[0].offsetHeight;

+ 106 - 11
src/components/studyStudent.vue

@@ -90,6 +90,13 @@
             <div class="returnBtn" @click="nextOrpreSteps(0)">上一步</div>
             <div class="returnBtn" @click="nextOrpreSteps(1)">下一步</div>
             <div class="returnBtn" @click="allScrell">全屏</div>
+            <div
+              class="returnBtn"
+              @click="juriVisible = true"
+              v-if="tType == 1"
+            >
+              权限
+            </div>
             <div
               class="returnBtn"
               style="background: #225bc7"
@@ -844,7 +851,7 @@
                     >
                       <div
                         class="works"
-                        style="width: 240px; height: 170px"
+                        style="width: 200px; height: 140px; padding-top: 25px"
                         v-for="(w, wIndex) in workStudent[toolIndex]"
                         :key="wIndex"
                       >
@@ -1125,7 +1132,8 @@
                     </div>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(16) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(16) != -1"
                     class="worksBox"
                   >
                     <div
@@ -1146,7 +1154,7 @@
                     >
                       <div
                         class="works"
-                        style="width: 240px; height: 170px; overflow: hidden"
+                        style="width: 200px; height: 140px; padding-top: 25px"
                         v-for="(w, wIndex) in worksStudent[toolIndex]"
                         :key="wIndex"
                         :class="w.type == 1 ? 'isTypeOne' : ''"
@@ -1182,7 +1190,8 @@
                     </div>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(4) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(4) != -1"
                     class="worksBox"
                   >
                     <div
@@ -1259,7 +1268,8 @@
                     ></AskStatic>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(15) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(15) != -1"
                     class="worksBox"
                   >
                     <div
@@ -1317,7 +1327,8 @@
                     </div>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(1) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(1) != -1"
                     class="worksBox"
                   >
                     <div
@@ -1367,7 +1378,8 @@
                     </div>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(3) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(3) != -1"
                     class="worksBox"
                   >
                     <div
@@ -1417,7 +1429,8 @@
                     </div>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(6) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(6) != -1"
                     class="worksBox"
                   >
                     <div
@@ -1467,7 +1480,8 @@
                     </div>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(7) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(7) != -1"
                     class="worksBox"
                   >
                     <div
@@ -1517,7 +1531,8 @@
                     </div>
                   </div>
                   <div
-                    v-if="tType && tType == 1 && tool.tool.indexOf(26) != -1"
+                    v-if="tType && ((tType == 2 && sIsOpen == true) ||
+                          tType == 1) && tool.tool.indexOf(26) != -1"
                     class="worksBox"
                   >
                     <div
@@ -2173,6 +2188,34 @@
         <el-button @click="timeDialogVisible = false">关 闭</el-button>
       </div>
     </el-dialog>
+    <el-dialog
+      title="权限设置"
+      :visible.sync="juriVisible"
+      :append-to-body="true"
+      width="400px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
+      <div>
+        <div>
+          <div>
+            <el-switch
+              v-model="sIsOpen"
+              active-text="学生是否能查看所有作业"
+              class="switchCss"
+              @change="updateSLook"
+            ></el-switch>
+          </div>
+        </div>
+      </div>
+      <div slot="footer">
+        <el-button
+          style="background: #409efe; color: #fff"
+          @click="juriVisible = false"
+          >关 闭</el-button
+        >
+      </div>
+    </el-dialog>
     <el-dialog
       title="查看文档"
       :visible.sync="fullDialogVisible"
@@ -2267,6 +2310,7 @@ export default {
       pptImgUrl: "",
       pptImgUrl1: "",
       full: false,
+      sIsOpen: false,
       type: 1,
       vedio: [],
       text: [],
@@ -2353,6 +2397,7 @@ export default {
       isNoHomeWork: false,
       dialogVisible5: false,
       answerDialogVisible: false,
+      juriVisible: false,
       timeDialogVisible: false,
       radio: [],
       isAsk: false,
@@ -2781,7 +2826,9 @@ export default {
       ];
       if (
         b.indexOf(
-          file.name.split(".")[file.name.split(".").length - 1].toLocaleUpperCase()
+          file.name
+            .split(".")
+            [file.name.split(".").length - 1].toLocaleUpperCase()
         ) != -1
       ) {
         if (file.size / 1024 / 1024 > 10) {
@@ -3329,6 +3376,7 @@ export default {
           _this.timer = setInterval(function () {
             _this.selectSWorks();
             _this.selectStudent();
+            _this.selectSLook();
           }, 5000);
           _this.$nextTick(function () {
             setTimeout(() => {
@@ -3354,6 +3402,43 @@ export default {
           console.error(err);
         });
     },
+    updateSLook() {
+      let params = {
+        sopen: this.sIsOpen == false ? 1 : 2,
+        cid: this.id,
+      };
+      this.ajax
+        .get(this.$store.state.api + "updateCourseSLook", params)
+        .then((res) => {
+          if (this.sIsOpen == true) {
+            this.$message({
+              message: "权限开放成功",
+              type: "success",
+            });
+          } else {
+            this.$message({
+              message: "权限关闭成功",
+              type: "success",
+            });
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    selectSLook() {
+      let params = {
+        cid: this.id,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectCourseSLook", params)
+        .then((res) => {
+          this.sIsOpen = res.data[0][0].sopen == 1 ? false : true;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     getHomeWork() {
       let params = {
         cid: this.id,
@@ -3992,6 +4077,7 @@ export default {
     this.getCourseDetail();
     this.selectCount();
     this.getHomeWork();
+    this.selectSLook();
     document.scrollingElement.scrollTop = 0;
     window.addEventListener("resize", () => {
       var a = document.getElementsByClassName("box_course")[0].offsetHeight;
@@ -5532,4 +5618,13 @@ export default {
 .full_diy >>> .el-dialog__body {
   height: calc(100% - 100px);
 }
+.switchCss {
+  padding-bottom: 30px;
+  width: 100%;
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+  justify-content: center;
+}
 </style>