소스 검색

修改表格问题和计时器

zengyicheng 2 년 전
부모
커밋
1e70386ef4
2개의 변경된 파일109개의 추가작업 그리고 36개의 파일을 삭제
  1. 92 31
      src/components/pages/addCourse.vue
  2. 17 5
      src/components/tools/time.vue

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

@@ -286,7 +286,7 @@
             </div>
             <div class="whiteBg" style="border-radius: 0; margin-top: 15px">
               <div class="right_title">项目简要描述</div>
-              <div style="width: 95%; padding: 15px 0px 15px 20px;">
+              <div style="width: 95%; padding: 15px 0px 15px 20px">
                 <div style="width: 55%">
                   <textarea
                     rows="8"
@@ -303,7 +303,7 @@
                   style="padding-bottom: 30px"
                 ></el-switch>
               </div>-->
-              <div style="width: 95%; padding: 15px 0px 15px 20px;">
+              <div style="width: 95%; padding: 15px 0px 15px 20px">
                 <el-switch
                   v-model="isTeacherSee"
                   active-text="是否公开此项目"
@@ -1143,12 +1143,12 @@
                                   alt
                                   v-else
                                 />
-                              </div>
+                              </div>10
                             </div> -->
                             <div class="tool">
                               <div
                                 class="whiteBIcon"
-                                @click="addTools(10, itemTaskIndex, toolIndex)"
+                                @click="openTools(itemTaskIndex, 10, toolIndex)"
                               >
                                 <img
                                   src="../../assets/icon/thirdToolList/time.png"
@@ -1599,7 +1599,7 @@
                             <div class="tool">
                               <div
                                 class="whiteBIcon"
-                                @click="openTools(itemTaskIndex, 48, toolIndex)"
+                                @click="addTools(48, itemTaskIndex, toolIndex)"
                               >
                                 <img
                                   src="../../assets/icon/fourthToolList/table.png"
@@ -3519,6 +3519,23 @@
         <el-button type="primary" @click="addMoreUpload">确定</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="添加预设时间"
+      :visible.sync="dialogVisiblePreTime"
+      :append-to-body="true"
+      width="30%"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
+      <div
+      >
+        <Time :preTime="preTime" @updateTimeNum="updateTime" v-if="dialogVisiblePreTime"></Time>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisiblePreTime = false">取 消</el-button>
+        <el-button type="primary" @click="addPreTime">确定</el-button>
+      </span>
+    </el-dialog>
     <el-dialog
       title="分组设置"
       :visible.sync="dialogVisibleGroup"
@@ -3582,10 +3599,11 @@ import $ from "jquery";
 import EditorBar from "../../components/tools/wangEnduit";
 import Table from "../../components/tools/table";
 import Mind from "../tools/jsmind2";
