Browse Source

Merge branch 'master' into NPC-lhd

natasha 3 năm trước cách đây
mục cha
commit
d72a41d732

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

@@ -774,6 +774,10 @@ let fnData = [{
         type: "zi_transverse_line_chs",
         type: "zi_transverse_line_chs",
         name: "字+横线",
         name: "字+横线",
     },
     },
+    {
+        type: "select_input_chs",
+        name: "选择填空控件",
+    },
 ]
 ]
 
 
 
 

+ 263 - 0
src/components/Adult/inputModules/SelectInpue.vue

@@ -0,0 +1,263 @@
+<!--  -->
+<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-input
+          class="adult-book-input"
+          type="textarea"
+          :autosize="{ minRows: 2 }"
+          placeholder="请输入内容"
+          v-model="curQue.con"
+          @blur="onBlur(curQue, 'con')"
+        ></el-input>
+      </div>
+      <div v-for="(item, Oindex) in curQue.option" :key="'op' + Oindex">
+        <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')"
+          ></el-input>
+          <img
+            @click="deleteOptionOne(Oindex)"
+            class="close"
+            src="../../../assets/adult/del-close.png"
+            alt=""
+          />
+        </div>
+      </div>
+      <div class="addoption" @click="addOption">添加一个选项</div>
+      <div v-for="(item, awindex) in curQue.answer" :key="'aw' + awindex">
+        <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')"
+          ></el-input>
+          <img
+            @click="deleteAnswer(awindex)"
+            class="close"
+            src="../../../assets/adult/del-close.png"
+            alt=""
+          />
+        </div>
+      </div>
+      <div class="addoption" @click="addAnswer">添加一个答案</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: "选择填空控件",
+        name: "select_input_chs",
+        title: "",
+        con: "",
+        option: [
+          {
+            con: "",
+          },
+        ],
+        answer: [
+          {
+            con: "",
+          },
+        ],
+      },
+    };
+  },
+  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 = JSON.parse(JSON.stringify(this.data_structure.option[0]));
+      this.curQue.option.push(obj);
+    },
+    // 添加答案
+    addAnswer() {
+      let obj = JSON.parse(JSON.stringify(this.data_structure.answer[0]));
+      this.curQue.answer.push(obj);
+    },
+    // 删除其中一个答案
+    deleteAnswer(index) {
+      if (this.curQue.answer.length <= 1) {
+        this.$message.warning("至少要保留1个答案");
+        return;
+      }
+      this.curQue.answer.splice(index, 1);
+    },
+    initcurQue() {
+      let 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;
+        }
+      }
+    }
+  }
+  .addoption {
+    width: 200px;
+    height: 40px;
+    left: 40px;
+    top: 304px;
+    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-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>

+ 147 - 81
src/components/Adult/inputModules/ZiLine.vue

@@ -52,18 +52,32 @@
             :key="'col' + colIndex"
             :key="'col' + colIndex"
           >
           >
             <div class="td">
             <div class="td">
-              <span v-if="curQue.Isnumber">1</span>
-              <div>
-                <!-- <p
+              <span v-if="curQue.Isnumber">{{ col.number }}</span>
+              <div class="content">
+                <div
+                  style="display: flex"
                   v-for="(item, i) in col.list"
                   v-for="(item, i) in col.list"
-                  :key="'input' + i"
-                ></p> -->
+                  :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>
-              <img
-                v-if="curQue.IsRecord"
-                src="../../../assets/adult/mini.png"
-                alt=""
-              />
             </div>
             </div>
             <p>
             <p>
               <span @click="edit(col, rowIndex, colIndex)"> 编辑 </span>
               <span @click="edit(col, rowIndex, colIndex)"> 编辑 </span>
@@ -75,7 +89,7 @@
     <el-dialog
     <el-dialog
       title="提示"
       title="提示"
       :visible.sync="dialogVisible"
       :visible.sync="dialogVisible"
-      width="50%"
+      width="80%"
       :before-close="handleClose"
       :before-close="handleClose"
     >
     >
       <div class="Module" v-if="dialogData">
       <div class="Module" v-if="dialogData">
@@ -85,75 +99,118 @@
             <el-radio label="拼音+中文">拼音+中文</el-radio>
             <el-radio label="拼音+中文">拼音+中文</el-radio>
           </el-radio-group>
           </el-radio-group>
         </div>
         </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.con)"
