Преглед изворни кода

课文增加预览隐藏开关

natasha пре 9 месеци
родитељ
комит
f834bef273

+ 16 - 2
src/components/Adult/Preview.vue

@@ -206,6 +206,16 @@
             ? 'NNPE-Book-content-item'
             : ''
         ]"
+        :style="{
+          marginTop:
+            item.table_list[0][0] &&
+            (item.table_list[0][0].type === 'dialogue_article_chs' ||
+              item.table_list[0][0].type === 'article_chs') &&
+            item.table_list[0][0].data.articleHidden === false &&
+            item.table_list.length === 1
+              ? '-96px'
+              : '0'
+        }"
       >
         <div v-for="(itemJ, indexJ) in judgeAnswersList" :key="indexJ">
           <el-checkbox
@@ -480,7 +490,9 @@
                     <template
                       v-if="
                         itemss.type == 'article_chs' &&
-                          itemJ != 'standardAnswer'
+                          itemJ != 'standardAnswer' &&
+                          itemss.data &&
+                          itemss.data.articleHidden !== false
                       "
                     >
                       <ArticleTemChs
@@ -507,7 +519,9 @@
                     <template
                       v-if="
                         itemss.type == 'dialogue_article_chs' &&
-                          itemJ != 'standardAnswer'
+                          itemJ != 'standardAnswer' &&
+                          itemss.data &&
+                          itemss.data.articleHidden !== false
                       "
                     >
                       <DialogueArticleViewChs

+ 66 - 51
src/components/Adult/inputModules/ArticleTemChs/index.vue

@@ -64,6 +64,17 @@
         </el-checkbox-group>
       </div>
     </div>
+    <div class="adult-book-input-item">
+      <span class="adult-book-lable">预览课文:</span>
+      <div class="adult-book-main">
+        <el-radio v-model="curQue.articleHidden" :label="true">
+          显示
+        </el-radio>
+        <el-radio v-model="curQue.articleHidden" :label="false">
+          隐藏
+        </el-radio>
+      </div>
+    </div>
     <div class="NPC-Book-article">
       <ArticleChs
         :curQue="curQue"
@@ -74,8 +85,8 @@
     <template
       v-if="
         curQue.mp3_list &&
-        curQue.mp3_list.length > 0 &&
-        curQue.mp3_list[0].source
+          curQue.mp3_list.length > 0 &&
+          curQue.mp3_list[0].source
       "
     >
       <div class="create_mp3_list">
@@ -190,7 +201,7 @@ import {
   getWordTime,
   compareSenTenceTime,
   textCreadMp3,
-  getContentFile,
+  getContentFile
 } from "@/api/ajax";
 const Base64 = require("js-base64").Base64;
 import Upload from "../../common/Upload.vue";
