Bläddra i källkod

单选的录入效果 连线的录入和预览效果

秦鹏 3 år sedan
förälder
incheckning
14eaf304c7

+ 6 - 9
src/components/Adult/common/ImageQuestionModule.vue

@@ -72,7 +72,7 @@
         <el-radio :label="false">不需要</el-radio>
       </el-radio-group>
     </div>
-    <div class="adult-book-input-item">
+    <div class="adult-book-input-item" v-if="curQueItem.IsRecord">
       <span class="adult-book-lable">录音组件:</span>
       <img src="../../../assets/adult/mini.png" alt="" />
     </div>
@@ -126,9 +126,6 @@ export default {
       let res = this.curQueItem[field][index].trim();
       this.$set(this.curQueItem[field], index, res);
     },
-    onBlurCorrect(item) {
-      item[index] = item[index].trim();
-    },
     //   删除当前选项
     deleteOption() {
       this.$confirm("确定要删除此选项吗?", "提示", {
@@ -136,14 +133,9 @@ export default {
         cancelButtonText: "取消",
         type: "warning",
       }).then(() => {
-        // this.deleteOptionOne(this.index);
         console.log(this.deleteOptionOne());
       });
     },
-    //   修改正确答案
-    changeIsAnswer(type) {
-      this.changAnswer(this.index, type);
-    },
     changeImage(fileList) {
       console.log(fileList);
       const articleImgList = JSON.parse(JSON.stringify(fileList));
@@ -171,7 +163,12 @@ export default {
       }
       this.curQueItem.answer.push("");
     },
+    // 删除答案
     delAnswer(ansIndex) {
+      if (this.curQueItem.answer.length <= 1) {
+        this.$message.warning("至少要保留一个");
+        return;
+      }
       this.curQueItem.answer.splice(ansIndex, 1);
     },
   },

+ 0 - 35
src/components/Adult/common/LigatureModule.vue

@@ -180,41 +180,6 @@ export default {
         this.deleteOptionOne(this.index, this.type);
       });
     },