+import Time from "../tools/time.vue";
 import Sunburst from "../tools/sunburst";
 import SeeBoard from "../tools/seeBoard";
 export default {
-  components: { EditorBar, Mind, Sunburst, SeeBoard, Table },
+  components: { EditorBar, Mind,Time, Sunburst, SeeBoard, Table },
   data() {
     return {
       checkAll: false,
@@ -3614,6 +3632,7 @@ export default {
       courseName: "",
       isTeacherSee: true,
       courseText: "",
+      preTime:0,
       formLabelWidth: "100px",
       choosePicVisible: false,
       sysPicVisible: false,
@@ -3650,6 +3669,7 @@ export default {
       dialogVisibleTable: false,
       tableJson: { text: "" },
       dialogVisibleMoreUpload: false,
+      dialogVisiblePreTime:false,
       uploadJson: [],
       classJuri: [],
       cover: [], //项目封面
@@ -4776,7 +4796,6 @@ export default {
       this.ajax
         .get(this.$store.state.api + "selectClassBySchool", params)
         .then((res) => {
-          debugger
           this.grade = res.data[0];
           this.classJuri = res.data[0];
         })
@@ -5434,40 +5453,59 @@ export default {
           this.sentenceList = sentenceList;
         }
         this.dialogVisibleSentence = true;
-      } else if (i == 48) {
+      }
+      //  else if (i == 48) {
+      //   if (
+      //     this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
+      //       .toolChoose[toolIndex].tableJson
+      //   ) {
+      //     this.tableJson = JSON.parse(
+      //       JSON.stringify(
+      //         this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
+      //           itemTaskIndex
+      //         ].toolChoose[toolIndex].tableJson
+      //       )
+      //     );
+      //   } else {
+      //     var tableJson = { text: "" };
+      //     this.tableJson = tableJson;
+      //   }
+      //   this.dialogVisibleTable = true;
+      // }
+      else if (i == 50) {
         if (
           this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
-            .toolChoose[toolIndex].tableJson
+            .toolChoose[toolIndex].uploadJson
         ) {
-          this.tableJson = JSON.parse(
+          this.uploadJson = JSON.parse(
             JSON.stringify(
               this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
                 itemTaskIndex
-              ].toolChoose[toolIndex].tableJson
+              ].toolChoose[toolIndex].uploadJson
             )
           );
         } else {
-          var tableJson = { text: "" };
-          this.tableJson = tableJson;
+          var uploadJson = [];
+          this.uploadJson = uploadJson;
         }
-        this.dialogVisibleTable = true;
-      } else if (i == 50) {
+        this.dialogVisibleMoreUpload = true;
+      } else if (i == 10) {
         if (
           this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
-            .toolChoose[toolIndex].uploadJson
+            .toolChoose[toolIndex].preTime
         ) {
-          this.uploadJson = JSON.parse(
+          this.preTime = JSON.parse(
             JSON.stringify(
               this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
                 itemTaskIndex
-              ].toolChoose[toolIndex].uploadJson
+              ].toolChoose[toolIndex].preTime
             )
           );
         } else {
-          var uploadJson = [];
-          this.uploadJson = uploadJson;
+          var preTime = 0;
+          this.preTime = preTime;
         }
-        this.dialogVisibleMoreUpload = true;
+        this.dialogVisiblePreTime = true;
       } else if (i == 49) {
         if (
           this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
@@ -5656,15 +5694,15 @@ export default {
           return;
         }
       }
-      if (i == 48) {
-        if (
-          !this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
-            .toolChoose[toolIndex].tableJson
-        ) {
-          this.openTools(itemTaskIndex, 48, toolIndex);
-          return;
-        }
-      }
+      // if (i == 48) {
+      //   if (
+      //     !this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
+      //       .toolChoose[toolIndex].tableJson
+      //   ) {
+      //     this.openTools(itemTaskIndex, 48, toolIndex);
+      //     return;
+      //   }
+      // }
       if (i == 50) {
         if (
           !this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
@@ -5674,6 +5712,7 @@ export default {
           return;
         }
       }
+
       if (i == 49) {
         if (
           !this.unitJson[this.unitIndex].chapterInfo[0].taskJson[itemTaskIndex]
@@ -6142,7 +6181,7 @@ export default {
             this.templateC.id = "123";
             this.courseUserid = res.data[0][0].userid;
             this.nbOrder = res.data[0][0].ordernumber;
-            this.courseTypeId = []
+            this.courseTypeId = [];
             for (var i = 0; i < res.data[1].length; i++) {
               this.courseTypeId.push(res.data[1][i].typeid);
             }
@@ -6714,6 +6753,25 @@ export default {
         this.addTools(50, this.taskCount, this.toolIndex);
       }
     },
+    addPreTime(){
+      if (this.preTime == 0) {
+        this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
+          this.taskCount
+        ].toolChoose[this.toolIndex].preTime = 0;
+      } else {
+        this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
+          this.taskCount
+        ].toolChoose[this.toolIndex].preTime = this.preTime;
+      }
+      this.preTime = 0;
+      this.dialogVisiblePreTime = false;
+      if (
+        this.unitJson[this.unitIndex].chapterInfo[0].taskJson[this.taskCount]
+          .toolChoose[this.toolIndex].tool != 10
+      ) {
+        this.addTools(10, this.taskCount, this.toolIndex);
+      }
+    },
     goToTask(i) {
       document.getElementsByClassName("rightBox")[0].scrollTop =
         document.getElementsByClassName("taskBorder")[i].offsetTop - 100;
@@ -6754,6 +6812,9 @@ export default {
         this.addTools(49, this.taskCount, this.toolIndex);
       }
     },
+    updateTime(preTime){
+      this.preTime = preTime;
+    },
   },
   beforeDestroy() {
     clearTimeout(this.timer);

+ 17 - 5
src/components/tools/time.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="container">
-    <div class="setters">
+    <div class="setters" v-if="wholeTime == 0">
       <div class="minutes-set">
         <button
           data-setter="minutes-plus"
@@ -57,11 +57,11 @@
     </div>
     <div class="controlls">
       <div class="display-remain-time">{{ displayString }}</div>
-      <button
+      <!-- <button
         :class="{ play: !play, pause: play }"
         id="pause"
         @click="pauseTimer"
-      ></button>
+      ></button> -->
     </div>
     <el-button type="primary" @click="reset" class="reset_btn">重置</el-button>
   </div>
@@ -69,6 +69,7 @@
 
 <script>
 export default {
+  props: ["preTime"],
   data() {
     return {
       length: Math.PI * 2 * 100,
@@ -124,6 +125,7 @@ export default {
       }${seconds}`;
       // displayOutput.textContent = displayString;
       this.update(timeLeft, this.wholeTime, type);
+      this.updateTimeNum();
     },
     timer(seconds) {
       //counts time, takes seconds
@@ -178,11 +180,21 @@ export default {
       this.update(this.wholeTime, this.wholeTime, 1);
       this.displayTimeLeft(this.wholeTime, 1);
     },
+    updateTimeNum() {
+      this.$emit("updateTimeNum", this.wholeTime);
+    },
+    getValue() {
+      this.wholeTime = this.preTime;
+      this.update(this.wholeTime, this.wholeTime, 1);
+      this.displayTimeLeft(this.wholeTime,1);
+      // this.$forceUpdate();
+    },
   },
   created() {
     this.offset = this.length;
-    this.update(this.wholeTime, this.wholeTime);
-    this.displayTimeLeft(this.wholeTime);
+    // this.update(this.wholeTime, this.wholeTime);
+    // this.displayTimeLeft(this.wholeTime);
+    this.getValue();
   },
   beforeDestroy() {
     clearInterval(this.intervalTimer);