@@ -212,7 +223,7 @@ export default {
     Clauseresult,
     Segbyword,
     Createtimelist,
-    CompareTime,
+    CompareTime
   },
   props: ["curQue", "changeCurQue", "tmIndex"],
   data() {
@@ -221,7 +232,7 @@ export default {
       mp3Number: 1,
       fileCon: {
         img_list: [],
-        mp3_list: [],
+        mp3_list: []
       },
       isPara: false,
       isClause: false,
@@ -235,7 +246,7 @@ export default {
         name: "课文",
         model: 1,
         pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
-        enPosition: "bottom", 
+        enPosition: "bottom",
         mp3_list: [],
         img_list: [],
         article: "",
@@ -243,13 +254,14 @@ export default {
         wordTime: [],
         taskId: "",
         checkList: [1, 2, 3],
+        articleHidden: true
       },
       isWordTime: false,
       compareType: "", //校对类型
       compareShow: false,
       compareData: null,
       compareloading: false,
-      CreadMp3loading: false,
+      CreadMp3loading: false
     };
   },
   computed: {},
@@ -260,7 +272,7 @@ export default {
     getfillLiu() {
       this.loading = true;
       let _this = this;
-      return new Promise(function (resolve, reject) {
+      return new Promise(function(resolve, reject) {
         if (
           _this.curQue.mp3_list &&
           _this.curQue.mp3_list.length > 0 &&
@@ -271,15 +283,15 @@ export default {
             .replace("[FID##", "")
             .replace("##FID]", "");
           let data = {
-            file_id: id,
+            file_id: id
           };
-          getContentFile(Mname, data).then((res) => {
+          getContentFile(Mname, data).then(res => {
             let taskIddata = {
               fileName: _this.curQue.mp3_list[0].name,
               speechBase64: res.base64_text,
-              language: "ch",
+              language: "ch"
             };
-            prepareTranscribe(taskIddata).then((ress) => {
+            prepareTranscribe(taskIddata).then(ress => {
               _this.$set(_this.curQue, "taskId", ress.data.taskId);
               _this.loading = false;
               resolve();
@@ -304,8 +316,8 @@ export default {
       }
       _this.CreadMp3loading = true;
       textCreadMp3({
-        text: _this.curQue.article,
-      }).then((res) => {
+        text: _this.curQue.article
+      }).then(res => {
         res.data.fileInfo.id = "[FID##" + res.data.fileInfo.file_id + "##FID]";
         res.data.fileInfo.name = res.data.fileInfo.file_name;
         let fileList = [res.data.fileInfo];
@@ -319,7 +331,7 @@ export default {
       this.$confirm("确定要删除吗?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       }).then(() => {
         this.curQue.mp3_list.splice(0, 1);
       });
@@ -332,7 +344,7 @@ export default {
       }
       this.compareloading = true;
       compareSenTenceTime({ matchList: JSON.stringify(this.compareData) })
-        .then((res) => {
+        .then(res => {
           console.log(res);
           this.compareloading = false;
           this.curQue.wordTime = res.data.result;
@@ -361,14 +373,14 @@ export default {
     changeMp3(fileList) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
-      articleImgList.forEach((item) => {
+      articleImgList.forEach(item => {
         if (item.response) {
           const obj = {
             name: item.name,
             duration: item.response.file_info_list[0].media_duration,
             url: item.response.file_info_list[0].file_url,
             id: "[FID##" + item.response.file_info_list[0].file_id + "##FID]",
-            media_duration: item.response.file_info_list[0].media_duration, //音频时长
+            media_duration: item.response.file_info_list[0].media_duration //音频时长
           };
           articleImgRes.push(obj);
         }
@@ -383,7 +395,7 @@ export default {
           name: file.name,
           url: file.response.file_info_list[0].file_url,
           id: "[FID##" + file.response.file_info_list[0].file_id + "##FID]",
-          imgNumber: 0,
+          imgNumber: 0
         };
         this.curQue.img_list.push(obj);
         this.$forceUpdate();
@@ -412,15 +424,15 @@ export default {
       }
       if (!flag) {
         let textList = [];
-        detail.forEach((item) => {
+        detail.forEach(item => {
           let str = Base64.encode(item.para);
           textList.push(str);
         });
         this.loading = true;
         let data = {
-          textList: textList,
+          textList: textList
         };
-        segSentences(data).then((res) => {
+        segSentences(data).then(res => {
           this.loading = false;
           let result = res.data.result;
           result.forEach((item, index) => {
@@ -443,14 +455,14 @@ export default {
       console.log(sentences);
       this.loading = true;
       let textList = [];
-      sentences.forEach((item) => {
+      sentences.forEach(item => {
         let str = Base64.encode(item);
         textList.push(str);
       });
       let data = {
-        textList: textList,
+        textList: textList
       };
-      BatchSegContent(data).then((res) => {
+      BatchSegContent(data).then(res => {
         this.loading = false;
         let list = res.data.result.list;
         this.$set(this.curQue.detail[paraIndex], "segList", list);
@@ -465,10 +477,10 @@ export default {
       let wordsList = [];
       list.forEach((item, index) => {
         let sentArr = [];
-        item.map((sItem) => {
+        item.map(sItem => {
           let obj = {
             chs: sItem,
-            pinyin: "",
+            pinyin: ""
           };
           sentArr.push(obj);
         });
@@ -479,30 +491,30 @@ export default {
     // 上传音频文件
     handleChange(file, fileList) {
       let _this = this;
-      _this.getBase64(file.raw).then((res) => {
+      _this.getBase64(file.raw).then(res => {
         let base_res = res.split("base64,");
         let data = {
           fileName: file.raw.name,
           speechBase64: base_res[1],
-          language: "ch",
+          language: "ch"
         };
-        prepareTranscribe(data).then((ress) => {
+        prepareTranscribe(data).then(ress => {
           _this.$set(_this.curQue, "taskId", ress.data.taskId);
         });
       });
     },
     getBase64(file) {
-      return new Promise(function (resolve, reject) {
+      return new Promise(function(resolve, reject) {
         let reader = new FileReader();
         let imgResult = "";
         reader.readAsDataURL(file);
-        reader.onload = function () {
+        reader.onload = function() {
           imgResult = reader.result;
         };
-        reader.onerror = function (error) {
+        reader.onerror = function(error) {
           reject(error);
         };
-        reader.onloadend = function () {
+        reader.onloadend = function() {
           resolve(imgResult);
         };
       });
@@ -511,7 +523,7 @@ export default {
       this.getfillLiu().then(() => {
         if (this.curQue.taskId) {
           let verseList = [];
-          this.curQue.detail.forEach((item) => {
+          this.curQue.detail.forEach(item => {
             verseList = verseList.concat(item.sentences);
           });
           if (verseList.length > 0) {
@@ -520,9 +532,9 @@ export default {
               taskId: this.curQue.taskId,
               verseList: JSON.stringify(verseList),
               matchType: "chinese",
-              language: "ch",
+              language: "ch"
             };
-            getWordTime(data).then((res) => {
+            getWordTime(data).then(res => {
               this.curQue.wordTime = res.data.result;
               this.isWordTime = false;
             });
@@ -544,7 +556,7 @@ export default {
     saveTimeList() {
       this.cTVisible = false;
       let detail = JSON.parse(JSON.stringify(this.$refs.createtimelist.detail));
-      let detailRes = detail.map((item) => {
+      let detailRes = detail.map(item => {
         let timeList = item.time_str.split("\n");
         item.timeList = this.handleTimeReg(timeList);
         return item;
@@ -554,7 +566,7 @@ export default {
     },
 
     handleTimeReg(list) {
-      list = list.map((item) => {
+      list = list.map(item => {
         let regArr = item.split("]");
         let reg = regArr[0];
         item = reg.replace("[", "");
@@ -569,7 +581,7 @@ export default {
     initCurQueData() {
       let res_data = JSON.parse(JSON.stringify(this.data_structure));
       this.changeCurQue(res_data);
-    },
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
@@ -581,6 +593,9 @@ export default {
       if (!this.curQue.hasOwnProperty("checkList")) {
         this.$set(this.curQue, "checkList", [1, 2, 3]);
       }
+      if (!this.curQue.hasOwnProperty("articleHidden")) {
+        this.$set(this.curQue, "articleHidden", true);
+      }
       if (!this.curQue.taskId) {
         this.curQue.taskId = "";
       }
@@ -601,18 +616,18 @@ export default {
       }
       this.fileCon.img_list = JSON.parse(JSON.stringify(this.curQue.img_list));
       let mp3_list = JSON.parse(JSON.stringify(this.curQue.mp3_list));
-      this.fileCon.mp3_list = mp3_list.filter((item) => item.source !== "tts");
+      this.fileCon.mp3_list = mp3_list.filter(item => item.source !== "tts");
       if (!this.curQue.sentencesEn) {
         this.curQue.sentencesEn = [];
-        this.curQue.detail.forEach(item=>{
-            item.sentencesEn = []
-            item.sentences.forEach(items=>{
-                item.sentencesEn.push("")
-            })
-        })
+        this.curQue.detail.forEach(item => {
+          item.sentencesEn = [];
+          item.sentences.forEach(items => {
+            item.sentencesEn.push("");
+          });
+        });
       }
       if (!this.curQue.hasOwnProperty("enPosition")) {
-        this.$set(this.curQue, "enPosition", 'bottom');
+        this.$set(this.curQue, "enPosition", "bottom");
       }
     } else {
       this.initCurQueData();
@@ -624,10 +639,10 @@ export default {
   updated() {}, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
   destroyed() {}, //生命周期 - 销毁完成
-  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
-<style lang='scss' scoped>
+<style lang="scss" scoped>
 //@import url(); 引入公共css类
 .create_mp3_list {
   display: flex;
@@ -704,4 +719,4 @@ p {
     margin-right: 16px;
   }
 }
-</style>
+</style>

+ 16 - 1
src/components/Adult/inputModules/DialogueArticleChs/index.vue

@@ -76,6 +76,17 @@
       </div>
     </div>
     <div class="adult-book-input-item">
+      <span class="adult-book-lable">预览课文:</span>
+      <div class="adult-book-main">
+        <el-radio v-model="curQue.articleHidden" :label="true">
+          显示
+        </el-radio>
+        <el-radio v-model="curQue.articleHidden" :label="false">
+          隐藏
+        </el-radio>
+      </div>
+    </div>
+    <div class="adult-book-input-item">
       <span class="adult-book-lable">文章提示:</span>
       <el-input
         class="adult-book-input"
@@ -357,7 +368,8 @@ export default {
         detail: [],
         wordTime: [],
         taskId: "",
-        checkList: [1, 2, 3]
+        checkList: [1, 2, 3],
+        articleHidden: true
       },
       isWordTime: false,
       compareType: "", //校对类型
@@ -778,6 +790,9 @@ export default {
       if (!this.curQue.checkList) {
         this.$set(this.curQue, "checkList", [1, 2, 3]);
       }
+      if (!this.curQue.hasOwnProperty("articleHidden")) {
+        this.$set(this.curQue, "articleHidden", true);
+      }
       if (this.curQue.detail && this.curQue.detail.length > 0) {
         if (this.curQue.detail[0].para) {
           this.isPara = true;