natasha il y a 3 ans
Parent
commit
03e4b779ae

+ 1 - 0
src/components/Adult/Preview.vue

@@ -310,6 +310,7 @@
                   <SelectTone
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>

+ 17 - 4
src/components/Adult/common/UploadView.vue

@@ -127,10 +127,23 @@ export default {
       }
     },
     handlebeforeUplaod(file) {
-      if (file.size > 20 * 1024 * 1024) {
-        this.$message.warning('上传pdf大小不能超过20M');
-        return false   //必须返回false
-      }
+        if(file.type.indexOf('image/') != -1 ){
+            if (file.size > 2 * 1024 * 1024) {
+                this.$message.warning('上传图片大小不能超过2M');
+                return false   //必须返回false
+            }
+        }else if(file.type.indexOf('application/pdf') != -1){
+            if (file.size > 20 * 1024 * 1024) {
+                this.$message.warning('上传pdf大小不能超过20M');
+                return false   //必须返回false
+            }
+        }else{
+            if (file.size > 500 * 1024 * 1024) {
+                this.$message.warning('上传文件大小不能超过500M');
+                return false   //必须返回false
+            }
+        }
+      
       this.loading = this.$loading({
         lock: true,
         text: "Loading",

+ 10 - 4
src/components/Adult/preview/CheckBoxModule.vue

@@ -2,14 +2,14 @@
 <template>
     <div class="Big-Book-prev-Textdes CheckboxModule" v-if="curQue">
         <h2>{{curQue.title}}</h2>
-        <el-checkbox v-model="userList[index]" v-for="(item,index) in curQue.option" :key="index">{{item.con}}</el-checkbox>
+        <el-checkbox v-model="curQue.Bookanswer[index]" v-for="(item,index) in curQue.option" :key="index" :readonly="TaskModel=='ANSWER'">{{item.con}}</el-checkbox>
     </div>
 </template>
 
 <script>
 export default {
   components: {},
-  props: ["curQue"],
+  props: ["curQue","TaskModel"],
   data() {
     return {
         userList: []
@@ -21,13 +21,19 @@ export default {
   methods: {
       handleData(){
           let _this = this
+          let userList = []
           _this.curQue.option.forEach(item => {
-              _this.userList.push(false)
+              userList.push(false)
           });
+          if (!this.curQue.Bookanswer) {
+            this.$set(this.curQue, "Bookanswer", userList);
+          }
       }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+      this.handleData()
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前

+ 25 - 6
src/components/Adult/preview/InputHasRecord.vue

@@ -145,12 +145,17 @@
               <el-input
                 :class="['textarea', items.record ? '' : 'textareaNoRecord']"
                 type="textarea"
-                v-model="answerArr[indexs]"
+                v-model="curQue.Bookanswer[indexs].answer"
                 placeholder="输入"
+                maxlength="200"
+                :readonly="TaskModel=='ANSWER'"
               ></el-input>
               <div v-if="items.record" class="luyin-inner">
                 <Soundrecord
                   @handleWav="handleWav"
+                  :answerRecordList="curQue.Bookanswer[indexs].recordList"
+                  :tmIndex="indexs"
+                  :TaskModel="TaskModel"
                   type="promax"
                   class="luyin-box"
                 />
@@ -268,12 +273,17 @@
           <el-input
             :class="['textarea', items.record ? '' : 'textareaNoRecord']"
             type="textarea"
-            v-model="answerArr[indexs]"
+            v-model="curQue.Bookanswer[indexs].answer"
             placeholder="输入"
+            maxlength="200"
+            :readonly="TaskModel=='ANSWER'"
           ></el-input>
           <div v-if="items.record" class="luyin-inner">
             <Soundrecord
               @handleWav="handleWav"
+              :answerRecordList="curQue.Bookanswer[indexs].recordList"
+              :tmIndex="indexs"
+              :TaskModel="TaskModel"
               type="promax"
               class="luyin-box"
             />
@@ -288,7 +298,7 @@
 import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
 export default {
   components: { Soundrecord },
-  props: ["curQue"],
+  props: ["curQue","TaskModel"],
   data() {
     return {
       wordShow: true,
@@ -302,14 +312,20 @@ export default {
   watch: {},
   //方法集合
   methods: {
-    handleWav(data) {},
+    handleWav(list, tmIndex) {
+        tmIndex = tmIndex ? tmIndex : 0;
+        this.$set(this.curQue.Bookanswer[tmIndex], "recordList", list);
+    },
     // 处理数据
     handleData() {
       let _this = this;
-      this.answerArr = []
+      let curCorrect = [];
       let curQue = JSON.parse(JSON.stringify(this.curQue));
       curQue.option.forEach((dItem, dIndex) => {
-        this.answerArr.push('')
+        curCorrect.push({
+            answer: "",
+            recordList: [],
+          });
         let paraArr = [];
         dItem.detail.wordsList.forEach((sItem, sIndex) => {
           this.mergeWordSymbol(dItem.detail.wordsList, sItem, sIndex);
@@ -322,6 +338,9 @@ export default {
         });
         this.$set(_this.curQue.option[dIndex].detail, "resArr", paraArr);
       });
+      if (!this.curQue.Bookanswer) {
+          this.$set(this.curQue, "Bookanswer", curCorrect);
+      }
     },
     //词和标点合一起
     mergeWordSymbol(sItem, wItem, curIndex) {

+ 47 - 27
src/components/Adult/preview/Ligature.vue

@@ -179,7 +179,7 @@
       </div>
     </div>
     <!-- 清除所有连线及连线的状态 -->
-    <div class="fuwei">
+    <div class="fuwei" :class="[TaskModel == 'ANSWER'?'notAllow':'']">
       <div @click="clearLine">
         <img src="../../../assets/adult/fuwei.png" alt="" />
         复位
@@ -194,7 +194,7 @@
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
-  props: ["curQue"],
+  props: ["curQue","TaskModel"],
   data() {
     //这里存放数据
     return {
@@ -252,9 +252,11 @@ export default {
   methods: {
     //   清除所有连线
     clearLine() {
-      this.jsPlumb.deleteEveryConnection(); //清除连线方法
-      this.data = [];
-      sessionStorage.removeItem("LineData");
+        if(!this.TaskModel||this.TaskModel!='ANSWER'){
+            this.jsPlumb.deleteEveryConnection(); //清除连线方法
+            this.data = [];
+            sessionStorage.removeItem("LineData");
+        }
     },
     showPlumb() {
       this.jsPlumb = this.$jsPlumb.getInstance({
@@ -300,36 +302,42 @@ export default {
         for (let j = 0; j < this.curQue.option.length; j++) {
           this.initLeaf(this.curQue.option[j].nodeId, "target");
         }
-      });
+      });    
       this.setjsPlumb(true, true);
       //点击连线
       this.jsPlumb.bind("click", (conn, originalEvent) => {
-        // 删除点击的线
-        this.data.forEach((item, i) => {
-          if (item.source == conn.sourceId) {
-            this.data.splice(i, 1);
+          if(!this.TaskModel||this.TaskModel!='ANSWER'){
+            // 删除点击的线
+            this.data.forEach((item, i) => {
+            if (item.source == conn.sourceId) {
+                this.data.splice(i, 1);
+            }
+            });
+            let node = document.getElementById(conn.sourceId);
+            this.jsPlumb.removeAllEndpoints(node);
+            sessionStorage.setItem("LineData", JSON.stringify(this.data));
+            this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
           }
-        });
-        let node = document.getElementById(conn.sourceId);
-        this.jsPlumb.removeAllEndpoints(node);
-        sessionStorage.setItem("LineData", JSON.stringify(this.data));
       });
 
       //连线时触发
       this.jsPlumb.bind("connection", (conn, originalEvent) => {
-        let fig = false;
-        this.data.forEach((item) => {
-          if (item.source == conn.sourceId && item.target == conn.targetId) {
-            fig = true;
+          if(!this.TaskModel||this.TaskModel!='ANSWER'){
+            let fig = false;
+            this.data.forEach((item) => {
+                if (item.source == conn.sourceId && item.target == conn.targetId) {
+                    fig = true;
+                }
+            });
+            if (!fig) {
+                this.data.push({
+                    source: conn.sourceId,
+                    target: conn.targetId,
+                });
+                sessionStorage.setItem("LineData", JSON.stringify(this.data));
+                this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
+            }
           }
-        });
-        if (!fig) {
-          this.data.push({
-            source: conn.sourceId,
-            target: conn.targetId,
-          });
-          sessionStorage.setItem("LineData", JSON.stringify(this.data));
-        }
       });
 
       //右键触发
@@ -366,7 +374,13 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    let sData = JSON.parse(sessionStorage.getItem("LineData"));
+    let sData = null
+    if (!this.curQue.Bookanswer) {
+        // sData = JSON.parse(sessionStorage.getItem("LineData"));
+        sData = []
+    }else{
+        sData = JSON.parse(this.curQue.Bookanswer)
+    }
     this.data = [];
     if (sData) {
       this.data = sData;
@@ -397,6 +411,7 @@ export default {
     }
     setTimeout(() => {
       if (this.data.length > 0) {
+          console.log(this.data)
         this.data.forEach((item) => {
           this.jsPlumb.connect({
             source: item.source,
@@ -588,6 +603,11 @@ export default {
   .fuwei {
     margin-top: 16px;
     height: 40px;
+    &.notAllow{
+        >div{
+            cursor: not-allowed;
+        }
+    }
     > div {
       float: right;
       width: 72px;

+ 11 - 5
src/components/Adult/preview/SelectTone.vue

@@ -40,7 +40,7 @@
         <a
           v-for="(itmes, indexs) in toneList"
           :key="indexs"
-          :class="['tone-item', userSelect[index] === indexs ? 'active' : '']"
+          :class="['tone-item', curQue.Bookanswer[index] === indexs ? 'active' : '']"
           @click="handleClick(index, indexs)"
         >
           <img :src="itmes" />
@@ -56,7 +56,7 @@ import AudioLine from "../preview/AudioLine.vue";
 
 export default {
   components: { Audio, AudioLine },
-  props: ["curQue", "themeColor"],
+  props: ["curQue", "themeColor","TaskModel"],
   data() {
     return {
       toneList: [
@@ -80,13 +80,18 @@ export default {
     // 处理数据
     handleData() {
       let _this = this;
-      _this.userSelect = [];
+      let userSelect = [];
       _this.curQue.option.forEach((item) => {
-        _this.userSelect.push("");
+        userSelect.push("");
       });
+      if (!this.curQue.Bookanswer) {
+          this.$set(this.curQue, "Bookanswer", userSelect);
+      }
     },
     handleClick(index, indexs) {
-      this.$set(this.userSelect, index, indexs);
+        if(!this.TaskModel||this.TaskModel!='ANSWER'){
+            this.$set(this.curQue.Bookanswer, index, indexs);
+        }
     },
     handleChangeTime(time,edTime) {
       let _this = this;
@@ -122,6 +127,7 @@ export default {
       if(this.timer){
           clearInterval(this.timer);
       }
+      this.handleData()
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},

+ 21 - 12
src/components/Adult/preview/SelectYinjie.vue

@@ -38,7 +38,7 @@
       <b v-if="item.number">{{ item.number }}</b>
       <div class="zijie-box">
         <p
-          :class="[userList[index].indexOf(indexs) > -1 ? 'active' : '']"
+          :class="[curQue.Bookanswer[index].indexOf(indexs) > -1 ? 'active' : '']"
           v-for="(items, indexs) in item.option"
           :key="indexs"
           @click="handleClick(index, indexs)"
@@ -47,7 +47,7 @@
         </p>
       </div>
       <a
-        :class="['clear-btn', userList[index].length > 0 ? 'active' : '']"
+        :class="['clear-btn', curQue.Bookanswer[index].length > 0 && TaskModel != 'ANSWER' ? 'active' : '',TaskModel == 'ANSWER'?'notAllow':'']"
         @click="handleClear(index)"
       ></a>
     </div>
@@ -59,7 +59,7 @@ import AudioLine from "../preview/AudioLine.vue";
 
 export default {
   components: { AudioLine },
-  props: ["curQue", "themeColor"],
+  props: ["curQue", "themeColor","TaskModel"],
   data() {
     return {
       userList: [],
@@ -73,21 +73,26 @@ export default {
   //方法集合
   methods: {
     handleData() {
-      let _this = this;
+      let userList = [];
       this.curQue.option.forEach((item) => {
-        _this.userList.push([]);
+        userList.push([]);
       });
+      if (!this.curQue.Bookanswer) {
+          this.$set(this.curQue, "Bookanswer", userList);
+      }
     },
     handleClick(index, indexs) {
-      if (this.userList[index].indexOf(indexs) > -1) {
-        this.userList[index].splice(this.userList[index].indexOf(indexs), 1);
-      } else {
-        // this.userList[index].push(indexs);
-        this.$set(this.userList, index, [indexs]);
-      }
+        if(!this.TaskModel||this.TaskModel!='ANSWER'){
+            if (this.curQue.Bookanswer[index].indexOf(indexs) > -1) {
+                this.curQue.Bookanswer[index].splice(this.curQue.Bookanswer[index].indexOf(indexs), 1);
+            } else {
+                // this.userList[index].push(indexs);
+                this.$set(this.curQue.Bookanswer, index, [indexs]);
+            }
+        }
     },
     handleClear(index) {
-      this.$set(this.userList, index, []);
+      this.$set(this.curQue.Bookanswer, index, []);
     },
     getCurTime(curTime) {
       this.curTime = curTime * 1000;
@@ -160,6 +165,7 @@ export default {
     .play-btn {
         width: 16px;
         height: 16px;
+        margin-right: 8px;
         background: url("../../../assets/NPC/play-red.png") center no-repeat;
         background-size: cover;
         &.active {
@@ -208,6 +214,9 @@ export default {
           center no-repeat;
         background-size: 100%;
       }
+      &.notAllow{
+          cursor: not-allowed;
+      }
     }
   }
 }

+ 1 - 0
src/components/Adult/preview/SentenceSortQP.vue

@@ -220,6 +220,7 @@ export default {
       font-family: "robot";
       line-height: 32px;
       margin-right: 4px;
+      flex-shrink: 0;
     }
     .content-box{
         background: #E9E9E9;

+ 14 - 5
src/components/Adult/preview/Single.vue

@@ -24,11 +24,12 @@
             </div>
         </div>
         <ul v-if="itemI.option">
-        <li v-for="(item, index) in itemI.option" :key="index" :class="['option'+itemI.numberList.con,single[indexI]===index?'active':'']">
+        <li v-for="(item, index) in itemI.option" :key="index" :class="['option'+itemI.numberList.con,curQue.Bookanswer[indexI].answer===index?'active':'']">
             <el-radio
-                v-model="single[indexI]"
+                v-model="curQue.Bookanswer[indexI].answer"
                 :label="index"
                 style="margin-right: 0"
+                :readonly="TaskModel=='ANSWER'"
             >
                 <span v-if="item.number">{{item.number}}</span>
                 <p :class="[item.font=='py'?'hasPinyin':item.font=='en'?'hasEn':item.font=='cn'?'hasCn':'']">{{ item.con }}</p>
@@ -51,7 +52,7 @@
             </template> -->
         </li>
         </ul>
-        <Soundrecord @handleWav="handleWav" type="pro" class="luyin-box" v-if="itemI.IsRecord"/>
+        <Soundrecord @handleWav="handleWav" type="pro" class="luyin-box" v-if="itemI.IsRecord" :answerRecordList="curQue.Bookanswer[indexI].recordList" :tmIndex="indexI" :TaskModel="TaskModel"/>
     </div>
     
   </div>
@@ -62,7 +63,7 @@ import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
 import Audio from "../preview/components/AudioRed.vue"; // 音频播放
 export default {
   components: {Soundrecord, Audio},
-  props: ["curQue","themeColor"],
+  props: ["curQue","themeColor","TaskModel"],
   data() {
     return {
         single:[]
@@ -75,9 +76,17 @@ export default {
     // 处理数据
     handleData(){
         let _this = this
+        let single = []
         _this.curQue.forEach(item => {
-            _this.single.push(null)
+            single.push({
+                answer: "",
+                recordList: [],
+            });
         });
+        if (!this.curQue.Bookanswer) {
+            this.$set(this.curQue, "Bookanswer", single);
+            debugger
+        }
     },
     handleWav(data) {
         

+ 3 - 1
src/components/Adult/preview/TextInputRecord.vue

@@ -58,12 +58,14 @@
           @keyup.enter="handleReplaceTone($event, indexs)"
           placeholder="输入"
           maxlength="200"
+          :readonly="TaskModel=='ANSWER'"
         />
         <template v-if="items.IsRecord">
           <Soundrecord
             @handleWav="handleWav"
             :answerRecordList="curQue.Bookanswer[indexs].recordList"
             :tmIndex="indexs"
+            :TaskModel="TaskModel"
             type="pro"
             class="luyin-box"
           />
@@ -80,7 +82,7 @@ import AudioLine from "../preview/AudioLine.vue";
 
 export default {
   components: { Soundrecord, Audio, AudioLine },
-  props: ["curQue", "themeColor"],
+  props: ["curQue", "themeColor","TaskModel"],
   data() {
     return {
       resArr: [],

+ 2 - 1
src/components/Adult/preview/UploadControlView.vue

@@ -10,7 +10,8 @@
           <template
             v-if="
               curQue.data.file_name.indexOf('png') != -1 ||
-              curQue.data.file_name.indexOf('jpg') != -1
+              curQue.data.file_name.indexOf('jpg') != -1 ||
+              curQue.data.file_name.indexOf('jpeg') != -1
             "
           >
             <img :src="curQue.data.file_url" alt="" />

+ 14 - 1
src/components/Adult/preview/VoiceMatrix.vue

@@ -322,6 +322,9 @@
         @getSelectData="getSelectData"
         @handleParentPlay="pauseOtherAudio"
         @sentPause="sentPause"
+        @handleWav="handleWav"
+        :answerRecordList="curQue.Bookanswer.recordList"
+        :TaskModel="TaskModel"
       />
       <audio-compare
         :style="{ flex: 1 }"
@@ -368,7 +371,7 @@ export default {
     AudioCompare,
     VoiceFullscreen,
   },
-  props: ["curQue", "themeColor"],
+  props: ["curQue", "themeColor", "TaskModel"],
   data() {
     return {
       // 组件id
@@ -468,6 +471,12 @@ export default {
       if (this.$refs.luyin.microphoneStatus) this.$refs.luyin.microphone();
       this.handleParentPlay();
     });
+    if (!this.curQue.Bookanswer) {
+        let bookanswer = {
+            recordList: [],
+        }
+        this.$set(this.curQue, "Bookanswer", bookanswer);
+    }
   },
 
   mounted() {
@@ -783,6 +792,10 @@ export default {
         });
       });
     },
+    handleWav(list, tmIndex) {
+      tmIndex = tmIndex ? tmIndex : 0;
+      this.$set(this.curQue.Bookanswer, "recordList", list);
+    },
   },
 };
 </script>