Sfoglia il codice sorgente

Merge branch 'master' of http://221.216.211.14:3000/GCLS/GCLS_Page_Book_Component_NPC

gcj 3 anni fa
parent
commit
447ac55c9d

BIN
src/assets/newImage/common/luyin-notAllow.png


+ 29 - 4
src/components/Adult/Preview.vue

@@ -171,7 +171,7 @@
             >
               <template v-if="itemss.data">
                 <template v-if="itemss.type == 'ligature_chs'">
-                  <Ligature :cur-que="itemss.data" :theme-color="themeColor" />
+                  <Ligature :cur-que="itemss.data" :theme-color="themeColor" :TaskModel="TaskModel" />
                 </template>
                 <template v-if="itemss.data.type == 'image'">
                   <Picture
@@ -182,13 +182,11 @@
                     v-if="refresh"
                   />
                 </template>
-                <template v-if="itemss.type == 'record_chs'">
-                  <Record :cur-que="itemss.data" :theme-color="themeColor" />
-                </template>
                 <template v-if="itemss.type == 'phrase_chs'">
                   <WordPhrase
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -199,6 +197,7 @@
                     :currentTreeID="currentTreeID"
                     :indexs="indexs"
                     :indexss="indexss"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -206,6 +205,7 @@
                   <WordPhrase
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -213,6 +213,7 @@
                   <Notes
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -224,6 +225,7 @@
                     :n-n-p-e-annotation-list="NNPEAnnotationList"
                     :theme-color="themeColor"
                     :currentTreeID="currentTreeID"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -243,6 +245,7 @@
                     :color-box="colorBox"
                     :theme-color="themeColor"
                     :currentTreeID="currentTreeID"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -251,6 +254,7 @@
                     :cur-que="itemss.data"
                     :color-box="colorBox"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -258,6 +262,7 @@
                   <InputHasRecord
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -265,6 +270,7 @@
                   <TextInputRecord
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -280,6 +286,7 @@
                   <SentenceInput
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -287,6 +294,7 @@
                   <NumberSelectHasRecord
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -294,6 +302,7 @@
                   <voice-matrix
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -308,6 +317,7 @@
                   <Soduko
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -315,6 +325,7 @@
                   <Single
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -322,6 +333,7 @@
                   <TextProblem
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -330,6 +342,7 @@
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
                     :indexStr="index + '_' + indexs + '_' + indexss"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -339,6 +352,7 @@
                   <SelectYinjie
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -346,6 +360,7 @@
                   <SentenceListenRead
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -353,6 +368,7 @@
                   <SentenceSortQP
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -360,6 +376,7 @@
                   <Checkbox
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -374,6 +391,7 @@
                   <RecordModule
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -387,6 +405,7 @@
                     :cur-que="itemss.data"
                     :type="itemss.type"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -395,6 +414,7 @@
                     :cur-que="itemss.data"
                     :handle-n-n-p-enext="handleNNPEnext"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -402,6 +422,7 @@
                   <Tinydemo
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -413,6 +434,7 @@
                     :indexStr="
                       index + '_' + indexs + '_' + indexss + '_' + currentTreeID
                     "
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -421,6 +443,7 @@
                     :cur-que="itemss.data"
                     :type="itemss.type"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -429,6 +452,7 @@
                     :cur-que="itemss.data"
                     :type="itemss.type"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>
@@ -437,6 +461,7 @@
                     :cur-que="itemss.data"
                     :type="itemss.type"
                     :theme-color="themeColor"
+                    :TaskModel="TaskModel"
                     v-if="refresh"
                   />
                 </template>

+ 84 - 78
src/components/Adult/preview/Soundrecord.vue

@@ -3,7 +3,7 @@
   <div class="NNPE-Book-record">
     <template v-if="(type && type == 'normal') || (type && type == 'mini')">
       <div
-        :class="['record', microphoneStatus ? 'active' : '']"
+        :class="['record', microphoneStatus ? 'active' : '', !this.TaskModel||this.TaskModel!='ANSWER'?'':'notAllow']"
         @click="microphone"
       />
       <span
@@ -30,7 +30,7 @@
     </template>
     <template v-else-if="type && type == 'pro'">
       <div
-        :class="['record', microphoneStatus ? 'active' : '']"
+        :class="['record', microphoneStatus ? 'active' : '', !this.TaskModel||this.TaskModel!='ANSWER'?'':'notAllow']"
         @click="microphone"
       />
       <el-select
