瀏覽代碼

选择填空增加课文上方的问题英文字段

秦鹏 3 年之前
父節點
當前提交
9131531be2

+ 4 - 0
src/components/Adult/common/data3.js

@@ -778,6 +778,10 @@ let fnData = [{
         type: "select_input_chs",
         name: "选择填空控件",
     },
+    {
+        type: "play_input_record_chs",
+        name: "播放+输入+录音",
+    },
 ]
 
 

+ 481 - 0
src/components/Adult/inputModules/PlayInputReacord.vue

@@ -0,0 +1,481 @@
+<!--  -->
+<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="{ minRows: 2 }"
+          placeholder="请输入标题"
+          v-model="curQue.title"
+          @blur="onBlur(curQue, 'title')"
+        ></el-input>
+      </div>
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable">排列方式:</span>
+        <el-radio-group v-model="curQue.arrangeWay" @change="changearrangeWay">
+          <el-radio label="单列">单列</el-radio>
+          <el-radio label="双列">双列</el-radio>
+          <el-radio label="四列">四列</el-radio>
+        </el-radio-group>
+      </div>
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable">配置:</span>
+        <div class="xorl">
+          <el-switch v-model="curQue.Isnumber" active-text="序号"> </el-switch>
+          <el-switch v-model="curQue.IsRecord" active-text="录音"> </el-switch>
+        </div>
+      </div>
+      <div class="main">
+        <div
+          class="row"
+          v-for="(row, rowIndex) in curQue.option"
+          :key="'row' + rowIndex"
+        >
+          <div
+            :style="{
+              width: `${
+                curQue.arrangeWay == '单列'
+                  ? '732px'
+                  : curQue.arrangeWay == '双列'
+                  ? '362px'
+                  : '177px'
+              }`,
+            }"
+            class="col"
+            v-for="(col, colIndex) in row"
+            :key="'col' + colIndex"
+          >
+            <div class="td">
+              <span v-if="curQue.Isnumber">{{ col.number }}</span>
+              <div class="content">
+                <div
+                  style="display: flex"
+                  v-for="(item, i) in col.list"
+                  :key="'cont' + i"
+                >
+                  <div
+                    v-for="(text, txIndex) in item.conList"
+                    :key="'text' + txIndex"
+                    style="display: flex"
+                  >
+                    <div v-if="text != '_'">
+                      {{ text }}
+                    </div>
+                    <span v-else>
+                      {{ text }}
+                    </span>
+                  </div>
+                  <img
+                    v-if="curQue.IsRecord"
+                    src="../../../assets/adult/mini.png"
+                    alt=""
+                  />
+                </div>
+              </div>
+            </div>
+            <p>
+              <span @click="edit(col, rowIndex, colIndex)"> 编辑 </span>
+            </p>
+          </div>
+        </div>
+      </div>
+    </div>
+    <el-dialog
+      title="提示"
+      :visible.sync="dialogVisible"
+      width="80%"
+      :before-close="handleClose"
+    >
+      <div class="Module" v-if="dialogData">
+        <div class="adult-book-input-item">
+          <el-radio-group v-model="dialogData.type">
+            <el-radio label="英文">英文</el-radio>
+            <el-radio label="拼音+中文">拼音+中文</el-radio>
+          </el-radio-group>
+        </div>
+        <div class="Modulemain">
+          <div>
+            <div class="adult-book-input-item">
+              <span class="adult-book-lable">内容:</span>
+              <el-input
+                class="adult-book-input"
+                type="textarea"
+                :autosize="{ minRows: 2 }"
+                placeholder="请输入内容"
+                v-model="dialogData.leftCon"
+                @blur="onBlur(dialogData, 'leftCon')"
+                @change="changecon(dialogData)"
+              ></el-input>
+            </div>
+            <div
+              class="adult-book-input-item"
+              v-if="dialogData.type == '拼音+中文'"
+            >
+              <span class="adult-book-lable">拼音:</span>
+              <el-input
+                class="adult-book-input"
+                type="textarea"
+                :autosize="{ minRows: 2 }"
+                placeholder="请输入拼音"
+                v-model="dialogData.leftPinyin"
+                @blur="onBlur(dialogData, 'leftPinyin')"
+              ></el-input>
+            </div>
+          </div>
+          <div>
+            <div class="adult-book-input-item" v-if="curQue.Isnumber">
+              <span class="adult-book-lable">序号:</span>
+              <el-input
+                class="adult-book-input"
+                type="textarea"
+                :autosize="{ minRows: 2 }"
+                placeholder="请输入标题"
+                v-model="dialogData.number"
+                @blur="onBlur(dialogData, 'number')"
+              ></el-input>
+            </div>
+            <div v-for="(item, index) in dialogData.list" :key="'h' + index">
+              <div class="adult-book-input-item">
+                <span class="adult-book-lable">内容:</span>
+                <el-input
+                  class="adult-book-input"
+                  type="textarea"
+                  :autosize="{ minRows: 2 }"
+                  placeholder="请输入内容"
+                  v-model="item.con"
+                  @blur="onBlur(item, 'con')"
+                  @change="changecon(item)"
+                ></el-input>
+                <img
+                  @click="deleterow(index)"
+                  class="close"
+                  src="../../../assets/adult/del-close.png"
+                  alt=""
+                />
+              </div>
+              <div
+                class="adult-book-input-item"
+                v-if="dialogData.type == '拼音+中文'"
+              >
+                <span class="adult-book-lable">拼音:</span>
+                <el-input
+                  class="adult-book-input"
+                  type="textarea"
+                  :autosize="{ minRows: 2 }"
+                  placeholder="请输入拼音"
+                  v-model="item.pinyin"
+                  @blur="onBlur(item, 'pinyin')"
+                ></el-input>
+              </div>
+              <div
+                class="adult-book-input-item"
+                v-if="dialogData.type == '拼音+中文'"
+              >
+                <span class="adult-book-lable">拼音位置:</span>
+                <el-radio-group v-model="item.pinyinSite">
+                  <el-radio label="top">上</el-radio>
+                  <el-radio label="bottom">下</el-radio>
+                  <el-radio label="left">左</el-radio>
+                  <el-radio label="right">右</el-radio>
+                </el-radio-group>
+              </div>
+              <div
+                class="adult-book-input-item"
+                v-for="(answ, anIndex) in item.answer"
+                :key="'anw' + anIndex"
+              >
+                <span class="adult-book-lable">答案:</span>
+                <el-input
+                  class="adult-book-input"
+                  type="textarea"
+                  :autosize="{ minRows: 2 }"
+                  placeholder="请输入答案"
+                  v-model="answ.con"
+                  @blur="onBlur(answ, 'con')"
+                ></el-input>
+                <img
+                  @click="deleteAnswer(index, anIndex)"
+                  class="close"
+                  src="../../../assets/adult/del-close.png"
+                  alt=""
+                />
+              </div>
+              <div class="addoption" @click="addAnswer(index)">增加答案</div>
+            </div>
+            <div class="addoption" @click="addrowCol">增加</div>
+          </div>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" @click="save">确 定</el-button>
+      </span>
+    </el-dialog>
+  </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: "play_input_record_chs",
+        name: "",
+        title: "",
+        arrangeWay: "单列", //排列方式
+        Isnumber: false, //需不需要 序号
+        IsRecord: false, //需不需要录音
+        option: [
+          [
+            {
+              type: "英文", //英文还是拼音+中文
+              number: "",
+              list: [
+                {
+                  leftCon: "",
+                  leftPinyin: "",
+                  con: "",
+                  pinyin: "",
+                  pinyinSite: "", //拼音的位置
+                  answer: [
+                    {
+                      con: "",
+                    },
+                  ],
+                },
+              ],
+            },
+          ],
+        ],
+        numberList: {
+          type: "number",
+          name: "每行几个",
+          con: "2",
+          arr: [
+            {
+              id: 1,
+              value: 1,
+            },
+            {
+              id: 2,
+              value: 2,
+            },
+            {
+              id: 3,
+              value: 3,
+            },
+            {
+              id: 4,
+              value: 4,
+            },
+          ],
+        },
+      },
+    };
+  },
+  computed: {},
+  watch: {},
+  //方法集合
+  methods: {
+    onBlur(item, field) {
+      item[field] = item[field] ? item[field].trim() : "";
+    },
+
+    // 增加答案
+    addanswer(index) {
+      let obj;
+      if (this.type == "zi_transverse_line_chs") {
+        obj = JSON.parse(
+          JSON.stringify(this.data_structure.option[0].answer[0])
+        );
+        this.curQue.option[index].answer.push(obj);
+      }
+    },
+    // 删除答案
+    deleteanswer(aindex, index) {
+      if (this.curQue.option[index].answer.length <= 1) {
+        this.$message.warning("至少要保留1个答案");
+        return;
+      }
+      this.curQue.option[index].answer.splice(aindex, 1);
+    },
+    // 删除其中一个选项
+    deleteOptionOne(index) {
+      if (this.curQue.option.length <= 1) {
+        this.$message.warning("至少要保留1个选项");
+        return;
+      }
+      this.curQue.option.splice(index, 1);
+    },
+    // 新增选项
+    addOption() {
+      let obj = JSON.parse(JSON.stringify(this.data_structure.option[0]));
+      this.curQue.option.push(obj);
+    },
+    initcurQue() {
+      let data = JSON.parse(JSON.stringify(this.data_structure));
+      this.changeCurQue(data);
+    },
+    // 选项的音频
+    changeMp3(fileList, item, index) {
+      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.option[index].mp3_list = JSON.parse(
+        JSON.stringify(articleImgRes)
+      );
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前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;
+        }
+      }
+    }
+  }
+  .addoption {
+    width: 200px;
+    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;
+    margin-bottom: 15px;
+  }
+  .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;
+  }
+  .xorl {
+    display: flex;
+    align-items: center;
+    margin-top: 5px;
+    > :nth-child(1) {
+      margin-right: 33px;
+    }
+  }
+}
+</style>
+<style lang="scss">
+</style>