-    // 点击生成拼音
-    getPinyin(item) {
-      let bool = false;
-      let value = "";
-      if (item.con == "") {
-        this.$message.info("请先输入内容,再生成拼音");
-        bool = true;
-      } else {
-        value = item.con;
-      }
-      if (bool) {
-        return;
-      }
-      let result = pinyinUtil.getPinyin(value);
-      item.pinyin = result;
-    },
-    changeMp3(fileList) {
-      console.log(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.articleImgList = articleImgRes;
-      this.curQueItem.mp3_list = JSON.parse(JSON.stringify(articleImgRes));
-    },
     changeImage(fileList) {
       console.log(fileList);
       const articleImgList = JSON.parse(JSON.stringify(fileList));

+ 0 - 58
src/components/Adult/common/RecordModule.vue

@@ -73,13 +73,6 @@ export default {
     onBlur(item, field) {
       item[field] = item[field] ? item[field].trim() : "";
     },
-    onBlurIndex(index, field) {
-      let res = this.curQueItem[field][index].trim();
-      this.$set(this.curQueItem[field], index, res);
-    },
-    onBlurCorrect(item) {
-      item[index] = item[index].trim();
-    },
     //   删除当前选项
     deleteOption() {
       this.$confirm("确定要删除此选项吗?", "提示", {
@@ -91,27 +84,6 @@ export default {
         console.log(this.deleteOptionOne());
       });
     },
-    //   修改正确答案
-    changeIsAnswer(type) {
-      debugger;
-      this.changAnswer(this.index, type);
-    },
-    // 点击生成拼音
-    getPinyin(item) {
-      let bool = false;
-      let value = "";
-      if (item.hanzi == "") {
-        this.$message.warning("请先输入内容,再生成拼音");
-        bool = true;
-      } else {
-        value = item.hanzi;
-      }
-      if (bool) {
-        return;
-      }
-      let result = pinyinUtil.getPinyin(value);
-      item.pinyin = result;
-    },
     changeMp3(fileList) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
@@ -129,36 +101,6 @@ export default {
       });
       this.curQueItem.mp3_list = JSON.parse(JSON.stringify(articleImgRes));
     },
-    changeImage(fileList) {
-      console.log(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]",
-          };
-          articleImgRes.push(obj);
-        }
-      });
-      //this.articleImgList = articleImgRes;
-      this.curQueItem.img_list = JSON.parse(JSON.stringify(articleImgRes));
-    },
-    //添加释义
-    addDef() {
-      let leg = this.curQueItem.definition_list.length;
-      let last = this.curQueItem.definition_list[leg - 1];
-      if (!last) {
-        this.$message.warning("请填写");
-        return;
-      }
-      this.curQueItem.definition_list.push("");
-    },
-    delDef(defIndex) {
-      this.curQueItem.definition_list.splice(defIndex, 1);
-    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 6 - 8
src/components/Adult/common/SentenceModule.vue

@@ -96,7 +96,8 @@
     <div
       class="adult-book-input-item"
       v-if="
-        (type == 'sentence_input_record_chs'&&curQueItem.IsRecord) || type == 'sentence_record_chs'
+        (type == 'sentence_input_record_chs' && curQueItem.IsRecord) ||
+        type == 'sentence_record_chs'
       "
     >
       <span class="adult-book-lable">录音组件:</span>
@@ -159,9 +160,6 @@ export default {
       let res = this.curQueItem[field][index].trim();
       this.$set(this.curQueItem[field], index, res);
     },
-    onBlurCorrect(item) {
-      item[index] = item[index].trim();
-    },
     //   删除当前选项
     deleteOption() {
       this.$confirm("确定要删除此选项吗?", "提示", {
@@ -173,10 +171,6 @@ export default {
         console.log(this.deleteOptionOne());
       });
     },
-    //   修改正确答案
-    changeIsAnswer(type) {
-      this.changAnswer(this.index, type);
-    },
     changeMp3(fileList) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
@@ -205,6 +199,10 @@ export default {
       this.curQueItem.answer.push("");
     },
     delAnswer(ansIndex) {
+      if (this.curQueItem.answer.length <= 1) {
+        this.$message.warning("至少要保留一个");
+        return;
+      }
       this.curQueItem.answer.splice(ansIndex, 1);
     },
   },

+ 8 - 72
src/components/Adult/common/SingleModule.vue

@@ -4,41 +4,6 @@
     <div class="Big-Book-content m">
       <div class="Big-Book-main">
         <div class="adult-book-input-item">
-          <span class="adult-book-lable">题目:</span>
-          <el-input
-            class="adult-book-input"
-            :autosize="{ minRows: 2 }"
-            type="textarea"
-            placeholder="请输入题目"
-            v-model="curQueItem.topic.con"
-            @blur="curQueItem.topic.con = curQueItem.topic.con.trim()"
-          ></el-input>
-          <img
-            @click="deleteOption"
-            class="close"
-            src="../../../assets/adult/del-close.png"
-            alt=""
-          />
-        </div>
-        <div class="adult-book-input-item">
-          <span class="adult-book-lable">题目图片:</span>
-          <Upload
-            :changeFillId="timuchangeImage"
-            :datafileList="fileCon.timu_img_list"
-            :filleNumber="imgNumber"
-            :uploadType="'image'"
-          />
-        </div>
-        <div class="adult-book-input-item">
-          <span class="adult-book-lable">题目音频:</span>
-          <Upload
-            :changeFillId="timuchangeMp3"
-            :datafileList="fileCon.timu_mp3_list"
-            :filleNumber="mp3Number"
-            :uploadType="'mp3'"
-          />
-        </div>
-        <div class="adult-book-input-item">
           <span class="adult-book-lable">选项内容:</span>
           <el-input
             class="adult-book-input"
@@ -67,6 +32,12 @@
             >
           </template>
           <!-- <div class=""></div> -->
+          <img
+            @click="deleteOption"
+            class="close"
+            src="../../../assets/adult/del-close.png"
+            alt=""
+          />
         </div>
         <div class="adult-book-input-item">
           <span class="adult-book-lable">选项图片:</span>
@@ -181,41 +152,7 @@ export default {
       //this.articleImgList = articleImgRes;
       this.curQueItem.img_list = JSON.parse(JSON.stringify(articleImgRes));
     },
-    timuchangeMp3(fileList) {
-      console.log(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.curQueItem.topic.mp3_list = JSON.parse(JSON.stringify(articleImgRes));
-    },
-    timuchangeImage(fileList) {
-      console.log(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]",
-          };
-          articleImgRes.push(obj);
-        }
-      });
-      //this.articleImgList = articleImgRes;
-      this.curQueItem.topic.img_list = JSON.parse(JSON.stringify(articleImgRes));
-    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
@@ -224,9 +161,6 @@ export default {
     if (this.curQueItem) {
       this.fileCon.img_list = this.curQueItem.img_list;
       this.fileCon.mp3_list = this.curQueItem.mp3_list;
-      this.fileCon.timu_img_list = this.curQueItem.topic.img_list;
-      this.fileCon.timu_mp3_list = this.curQueItem.topic.mp3_list;
-
     }
   },
   beforeCreate() {}, //生命周期 - 创建之前