@@ -41,7 +41,7 @@
       >
         <el-option
           v-for="(item, index) in recordList"
-          :key="item.id"
+          :key="'select'+item.id"
           :label="item.name"
           :value="index"
         />
@@ -57,13 +57,13 @@
         "
       />
       <a
-        :class="['record-delete', hasMicro ? 'record-delete-has' : '']"
+        :class="['record-delete', hasMicro&&(!this.TaskModel||this.TaskModel!='ANSWER') ? 'record-delete-has' : '', !this.TaskModel||this.TaskModel!='ANSWER'?'':'notAllow']"
         @click="handleDelete"
       />
     </template>
     <template v-else>
       <div
-        :class="['record', microphoneStatus ? 'active' : '']"
+        :class="['record', microphoneStatus ? 'active' : '', !this.TaskModel||this.TaskModel!='ANSWER'?'':'notAllow']"
         @click="microphone"
       />
       <span
@@ -81,7 +81,7 @@
       >
         <el-option
           v-for="(item, index) in recordList"
-          :key="item.id"
+          :key="'selectbig' + item.id + index "
           :label="item.name"
           :value="index"
         />
@@ -97,7 +97,7 @@
         "
       />
       <a
-        :class="['record-delete', hasMicro ? 'record-delete-has' : '']"
+        :class="['record-delete', hasMicro&&(!this.TaskModel||this.TaskModel!='ANSWER') ? 'record-delete-has' : '', !this.TaskModel||this.TaskModel!='ANSWER'?'':'notAllow']"
         @click="handleDelete"
       />
     </template>
