瀏覽代碼

课件拆分

natasha 3 年之前
父節點
當前提交
f7da37bf8e

+ 72 - 3
src/components/Adult/Preview.vue

@@ -127,7 +127,10 @@
         v-for="(item, index) in cur.cur_fn_data"
         :key="index"
         class="title-box-preview"
+        :class="[!previewType || previewType=='previewCheck' || previewType=='previewCheckShow'&&item.previewShow||JSON.parse(previewGroupId).length==0?'NNPE-Book-content-item':'']"
       >
+      <el-checkbox class="NNPE-Book-content-item-checkbox" :label="item.group_id" v-if="previewType&&previewType=='previewCheck'&&item.group_id" v-model="groupCheckList[index]" @change="forupdata(index)"><br/></el-checkbox>
+        <template v-if="!previewType || previewType=='previewCheck' || previewType=='previewCheckShow'&&item.previewShow||JSON.parse(previewGroupId).length==0">
         <div
           v-if="item.number || item.z_title || item.f_title"
           class="title-big"
@@ -533,6 +536,7 @@
             </div>
           </div>
         </div>
+        </template>
       </div>
     </div>
     <div v-if="isShowSave || isShowTitle" class="NNPE-title NNPE-title-gray">
@@ -593,11 +597,11 @@ import VideoControl from "./preview/VideoControl.vue"; // 视频控件
 import TableView from "./preview/TableView.vue"; // 视频控件
 import PdfView from "./preview/PdfView.vue"; // 视频控件
 import SentenceModule from "./preview/SentenceModule.vue"; // 图片模板