-            ></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="dialogData.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 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-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="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 class="addoption" @click="addAnswer(index)">增加答案</div>
         </div>
         </div>
-        <div class="addoption" @click="addrowCol">增加</div>
       </div>
       </div>
       <span slot="footer" class="dialog-footer">
       <span slot="footer" class="dialog-footer">
         <el-button @click="handleClose">取 消</el-button>
         <el-button @click="handleClose">取 消</el-button>
@@ -199,8 +256,11 @@ export default {
           [
           [
             {
             {
               type: "英文", //英文还是拼音+中文
               type: "英文", //英文还是拼音+中文
+              number: "",
               list: [
               list: [
                 {
                 {
+                  leftCon: "",
+                  leftPinyin: "",
                   con: "",
                   con: "",
                   pinyin: "",
                   pinyin: "",
                   pinyinSite: "", //拼音的位置
                   pinyinSite: "", //拼音的位置
@@ -249,8 +309,7 @@ export default {
   //方法集合
   //方法集合
   methods: {
   methods: {
     changecon(value) {
     changecon(value) {
-      console.log(value);
-      console.log(value.split(""));
+      value.conList = value.con.split("");
     },
     },
     //   增加答案
     //   增加答案
     addAnswer(index) {
     addAnswer(index) {
@@ -553,7 +612,6 @@ export default {
         margin: 0 4px;
         margin: 0 4px;
         .td {
         .td {
           width: 100%;
           width: 100%;
-          display: flex;
           background: #ffffff;
           background: #ffffff;
           border: 1px solid rgba(0, 0, 0, 0.1);
           border: 1px solid rgba(0, 0, 0, 0.1);
           box-sizing: border-box;
           box-sizing: border-box;
@@ -561,10 +619,13 @@ export default {
           min-height: 48px;
           min-height: 48px;
           display: flex;
           display: flex;
           align-items: center;
           align-items: center;
-          padding: 0 12px;
+          padding: 8px 12px;
           > div {
           > div {
             margin: 0 8px;
             margin: 0 8px;
             flex: 1;
             flex: 1;
+            > :nth-child(1) {
+              margin-bottom: 8px;
+            }
           }
           }
           > span {
           > span {
             display: inline-block;
             display: inline-block;
@@ -588,6 +649,11 @@ export default {
       }
       }
     }
     }
   }
   }
+  .Module {
+    .Modulemain {
+      display: flex;
+    }
+  }
 }
 }
 </style>
 </style>
 <style lang="scss">
 <style lang="scss">

+ 13 - 0
src/views/adultInput3.vue

@@ -321,6 +321,17 @@
                       </template>
                       </template>
                       <template v-else> </template>
                       <template v-else> </template>
                     </template>
                     </template>
+                    <template v-if="topicIitem.type == 'select_input_chs'">
+                      <template v-if="topicIitem.is_edit">
+                        <SelectInpue
+                          :curQue="topicIitem.data"
+                          :type="topicIitem.type"
+                          :fn_data="fn_data"
+                          :changeCurQue="changeCurQue"
+                        />
+                      </template>
+                      <template v-else> </template>
+                    </template>
                   </div>
                   </div>
                   <div
                   <div
                     class="addoption"
                     class="addoption"
@@ -445,6 +456,7 @@ import NumberCombination from "@/components/Adult/inputModules/NumberCombination
 import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
 import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
 import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
 import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
 import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
 import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
+import SelectInpue from "@/components/Adult/inputModules/SelectInpue.vue";
 
 
 import Textdes from "@/components/Adult/inputModules/Textdes.vue";
 import Textdes from "@/components/Adult/inputModules/Textdes.vue";
 import Record from "@/components/Adult/inputModules/Record.vue";
 import Record from "@/components/Adult/inputModules/Record.vue";
@@ -514,6 +526,7 @@ export default {
     ImageQuestion,
     ImageQuestion,
     PurePreview,
     PurePreview,
     ZiLine,
     ZiLine,
+    SelectInpue,
   },
   },
   data() {
   data() {
     return {
     return {