@@ -115,6 +115,7 @@ export default {
     "selectData",
     "tmIndex",
     "answerRecordList",
+    "TaskModel"
   ],
   data() {
     return {
@@ -182,77 +183,66 @@ export default {
     // 开始录音
     microphone() {
       let _this = this;
+      if(!this.TaskModel||this.TaskModel!='ANSWER'){
+          if (!_this.microphoneStatus) {
+            _this.hasMicro = "";
+            _this.$root.isRecording = true;
+            _this.$emit("getWavblob", null);
+            this.$emit("getSelectData", { type: "" });
+            // 开始录音
+            this.recorder.start();
+            this.microphoneStatus = true;
+            this.recordtime = 0;
+            this.isPlaying = false;
+            clearInterval(_this.timer);
+                _this.timer = setInterval(() => {
+                _this.recordtime++;
+            }, 1000);
+            this.$emit("handleParentPlay");
+            let obj = {
+                name: _this.fileName
+                    ? _this.fileName + _this.recordFile
+                    : "新录音" + _this.recordFile,
+                id: _this.recordFile + Math.round(Math.random() * 10),
+            };
+            if (this.selectData) obj.selectData = this.selectData;
+                _this.recordList.push(obj);
 
-      if (!_this.microphoneStatus) {
-        _this.hasMicro = "";
-        _this.$root.isRecording = true;
-        _this.$emit("getWavblob", null);
-        this.$emit("getSelectData", { type: "" });
-        // 开始录音
-        this.recorder.start();
-        this.microphoneStatus = true;
-        this.recordtime = 0;
-        this.isPlaying = false;
-        clearInterval(_this.timer);
-        _this.timer = setInterval(() => {
-          _this.recordtime++;
-        }, 1000);
-        this.$emit("handleParentPlay");
-        let obj = {
-          name: _this.fileName
-            ? _this.fileName + _this.recordFile
-            : "新录音" + _this.recordFile,
-          id: _this.recordFile + Math.round(Math.random() * 10),
-        };
-        if (this.selectData) obj.selectData = this.selectData;
-        _this.recordList.push(obj);
-
-        _this.recordFile++;
-        _this.selectIndex = _this.recordList.length - 1;
-      } else {
-        this.hasMicro = "normal";
-        this.recorder.stop();
-        _this.$root.isRecording = false;
-        clearInterval(_this.timer);
-        // if (
-        //   (this.type && this.type == "normal") ||
-        //   (this.type && this.type == "mini")
-        // ) {
-        //   this.hasMicro = "normal";
-        // } else {
-        //   this.recordtime = 0;
-        // }
-        let toltime = this.recorder.duration; // 录音总时长
-        let fileSize = this.recorder.fileSize; // 录音总大小
-        // 录音结束,获取取录音数据
-        let PCMBlob = this.recorder.getPCMBlob(); // 获取 PCM 数据
-        let wav = this.recorder.getWAVBlob(); // 获取 WAV 数据
-        // this.wavblob = wav;
-        this.microphoneStatus = false;
-        let reader = new window.FileReader();
-        reader.readAsDataURL(wav);
-        reader.onloadend = () => {
-          _this.recordList[_this.selectIndex].wavData = reader.result;
-          _this.recordList[_this.selectIndex].toltime = Math.floor(toltime);
-          _this.recordList[_this.selectIndex].fileSize = fileSize;
-          //   if (
-          //     (_this.type && _this.type == "normal") ||
-          //     (_this.type && _this.type == "mini")
-          //   ) {
-          _this.wavblob = _this.recordList[_this.selectIndex].wavData;
-          _this.$emit("getWavblob", _this.wavblob);
-          _this.$emit(
-            "handleWav",
-            JSON.parse(JSON.stringify(_this.recordList)),
-            _this.tmIndex
-          );
-          if (this.recordList[this.selectIndex].selectData)
-            this.$emit(
-              "getSelectData",
-              this.recordList[this.selectIndex].selectData
-            );
-          //   }
-        };
+                _this.recordFile++;
+                _this.selectIndex = _this.recordList.length - 1;
+            } else {
+                this.hasMicro = "normal";
+                this.recorder.stop();
+                _this.$root.isRecording = false;
+                clearInterval(_this.timer);
+                let toltime = this.recorder.duration; // 录音总时长
+                let fileSize = this.recorder.fileSize; // 录音总大小
+                // 录音结束,获取取录音数据
+                let PCMBlob = this.recorder.getPCMBlob(); // 获取 PCM 数据
+                let wav = this.recorder.getWAVBlob(); // 获取 WAV 数据
+                // this.wavblob = wav;
+                this.microphoneStatus = false;
+                let reader = new window.FileReader();
+                reader.readAsDataURL(wav);
+                reader.onloadend = () => {
+                _this.recordList[_this.selectIndex].wavData = reader.result;
+                _this.recordList[_this.selectIndex].toltime = Math.floor(toltime);
+                _this.recordList[_this.selectIndex].fileSize = fileSize;
+                _this.wavblob = _this.recordList[_this.selectIndex].wavData;
+                _this.$emit("getWavblob", _this.wavblob);
+                _this.$emit(
+                    "handleWav",
+                    JSON.parse(JSON.stringify(_this.recordList)),
+                    _this.tmIndex
+                );
+            if (this.recordList[this.selectIndex].selectData)
+                this.$emit(
+                "getSelectData",
+                this.recordList[this.selectIndex].selectData
+                );
+            //   }
+            };
+        }
       }
     },
     playmicrophone(totalTimes) {
@@ -263,9 +253,11 @@ export default {
           let _this = this;
           if (!this.audio.paused) {
             this.audio.pause();
+            this.hasMicro = 'normal'
             clearInterval(_this.timer);
           } else if (this.audio.paused && _this.oldIndex == _this.selectIndex) {
             _this.audio.play();
+            this.hasMicro = 'active'
             if (_this.recordtime == 0) {
               _this.recordtime = totalTimes;
               _this.playtime = 0;
@@ -279,6 +271,7 @@ export default {
               }
             }, 1000);
           } else {
+            _this.hasMicro = 'active'
             _this.audio.pause();
             _this.audio.load();
             _this.audio.src = _this.wavblob;
@@ -341,7 +334,7 @@ export default {
     },
     handleDelete() {
       let _this = this;
-      if (_this.hasMicro) {
+      if (_this.hasMicro&&(!this.TaskModel||this.TaskModel!='ANSWER')) {
         if (_this.selectIndex || _this.selectIndex == 0) {
           _this.recordList.splice(_this.selectIndex, 1);
           _this.$emit(
@@ -365,6 +358,10 @@ export default {
           _this.oldIndex = null;
           _this.isPlaying = false;
           clearInterval(_this.timer);
+          _this.audio.addEventListener("ended", function () {
+            _this.changeStatus("normal");
+            _this.isPlaying = false;
+          });
         }
       }
     },
@@ -424,6 +421,12 @@ export default {
         no-repeat;
       background-size: 100%;
     }
+    &.notAllow{
+        cursor: not-allowed;
+        background: url("../../../assets/newImage/common/luyin-notAllow.png") center
+            no-repeat;
+        background-size: 100%;
+    }
   }
   .record-time {
     color: rgba(0, 0, 0, 0.3);
@@ -459,6 +462,9 @@ export default {
         background-size: 100%;
       }
     }
+    &.notAllow{
+        cursor: not-allowed;
+    }
   }
 }
 </style>

+ 42 - 25
src/components/Adult/preview/TableView.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="TableView" v-if="curQue">
+  <div class="TableView" v-if="curQue&&curQue.Bookanswer">
     <!-- 表格 -->
     <div class="table">
       <table>
@@ -24,8 +24,15 @@
               {{ col.con }}
             </template>
             <template v-else>
-                <div v-html="curQue.Bookanswer.curCorrect[rowIndex][colIndex]" contenteditable="true" placeholder="输入" class="input" @input="handleMaxlength" ></div>
-              <!-- <input type="text" v-model="col.con" /> -->
+                <!-- <div v-html="curQue.Bookanswer.curCorrect[rowIndex][colIndex]" contenteditable="true" placeholder="输入" class="input" @input="handleMaxlength" ></div> -->
+                <el-input
+                    type="textarea"
+                    autosize
+                    placeholder="输入"
+                    v-model="curQue.Bookanswer.curCorrect[rowIndex][colIndex]"
+                    :readonly="TaskModel=='ANSWER'"
+                    maxlength="200">
+                </el-input>
             </template>
           </td>
         </tr>
@@ -43,7 +50,7 @@
     </div>
     <!-- 录音 -->
     <div class="record">
-      <Soundrecord @handleWav="handleWav" type="pro-plus" class="luyin-box" />
+      <Soundrecord :answerRecordList="curQue.Bookanswer.recordList" @handleWav="handleWav" :TaskModel="TaskModel" type="pro-plus" class="luyin-box" />
     </div>
   </div>
 </template>
@@ -58,7 +65,7 @@ export default {
   components: {
     Soundrecord,
   },
-  props: ["curQue"],
+  props: ["curQue","TaskModel"],
   data() {
     //这里存放数据
     return {};
@@ -77,24 +84,25 @@ export default {
         if(e.target.innerHTML.length>200){
             e.target.innerHTML = e.target.innerHTML.substring(0, 200);
         }
+        this.$forceUpdate()
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
+      let curCorrect = [];
+      this.curQue.option.forEach((item) => {
+        let curCorrectItem = []
+        item.forEach((it)=>{
+            if (it.con == "") {
+                curCorrectItem.push('')
+                it.isNull = true
+            }else{
+                curCorrectItem.push(null)
+            }
+        })
+        curCorrect.push(curCorrectItem)
+      });
       if (!this.curQue.Bookanswer) {
-        let curCorrect = [];
-        this.curQue.option.forEach((item) => {
-            let curCorrectItem = []
-            item.forEach((it)=>{
-                if (it.con == "") {
-                    curCorrectItem.push('')
-                    it.isNull = true
-                }else{
-                    curCorrectItem.push(null)
-                }
-            })
-            curCorrect.push(curCorrectItem)
-        });
         let bookanswer = {
             curCorrect : curCorrect,
             recordList: [],
@@ -205,13 +213,6 @@ export default {
           color: #000000;
           font-size: 16px;
           padding: 6px 16px;
-          input {
-            outline: none;
-            border: none;
-            // border-bottom: 1px solid black;
-            width: 90%;
-            height: 100%;
-          }
           .input{
             width: 100%;
             min-height:24px;
@@ -228,4 +229,20 @@ export default {
     }
   }
 }
+</style>
+<style lang="scss">
+.NPC-Big-Book-preview{
+    .el-textarea__inner{
+        resize: none;
+        border: none;
+        outline: none;
+        width: 100%;
+        min-height:24px;
+        margin: 0 auto;
+        font-size: 16px;
+        line-height: 1.5;
+        color: #000000;
+        overflow:hidden; 
+    }
+}
 </style>

+ 1 - 1
src/views/courseView.vue

@@ -108,7 +108,7 @@ export default {
         },
       ],
       bookAnswerContent: "",
-      TaskModel: "TEST", //TEST 考试模式; PRACTICE 练习模式;空 预览模式
+      TaskModel: "ANSWER", //TEST 考试模式; PRACTICE 练习模式; ANSWER 查看答案模式; 空 预览模式 
       category: "",
       FatherTreeData: null,
       themeColor: "",