+ 19 - 3
src/components/Adult/inputModules/PurePreview.vue

@@ -46,6 +46,23 @@
             <div class="NPC-sentence-Segword">
               <SentenceSegwordChs :curQue="item.detail" />
             </div>
+            <div class="adult-book-input-item">
+              <span class="adult-book-lable">英文:</span>
+              <el-input
+                class="adult-book-input"
+                type="textarea"
+                :autosize="{ minRows: 2 }"
+                placeholder="请输入英文"
+                v-model="item.en"
+                @blur="onBlur(item, 'en')"
+              ></el-input>
+              <img
+                @click="deleteOptionOne(index)"
+                class="close"
+                src="../../../assets/adult/del-close.png"
+                alt=""
+              />
+            </div>
           </template>
           <template v-if="type == 'newWord_preview_chs'">
             <div class="adult-book-input-item">
@@ -209,6 +226,7 @@ export default {
             mp3_list: [],
             number: "",
             detail: {
+              en: "",
               pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
               sentence: "", //句子
               segList: [], //分词结果
@@ -345,9 +363,7 @@ export default {
           articleImgRes.push(obj);
         }
       });
-      this.curQue[index].mp3_list = JSON.parse(
-        JSON.stringify(articleImgRes)
-      );
+      this.curQue[index].mp3_list = JSON.parse(JSON.stringify(articleImgRes));
     },
     // 题目的音频
     timuchangeMp3(fileList) {

+ 14 - 0
src/views/adultInput3.vue

@@ -332,6 +332,17 @@
                       </template>
                       <template v-else> </template>
                     </template>
+                    <template v-if="topicIitem.type == 'play_input_record_chs'">
+                      <template v-if="topicIitem.is_edit">
+                        <PlayInputReacord
+                          :curQue="topicIitem.data"
+                          :type="topicIitem.type"
+                          :fn_data="fn_data"
+                          :changeCurQue="changeCurQue"
+                        />
+                      </template>
+                      <template v-else> </template>
+                    </template>
                   </div>
                   <div
                     class="addoption"
@@ -457,6 +468,8 @@ import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
 import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
 import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
 import SelectInpue from "@/components/Adult/inputModules/SelectInpue.vue";
+import PlayInputReacord from "@/components/Adult/inputModules/PlayInputReacord.vue";
+
 
 import Textdes from "@/components/Adult/inputModules/Textdes.vue";
 import Record from "@/components/Adult/inputModules/Record.vue";
@@ -527,6 +540,7 @@ export default {
     PurePreview,
     ZiLine,
     SelectInpue,
+    PlayInputReacord,
   },
   data() {
     return {