@@ -271,6 +205,8 @@ export default {
         }
       }
       .close {
+        position: relative;
+        top: -4px;
         cursor: pointer;
         width: 24px;
         height: 24px;

+ 86 - 28
src/components/Adult/inputModules/Single.vue

@@ -23,6 +23,39 @@
           <el-radio :label="false">不需要</el-radio>
         </el-radio-group>
       </div>
+      <div class="adult-book-input-item" v-if="curQue.IsRecord">
+        <span class="adult-book-lable">录音控件:</span>
+        <img src="../../../assets/adult/pro.png" alt="" />
+      </div>
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable">题目:</span>
+        <el-input
+          class="adult-book-input"
+          :autosize="{ minRows: 2 }"
+          type="textarea"
+          placeholder="请输入题目"
+          v-model="curQue.topic.con"
+          @blur="curQue.topic.con = curQue.topic.con.trim()"
+        ></el-input>
+      </div>
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable">题目图片:</span>
+        <Upload
+          :changeFillId="timuchangeImage"
+          :datafileList="curQue.topic.img_list"
+          :filleNumber="imgNumber"
+          :uploadType="'image'"
+        />
+      </div>
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable">题目音频:</span>
+        <Upload
+          :changeFillId="timuchangeMp3"
+          :datafileList="curQue.topic.mp3_list"
+          :filleNumber="mp3Number"
+          :uploadType="'mp3'"
+        />
+      </div>
       <div
         class="Big-Book-main"
         v-for="(item, index) in curQue.option"
@@ -58,13 +91,15 @@
 <script>
 import Inputmodule from "../common/Inputmodule.vue";
 import SingleModule from "../common/SingleModule.vue";
+import Upload from "../common/Upload.vue";
 
 export default {
   name: "Single",
-  props: ["curQue", "fn_data", "changeCurQue","type"],
+  props: ["curQue", "fn_data", "changeCurQue", "type"],
   components: {
     Inputmodule,
     SingleModule,
+    Upload,
   },
   data() {
     return {
@@ -79,29 +114,26 @@ export default {
           mp3_url: [],
         },
       },
+      imgNumber: 1,
+      mp3Number: 1,
       data_structure: {
         type: "single_chs",
         name: "单选题",
         title: "",
         IsRecord: false,
+        topic: {
+          con: "",
+          img_list: [],
+          mp3_list: [],
+        },
         option: [
           {
-            topic: {
-              con: "",
-              img_list: [],
-              mp3_list: [],
-            },
             con: "",
             img_list: [],
             mp3_list: [],
             isAnswer: "",
           },
           {
-            topic: {
-              con: "",
-              img_list: [],
-              mp3_list: [],
-            },
             con: "",
             img_list: [],
             mp3_list: [],
@@ -134,28 +166,23 @@ export default {
         },
       },
       data_structure2: {
-        type: "checkbox_chs",
+        type: "checkbox_chs", 
         name: "多选题",
         title: "",
         IsRecord: false,
+        topic: {
+          con: "",
+          img_list: [],
+          mp3_list: [],
+        },
         option: [
           {
-            topic: {
-              con: "",
-              img_list: [],
-              mp3_list: [],
-            },
             con: "",
             img_list: [],
             mp3_list: [],
             isAnswer: "",
           },
           {
-            topic: {
-              con: "",
-              img_list: [],
-              mp3_list: [],
-            },
             con: "",
             img_list: [],
             mp3_list: [],
@@ -229,16 +256,47 @@ export default {
       let obj = JSON.parse(JSON.stringify(this.data_structure.option[0]));
       this.curQue.option.push(obj);
     },
+    timuchangeMp3(fileList) {
+      console.log(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.topic.mp3_list = JSON.parse(JSON.stringify(articleImgRes));
+    },
+    timuchangeImage(fileList) {
+      console.log(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]",
+          };
+          articleImgRes.push(obj);
+        }
+      });
+      this.curQue.topic.img_list = JSON.parse(JSON.stringify(articleImgRes));
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
     if (!this.curQue) {
-      if(this.type=='single_chs'){
-      this.changeCurQue(this.data_structure);
-
-      }else if(this.type == 'checkbox_chs'){
-      this.changeCurQue(this.data_structure2);
-
+      if (this.type == "single_chs") {
+        this.changeCurQue(this.data_structure);
+      } else if (this.type == "checkbox_chs") {
+        this.changeCurQue(this.data_structure2);
       }
     }
   },

+ 0 - 1
src/components/Adult/preview/Ligature.vue

@@ -253,7 +253,6 @@ export default {
       this.setjsPlumb(true, true);
       //点击连线
       this.jsPlumb.bind("click", (conn, originalEvent) => {
-        console.log(conn, originalEvent);
         // 删除点击的线
         this.data.forEach((item, i) => {
           if (item.source == conn.sourceId) {

+ 20 - 16
src/views/adultInput3.vue

@@ -55,37 +55,41 @@
               :key="'topic' + toindex + index"
             >
               <p>第{{ toindex + 1 }}题</p>
-              <div class="Big-Book-top">
-                <span>正标题</span>
+              <div class="adult-book-input-item">
+                <span class="adult-book-lable">正标题</span>
                 <el-input
-                  style="width: 80%"
+                  class="adult-book-input"
+                  :autosize="{ minRows: 2 }"
                   type="textarea"
-                  autosize
                   placeholder="请输入正标题"
                   v-model="topic.z_title"
                   @blur="onBlur(topic, 'z_title')"
                 ></el-input>
               </div>
-              <div class="Big-Book-top">
-                <span>副标题</span>
+              <div class="adult-book-input-item">
+                <span class="adult-book-lable">副标题</span>
                 <el-input
-                  style="width: 80%"
+                  class="adult-book-input"
+                  :autosize="{ minRows: 2 }"
                   type="textarea"
-                  autosize
                   placeholder="请输入副标题"
                   v-model="topic.f_title"
                   @blur="onBlur(topic, 'f_title')"
                 ></el-input>
               </div>
-              <div class="Big-Book-top">
-                <span>是否有背景色</span>
-                <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
-                <el-radio v-model="topic.is_bg" :label="false">无</el-radio>
+              <div class="adult-book-input-item">
+                <span>是否有背景色:</span>
+                <el-radio-group v-model="topic.is_bg">
+                  <el-radio :label="true">有</el-radio>
+                  <el-radio :label="false">无</el-radio>
+                </el-radio-group>
               </div>
-              <div class="Big-Book-top">
-                <span>是否有背景图</span>
-                <el-radio v-model="topic.is_layout" :label="true">有</el-radio>
-                <el-radio v-model="topic.is_layout" :label="false">无</el-radio>
+              <div class="adult-book-input-item">
+                <span>是否有背景图:</span>
+                <el-radio-group v-model="topic.is_layout">
+                  <el-radio :label="true">有</el-radio>
+                  <el-radio :label="false">无</el-radio>
+                </el-radio-group>
               </div>
               <div
                 v-for="(rowItem, rowIndex) in topic.table_list"