Browse Source

Merge branch 'master' into NPC-lhd

natasha 3 years ago
parent
commit
b7df1697bb

+ 2 - 2
src/components/Adult/common/SentenceModule.vue

@@ -84,7 +84,7 @@
     <div v-for="(item, i) in fn_list" :key="i + 'record'">
       <div
         class="adult-book-input-item"
-        v-if="item.type == 'sentence_record_chs' && item.isFn"
+        v-if="item.type == 'sentence_record_chs' && item.isFn&&type!='sentence_listen_read_chs'"
       >
         <span class="adult-book-lable">录音:</span>
         <el-radio-group v-model="curQueItem.IsRecord">
@@ -97,7 +97,7 @@
       class="adult-book-input-item"
       v-if="
         (type == 'sentence_input_record_chs' && curQueItem.IsRecord) ||
-        type == 'sentence_record_chs'
+        type == 'sentence_record_chs'||type=='sentence_listen_read_chs'
       "
     >
       <span class="adult-book-lable">录音组件:</span>

+ 7 - 3
src/components/Adult/common/SingleModule.vue

@@ -13,7 +13,9 @@
             v-model="curQueItem.con"
             @blur="curQueItem.con = curQueItem.con.trim()"
           ></el-input>
-          <template v-if="type == 'single_chs'">
+          <template
+            v-if="type == 'single_chs' || type == 'listen_record_single_chs'"
+          >
             <el-radio
               style="margin-left: 7px"
               @change="changeIsAnswer"
@@ -39,7 +41,10 @@
             alt=""
           />
         </div>
-        <div class="adult-book-input-item">
+        <div
+          class="adult-book-input-item"
+          v-if="type == 'single_chs' || type == 'checkbox_chs'"
+        >
           <span class="adult-book-lable">选项图片:</span>
           <Upload
             :changeFillId="changeImage"
@@ -152,7 +157,6 @@ export default {
       //this.articleImgList = articleImgRes;
       this.curQueItem.img_list = JSON.parse(JSON.stringify(articleImgRes));
     },
-
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 13 - 2
src/components/Adult/common/data3.js