-import PlayRecordView from "@/components/Adult/preview/PlayRecordView.vue";
+import PlayRecordView from "./preview/PlayRecordView.vue";
 import OptionsList from "./preview/OptionsList.vue"; // 选项模板
 
 export default {
-  name: "Preview",
+  name: "Booknpc",
   components: {
     Picture,
     Record,
@@ -649,6 +653,8 @@ export default {
     "bookAnswerContent",
     "TaskModel",
     "isShowSave",
+    "previewType",
+    "previewGroupId"
   ],
   data() {
     return {
@@ -692,6 +698,11 @@ export default {
       refresh: true,
       preClick: false, // 上一页是否可点
       nextClick: false, // 下一页是否可点
+      answerTime: 0,
+      answerTimeInterval: null, // 计时器
+      groupIndexList: [], // 勾选groupid数组
+      groupCheckList: [], // checkbox 是否选中
+
     };
   },
   computed: {},
@@ -805,6 +816,9 @@ export default {
       _this.NNPENewPhraseList = [];
       _this.NNPEAnnotationList = [];
       _this.watchIndex = _this.queIndex + new Date().getTime();
+      this.groupCheckList = []
+      let selectGropuIdList = this.previewGroupId?JSON.parse(this.previewGroupId):[]
+      this.groupCheckList = []
       if (_this.contextData) {
         // const list = _this.contextData;
         // if (list && list.length > 0) {
@@ -829,6 +843,14 @@ export default {
         // }
         _this.cur = _this.contextData;
         _this.cur.cur_fn_data.forEach((item, index) => {
+          this.groupCheckList.push(false)
+          selectGropuIdList.forEach((itemId)=>{
+              itemId.forEach(itemIds=>{
+                  if(item.group_id&&itemIds.indexOf(item.group_id[0])>-1){
+                    item.previewShow = true
+                  }
+              })
+          })
           item.table_list.forEach((items, indexs) => {
             items.forEach((itemss, indexss) => {
               if (itemss.data && itemss.data.type == "NewWord_chs") {
@@ -937,6 +959,7 @@ export default {
       }
     },
     submitUserAnswerNPC() {
+      this.handleAnswerTimeEnd();
       let contextData = JSON.parse(JSON.stringify(this.contextData));
       let result = [];
       contextData.cur_fn_data.forEach((item, index) => {
@@ -962,8 +985,46 @@ export default {
           });
         });
       });
-      this.$emit("finishTaskMaterial", JSON.stringify(result));
+      this.$emit("finishTaskMaterial", JSON.stringify(result), this.answerTime);
+    },
+    // 开始计算答题用时
+    handleAnswerTimeStart() {
+      this.answerTime = 0;
+      window.clearInterval(this.answerTimeInterval);
+      this.answerTimeInterval = window.setInterval(() => {
+        this.answerTime++;
+      }, 1000);
+    },
+    // 结束计算答题用时
+    handleAnswerTimeEnd() {
+      window.clearInterval(this.answerTimeInterval);
     },
+    // 提交选中groupid
+    submitPreviewGroupId(){
+        return JSON.stringify(this.groupIndexList)
+    },
+    forupdata(indexI) {
+      if(this.groupIndexList.toString().indexOf((this.cur.cur_fn_data[indexI].group_id).toString())==-1){
+          this.groupIndexList.push(this.cur.cur_fn_data[indexI].group_id)
+      }else{
+          this.groupIndexList.forEach((items,indexs)=>{
+              if(items.toString()==this.cur.cur_fn_data[indexI].group_id.toString()){
+                  this.groupIndexList.splice(indexs,1)
+                  return false;
+              }
+          })
+      }
+      this.groupCheckList.forEach((item,index)=>{
+          this.groupCheckList[index] = false
+      })
+      this.cur.cur_fn_data.forEach((item,index)=>{
+          if(this.groupIndexList.toString().indexOf((item.group_id).toString())>-1){
+              this.groupCheckList[index] = true
+          }
+      })
+      this.$forceUpdate()
+    },
+
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
@@ -1131,6 +1192,14 @@ export default {
   }
   .NNPE-Book-content-inner {
     padding: 0 40px;
+    .NNPE-Book-content-item{
+          position: relative;
+    }
+    .NNPE-Book-content-item-checkbox{
+          position: absolute;
+          left: -20px;
+          top: 36px;
+    }
     > div.title-box-preview {
       padding-top: 32px;
       .title-big {

+ 0 - 2
src/components/Adult/preview/ArticleViewChs/index.vue

@@ -215,8 +215,6 @@ export default {
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;
-    console.log("我是文章预览");
-    console.log(this.curQue);
     if (!this.curQue.Bookanswer) {
       let userAnswer = JSON.parse(JSON.stringify(_this.userAnswer));
       _this.$set(this.curQue, "Bookanswer", userAnswer);

+ 0 - 3
src/components/Adult/preview/DialogueArticleViewChs/index.vue

@@ -239,13 +239,10 @@ export default {
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;
-    console.log(_this.TaskModel);
     if (!_this.curQue.Bookanswer) {
       let userAnswer = JSON.parse(JSON.stringify(_this.userAnswer));
       _this.$set(this.curQue, "Bookanswer", userAnswer);
     }
-    console.log("我是文章预览");
-    console.log(this.curQue);
     if (_this.curQue) {
       _this.$nextTick(() => {
         _this.bodyLeft =

+ 32 - 1
src/views/adultInput.vue

@@ -118,7 +118,7 @@
           v-for="(topic, toindex) in question_list.cur_fn_data"
           :key="'topic' + toindex"
         >
-          <p>第{{ toindex + 1 }}题</p>
+          <div style="display:flex;align-items:center;"><p>第{{ toindex + 1 }}题</p> <el-checkbox v-model="groupIndexList" :label="toindex" style="margin:0 10px;"><br/></el-checkbox><span>{{topic.group_name}}</span></div>
           <div class="adult-book-input-item">
             <span class="adult-book-lable">序号:</span>
             <el-input
@@ -757,6 +757,7 @@
         <!-- </el-tabs> -->
       </div>
       <div v-if="currentTreeID" class="Book-function">
+        <el-button type="success" @click="handleSetGroup" size="medium">设置分组</el-button>
         <ul class="function-list">
           <li
             v-for="(item, index) in fn_data"
@@ -1055,6 +1056,7 @@ export default {
         "⑳",
       ],
       TaskModel: "",
+      groupIndexList:[]
     };
   },
   computed: {
@@ -1233,6 +1235,7 @@ export default {
     },
     createTable() {
       if (this.row && this.line) {
+        let groupid = (new Date().toLocaleString().replace(/\s|:|\/*/g,"")+new Date().getMilliseconds()+Math.random().toString(36).substr(2)+new Date().getMilliseconds()+Math.random().toString(36).substr(2)).substring(0,32)
         let arr = {
           z_title: "",
           f_title: "",
@@ -1242,6 +1245,8 @@ export default {
           is_layout: false, // 是不是按背景图布局
           is_textIndex: false,
           table_list: [],
+          group_name:'', // 设置分组name
+          group_id: [groupid], // 分组id
         };
         for (let i = 0; i < this.row; i++) {
           let rowArr = [];
@@ -1316,6 +1321,13 @@ export default {
             ? JSON.parse(res.content)
             : JSON.parse(JSON.stringify(this.org_question_list));
           let data = JSON.parse(JSON.stringify(this.question_list));
+          data.cur_fn_data.forEach((item) => {
+            if(!item.group_id){
+                let groupid = (new Date().toLocaleString().replace(/\s|:|\/*/g,"")+new Date().getMilliseconds()+Math.random().toString(36).substr(2)+new Date().getMilliseconds()+Math.random().toString(36).substr(2)).substring(0,32)
+                item.group_name = '' // 设置分组name
+                item.group_id = [groupid] // 分组id
+            }
+          })
           data.detailList.forEach((item) => {
             if (!item.detail) {
               let obj = JSON.parse(JSON.stringify(item));
@@ -1701,6 +1713,23 @@ export default {
     emptyQustion() {
       this.currentTreeID = "";
     },
+    // 设置分组
+    handleSetGroup(){
+        let groupname = ''
+        let groupid = (new Date().toLocaleString().replace(/\s|:|\/*/g,"")+new Date().getMilliseconds()+Math.random().toString(36).substr(2)+new Date().getMilliseconds()+Math.random().toString(36).substr(2)).substring(0,32)
+        this.groupIndexList.forEach(item=>{
+            groupname += item+1+'-'
+        })
+        groupname = groupname.substring(0,groupname.length-1)
+        this.question_list.cur_fn_data.forEach((curItem,indexItem) => {
+            if(this.groupIndexList.indexOf(indexItem)>-1){
+                curItem.group_name = '打包组' + groupname
+                curItem.group_id = [groupid]
+            }
+        });
+        this.groupIndexList = []
+        this.$forceUpdate()
+    },
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
@@ -1815,8 +1844,10 @@ export default {
     padding: 30px 16px;
     height: 859px;
     overflow-y: auto;
+    text-align: center;
     .function-list {
       width: 100%;
+      margin-top: 5px;
       > li {
         width: 100%;
         width: 172px;