@@ -35,7 +35,11 @@ let fnData = [{
             {
                 type: "sentence_input_record_chs",
                 name: "句子填空+录音",
-            }
+            },
+            {
+                type: "sentence_listen_read_chs",
+                name: "句子听+朗读",
+            },
         ],
 
     }, {
@@ -78,7 +82,10 @@ let fnData = [{
     {
         type: "single_chs",
         name: "单选题",
-
+    },
+    {
+        type: "listen_record_single_chs",
+        name: "听录音选答案",
     },
     {
         type: "checkbox_chs",
@@ -751,6 +758,10 @@ let fnData = [{
         type: "sudoku_chs",
         name: "数独",
     },
+    {
+        type: "text_problem_chs",
+        name: "课文上方的问题",
+    },
 ]
 
 

+ 224 - 0
src/components/Adult/inputModules/PurePreview.vue

@@ -0,0 +1,224 @@
+<!--  -->
+<template>
+  <div class="Big-Book-PurePreview" v-if="curQue">
+    <div
+      class="Big-Book-Single-content"
+      style="margin-left: 20px; margin-top: 20px"
+    >
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable">标题:</span>
+        <el-input
+          class="adult-book-input"
+          type="textarea"
+          autosize
+          placeholder="请输入标题"
+          v-model="curQue.title"
+          @blur="onBlur(curQue, 'title')"
+        ></el-input>
+      </div>
+      <div
+        class="Big-Book-main"
+        v-for="(item, index) in curQue.option"
+        :key="item + index"
+        style="margin-bottom: 20px"
+      >
+        <div class="adult-book-input-item">
+          <span class="adult-book-lable">序号:</span>
+          <el-input
+            class="adult-book-input"
+            type="textarea"
+            autosize
+            placeholder="请输入序号"
+            v-model="item.number"
+            @blur="onBlur(item, 'number')"
+          ></el-input>
+          <img
+            @click="deleteOptionOne"
+            class="close"
+            src="../../../assets/adult/del-close.png"
+            alt=""
+          />
+        </div>
+        <div class="NPC-sentence-Segword">
+          <SentenceSegwordChs :curQue="item.detail" />
+        </div>
+      </div>
+      <div class="Big-Book-addrole">
+        <div class="addoption" @click="addOption">添加一个</div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import Upload from "../common/Upload";
+import SentenceSegwordChs from "../common/SentenceSegwordChs/index.vue";
+export default {
+  name: "PurePreview",
+  props: ["curQue", "fn_data", "changeCurQue", "type"],
+  components: {
+    SentenceSegwordChs,
+    Upload,
+  },
+  data() {
+    return {
+      checkList: [],
+      mp3Number: 1,
+      form: {
+        stem: {
+          con: "",
+          pinyin: "",
+          english: "",
+          highlight: "",
+          underline: "",
+          img_url: [],
+          mp3_url: [],
+        },
+      },
+      data_structure: {
+        type: "text_problem_chs",
+        name: "课文上面的问题",
+        title: "",
+        option: [
+          {
+            mp3_list: [],
+            number: "",
+            detail: {
+              pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
+              sentence: "", //句子
+              segList: [], //分词结果
+              seg_words: "",
+              wordsList: [],
+            },
+            en: "", //英文
+            answer: [""],
+            judge: true,
+          },
+        ],
+      },
+    };
+  },
+  computed: {},
+  watch: {},
+  //方法集合
+  methods: {
+    onBlur(item, field) {
+      item[field] = item[field] ? item[field].trim() : "";
+    },
+    // 删除其中一个选项
+    deleteOptionOne(index) {
+      if (this.curQue.option.length <= 1) {
+        this.$message.warning("至少要保留1个选项");
+        return;
+      }
+      this.curQue.option.splice(index, 1);
+    },
+    // 新增选项
+    addOption() {
+      let obj;
+      obj = JSON.parse(JSON.stringify(this.data_structure.option[0]));
+      this.curQue.option.push(obj);
+    },
+    initcurQue() {
+      let data;
+      data = JSON.parse(JSON.stringify(this.data_structure));
+      this.changeCurQue(data);
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    if (!this.curQue) {
+      this.initcurQue();
+    }
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  beforeCreate() {}, //生命周期 - 创建之前
+  beforeMount() {}, //生命周期 - 挂载之前
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+};
+</script>
+<style lang='scss' scope>
+//@import url(); 引入公共css类
+.Big-Book-PurePreview {
+  &-content {
+    &.m {
+      display: flex;
+      justify-content: flex-start;
+      align-items: flex-start;
+    }
+
+    .Big-Book-title {
+      font-size: 16px;
+      line-height: 40px;
+      color: #000;
+      margin-right: 15px;
+    }
+    .Big-Book-main {
+      > div {
+        margin-bottom: 10px;
+        &.Big-Book-pinyin {
+          display: flex;
+          justify-content: flex-start;
+          align-items: center;
+        }
+      }
+    }
+  }
+
+  .Big-Book-addrole {
+    > div {
+      width: 300px;
+      height: 40px;
+      background: #f3f3f3;
+      border: 1px dashed rgba(0, 0, 0, 0.15);
+      box-sizing: border-box;
+      border-radius: 4px;
+      text-align: center;
+      line-height: 40px;
+      cursor: pointer;
+    }
+  }
+  .Big-Book-more {
+    .Big-Book-more-text {
+      position: relative;
+      text-align: center;
+    }
+    .Big-Book-more-text:before,
+    .Big-Book-more-text:after {
+      position: absolute;
+      background: #ccc;
+      content: "";
+      height: 1px;
+      top: 50%;
+      width: 45%;
+    }
+    .Big-Book-more-text:before {
+      left: 10px;
+    }
+    .Big-Book-more-text:after {
+      right: 10px;
+    }
+    .Big-Book-more-main {
+      display: flex;
+      > :not(:nth-child(1)) {
+        margin-left: 30px;
+      }
+    }
+  }
+  .Big-Book-con {
+    display: flex;
+    align-items: center;
+  }
+  .close{
+      width: 24px;
+      cursor: pointer;
+  }
+}
+</style>
+<style lang="scss">
+</style>

+ 45 - 5
src/components/Adult/inputModules/Sentence.vue

@@ -17,6 +17,18 @@
         ></el-input>
       </div>
       <div
+        class="adult-book-input-item"
+        v-if="type == 'sentence_listen_read_chs'"
+      >
+        <span class="adult-book-lable">题目音频:</span>
+        <Upload
+          :changeFillId="changeMp3"
+          :datafileList="curQue.mp3_list"
+          :filleNumber="mp3Number"
+          :uploadType="'mp3'"
+        />
+      </div>
+      <div
         class="Big-Book-main"
         v-for="(item, index) in curQue.option"
         :key="item + index"
@@ -40,16 +52,18 @@
 
 <script>
 import SentenceModule from "../common/SentenceModule.vue";
-
+import Upload from "../common/Upload"
 export default {
   name: "Single",
   props: ["curQue", "fn_data", "changeCurQue", "type"],
   components: {
     SentenceModule,
+    Upload,
   },
   data() {
     return {
       checkList: [],
+      mp3Number: 1,
       form: {
         stem: {
           con: "",
@@ -84,6 +98,13 @@ export default {
             number: "",
             con: "",
             answer: "",
+            detail: {
+              pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
+              sentence: "", //句子
+              segList: [], //分词结果
+              seg_words: "",
+              wordsList: [],
+            },
           },
         ],
       },
@@ -91,6 +112,7 @@ export default {
         type: "sentence_chs",
         name: "句子模板",
         title: "",
+        mp3_list: [],
         option: [
           {
             mp3_list: [],
@@ -195,10 +217,11 @@ export default {
             item.isFn = true;
           }
         }
-        if (type == "recordHZ_inputPY_chs") {
-          if (
-            item.type == "sentence_record_chs"
-          ) {
+        if (
+          type == "recordHZ_inputPY_chs" ||
+          type == "sentence_listen_read_chs"
+        ) {
+          if (item.type == "sentence_record_chs") {
             item.isFn = true;
           }
         }
@@ -219,6 +242,23 @@ export default {
       console.log(data);
       this.changeCurQue(data);
     },
+    changeMp3(fileList) {
+      const articleImgList = JSON.parse(JSON.stringify(fileList));
+      const articleImgRes = [];
+      articleImgList.forEach((item) => {
+        if (item.response) {
+          const obj = {
+            name: item.name,
+            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, //音频时长
+          };
+          articleImgRes.push(obj);
+        }
+      });
+      this.curQue.mp3_list = JSON.parse(JSON.stringify(articleImgRes));
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {

+ 63 - 5
src/components/Adult/inputModules/Single.vue

@@ -5,7 +5,18 @@
       class="Big-Book-Single-content"
       style="margin-left: 20px; margin-top: 20px"
     >
-      <div class="adult-book-input-item">
+      <div class="adult-book-input-item" v-if="type == 'single_chs'">
+        <span class="adult-book-lable">题号:</span>
+        <el-input
+          class="adult-book-input"
+          :autosize="{ minRows: 2 }"
+          type="textarea"
+          placeholder="请输入题号"
+          v-model="curQue.topicNumber"
+          @blur="onBlur(curQue, 'topicNumber')"
+        ></el-input>
+      </div>
+      <div class="adult-book-input-item" v-else>
         <span class="adult-book-lable">标题:</span>
         <el-input
           class="adult-book-input"
@@ -16,7 +27,7 @@
           @blur="onBlur(curQue, 'title')"
         ></el-input>
       </div>
-      <div class="adult-book-input-item">
+      <div class="adult-book-input-item" v-if="type =='single_chs'||type=='checkbox_chs'">
         <span class="adult-book-lable">录音:</span>
         <el-radio-group v-model="curQue.IsRecord">
           <el-radio :label="true">需要</el-radio>
@@ -38,7 +49,7 @@
           @blur="curQue.topic.con = curQue.topic.con.trim()"
         ></el-input>
       </div>
-      <div class="adult-book-input-item">
+      <div class="adult-book-input-item" v-if="type =='single_chs'||type=='checkbox_chs'">
         <span class="adult-book-lable">题目图片:</span>
         <Upload
           :changeFillId="timuchangeImage"
@@ -119,7 +130,7 @@ export default {
       data_structure: {
         type: "single_chs",
         name: "单选题",
-        title: "",
+        topicNumber: "",
         IsRecord: false,
         topic: {
           con: "",
@@ -166,7 +177,7 @@ export default {
         },
       },
       data_structure2: {
-        type: "checkbox_chs", 
+        type: "checkbox_chs",
         name: "多选题",
         title: "",
         IsRecord: false,
@@ -214,6 +225,51 @@ export default {
           ],
         },
       },
+      data_structure3: {
+        type: "listen_record_single_chs",
+        name: "听录音选答案",
+        title: "",
+        topic: {
+          con: "",
+          mp3_list: [],
+        },
+        option: [
+          {
+            con: "",
+            mp3_list: [],
+            isAnswer: "",
+          },
+          {
+            con: "",
+            mp3_list: [],
+            isAnswer: "",
+          },
+        ],
+        correct: [],
+        numberList: {
+          type: "number",
+          name: "每行几个",
+          con: "2",
+          arr: [
+            {
+              id: 1,
+              value: 1,
+            },
+            {
+              id: 2,
+              value: 2,
+            },
+            {
+              id: 3,
+              value: 3,
+            },
+            {
+              id: 4,
+              value: 4,
+            },
+          ],
+        },
+      },
     };
   },
   computed: {},
@@ -297,6 +353,8 @@ export default {
         this.changeCurQue(this.data_structure);
       } else if (this.type == "checkbox_chs") {
         this.changeCurQue(this.data_structure2);
+      } else if(this.type == 'listen_record_single_chs'){
+        this.changeCurQue(this.data_structure3)
       }
     }
   },

+ 18 - 2
src/views/adultInput3.vue

@@ -185,7 +185,8 @@
                         topicIitem.type == 'sentence_input_chs' ||
                         topicIitem.type == 'sentence_judge_chs' ||
                         topicIitem.type == 'sentence_record_chs' ||
-                        topicIitem.type == 'sentence_input_record_chs'
+                        topicIitem.type == 'sentence_input_record_chs' ||
+                        topicIitem.type == 'sentence_listen_read_chs'
                       "
                     >
                       <template v-if="topicIitem.is_edit">
@@ -275,7 +276,8 @@
                     <template
                       v-if="
                         topicIitem.type == 'single_chs' ||
-                        topicIitem.type == 'checkbox_chs'
+                        topicIitem.type == 'checkbox_chs'||
+                        topicIitem.type == 'listen_record_single_chs'
                       "
                     >
                       <template v-if="topicIitem.is_edit">
@@ -288,6 +290,17 @@
                       </template>
                       <template v-else> </template>
                     </template>
+                    <template v-if="topicIitem.type == 'text_problem_chs'">
+                      <template v-if="topicIitem.is_edit">
+                        <PurePreview
+                          :curQue="topicIitem.data"
+                          :type="topicIitem.type"
+                          :fn_data="fn_data"
+                          :changeCurQue="changeCurQue"
+                        />
+                      </template>
+                      <template v-else> </template>
+                    </template>
                   </div>
                   <div
                     class="addoption"
@@ -410,6 +423,8 @@ import Sudoku from "@/components/Adult/inputModules/Sudoku.vue";
 import ToneSelect from "@/components/Adult/inputModules/ToneSelect.vue";
 import NumberCombination from "@/components/Adult/inputModules/NumberCombination.vue";
 import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
+import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
+
 
 import Textdes from "@/components/Adult/inputModules/Textdes.vue";
 import Record from "@/components/Adult/inputModules/Record.vue";
@@ -477,6 +492,7 @@ export default {
     NumberCombination,
     ToneSelect,
     ImageQuestion,
+    PurePreview,
   },
   data() {
     return {