Преглед на файлове

修改对话录入问题-完成

gcj преди 2 години
родител
ревизия
41fb8e3f42

+ 14 - 4
src/components/Adult/common/SentenceSegTemp.vue

@@ -81,7 +81,7 @@
           <span class="adult-book-lable">字体:</span>
           <el-radio-group
             v-model="dItem.config.fontFamily"
-            @change="(value) => changefontFamily(value, dItem)"
+            @input="(value) => changefontFamily(value, dItem)"
           >
             <el-radio
               v-for="(item, index) in fontFamilyList"
@@ -94,7 +94,10 @@
         </div>
         <div class="adult-book-input-item adult-book-input-item-center">
           <span class="adult-book-lable">字的大小:</span>
-          <el-radio-group v-model="dItem.config.fontSize">
+          <el-radio-group
+            v-model="dItem.config.fontSize"
+            @input="(value) => changefontSize(value, dItem)"
+          >
             <el-radio label="12px">12px</el-radio>
             <el-radio label="16px">16px</el-radio>
             <el-radio label="20px">20px</el-radio>
@@ -284,13 +287,20 @@ export default {
   methods: {
     changefontFamily(value, dItem) {
       if (value == "FZJCGFKTK") {
-        dItem.config.fontSize = "20px";
+        dItem.config.fontSize = "16px";
       } else if (value == "Sans-GBNPC") {
         dItem.config.fontSize = "16px";
       } else if (value == "robot") {
         dItem.config.fontSize = "16px";
       }
     },
+    changefontSize(value, dItem) {
+      if (dItem && dItem.wordsList && dItem.wordsList.length > 0) {
+        dItem.wordsList.forEach((item, index) => {
+          item.fontSize = value;
+        });
+      }
+    },
     addElement() {
       let obj = {
         pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
@@ -300,7 +310,7 @@ export default {
         wordsList: [],
         hengList: [],
         config: {
-          fontSize: "20px",
+          fontSize: "16px",
           fontColor: "#000",
           fontFamily: "FZJCGFKTK",
           wordPadding: [],

+ 1 - 1
src/components/Adult/common/SentenceSegwordChs/index.vue

@@ -107,7 +107,7 @@ export default {
         let obj = {
           chs: item,
           pinyin: "",
-          fontSize: "20px",
+          fontSize: "16px",
           fontColor: "#000",
           fontFamily: "FZJCGFKTK",
           wordPadding: [],

+ 33 - 26
src/components/Adult/inputModules/DialogueAnswerChs/index.vue

@@ -51,7 +51,7 @@
         <span
           class="editDialogue"
           @click="editDialogue(index)"
-          style="margin-right: 16px"
+          style="margin-right: 16px; cursor: pointer"
           >编辑此对话</span
         >
         <!-- @click="addOption(index)" -->
@@ -78,10 +78,8 @@
     >
       <DialogueTem :curQue="curQue.list[listIndex]" :listIndex="listIndex" />
       <span slot="footer" class="dialog-footer">
-        <el-button @click="dialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="dialogVisible = false"
-          >确 定</el-button
-        >
+        <el-button @click="cancleDialogue">取 消</el-button>
+        <el-button type="primary" @click="cancleDialogue">确 定</el-button>
       </span>
     </el-dialog>
     <el-dialog
@@ -94,11 +92,14 @@
       top="10px"
       :modal="true"
     >
-      <DialogueTem
-        :curQue="curQue.option[listIndex]"
-        :listIndex="'option' + listIndex"
-        type="option"
-      />
+      <template v-if="curQue && curQue.option">
+        <DialogueTem
+          :curQue="curQue.option[listIndex]"
+          :listIndex="'option' + listIndex"
+          type="option"
+          v-if="optionVisible"
+        />
+      </template>
       <span slot="footer" class="dialog-footer">
         <el-button @click="optionVisible = false">取 消</el-button>
         <el-button type="primary" @click="optionVisible = false"
@@ -227,6 +228,9 @@ export default {
       this.listIndex = index;
       this.dialogVisible = true;
     },
+    cancleDialogue() {
+      this.dialogVisible = false;
+    },
     selectOption(index) {
       this.listIndex = index;
       this.selectVisible = true;
@@ -244,15 +248,14 @@ export default {
       this.curQue.option.push(objOption);
     },
     delDialogue(index) {
-        this.$confirm("确定要删除吗?", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning",
-        })
-        .then(() => {
-            this.curQue.list.splice(index, 1);
-            this.curQue.option.splice(index, 1);
-        })
+      this.$confirm("确定要删除吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.curQue.list.splice(index, 1);
+        this.curQue.option.splice(index, 1);
+      });
     },
     initCurQueData() {
       let res_data = JSON.parse(JSON.stringify(this.data_structure));
@@ -274,20 +277,24 @@ export default {
         }
       }
       this.curQue.list.forEach((item) => {
-        item.checkList = ["input"];
-        item.judge = [];
+        if (!item.hasOwnProperty("checkList")) {
+          item.checkList = ["input"];
+          item.judge = [];
+        }
       });
-      if(!this.curQue.hasOwnProperty("wordcard")){
-        this.$set(this.curQue, "wordcard", JSON.parse(JSON.stringify(this.data_structure.wordcard)));
+      if (!this.curQue.hasOwnProperty("wordcard")) {
+        this.$set(
+          this.curQue,
+          "wordcard",
+          JSON.parse(JSON.stringify(this.data_structure.wordcard))
+        );
       }
     } else {
       this.initCurQueData();
     }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
-    
-  },
+  mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前
   beforeUpdate() {}, //生命周期 - 更新之前

+ 12 - 3
src/components/Adult/inputModules/DialogueTem/components/ClauseresultChs.vue

@@ -1,6 +1,6 @@
 <!-- 分句组件 -->
 <template>
-  <div class="Big-Book-Maxwidth">
+  <div class="Big-Book-Maxwidth" v-if="refresh">
     <div class="Big-Book-con-top">
       <span class="adult-book-lable-bottom">分句结果:</span>
     </div>
@@ -47,13 +47,22 @@ export default {
     return {
       para_list: [],
       paraIndex: "",
+      refresh: true,
     };
   },
   computed: {},
   watch: {
-    "curQue.detail": {
+    curQue: {
       handler: function (newVal, oldVal) {
-        this.handleSentence(JSON.parse(JSON.stringify(newVal)));
+        let _this = this;
+        _this.refresh = false;
+        if (newVal && newVal.detail) {
+          _this.handleSentence(JSON.parse(JSON.stringify(newVal.detail)));
+          _this.$nextTick(() => {
+            // 重新渲染组件
+            _this.refresh = true;
+          });
+        }
       },
       deep: true,
     },

+ 30 - 11
src/components/Adult/inputModules/DialogueTem/components/ParagraphChs.vue

@@ -1,6 +1,6 @@
 <!--分句组件-->
 <template>
-  <div class="Big-Book-Maxwidth">
+  <div class="Big-Book-Maxwidth" v-if="refresh">
     <div class="Big-Book-con">
       <div class="Big-Book-con-top">
         <span class="Big-Book-left-text">文章段落:</span>
@@ -47,7 +47,13 @@
           <template
             v-if="curQue.checkList && curQue.checkList.indexOf('judge') > -1"
           >
-            <template v-if="curQue.judge[index].isJudge">
+            <template
+              v-if="
+                curQue.judge &&
+                curQue.judge.length > 0 &&
+                curQue.judge[index].isJudge
+              "
+            >
               <el-radio-group v-model="curQue.judge[index].judge">
                 <el-radio label="right">正确</el-radio>
                 <el-radio label="error">错误</el-radio>
@@ -122,6 +128,7 @@ export default {
       remarkVisible: false,
       remark: null,
       paraIndex: 0,
+      refresh: true,
     };
   },
   computed: {},
@@ -137,6 +144,19 @@ export default {
       },
       deep: true,
     },
+    curQue: {
+      handler: function (newVal, oldVal) {
+        let _this = this;
+        _this.refresh = false;
+        if (newVal) {
+          _this.$nextTick(() => {
+            // 重新渲染组件
+            _this.refresh = true;
+          });
+        }
+      },
+      deep: true,
+    },
   },
   //方法集合
   methods: {
@@ -187,18 +207,17 @@ export default {
     },
 
     deleteOption(index) {
-        this.$confirm("确定要删除吗?", "提示", {
+      this.$confirm("确定要删除吗?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
-      })
-        .then(() => {
-            if (index == 0) {
-                this.$message.warning("不能全部删除");
-                return;
-            }
-            this.curQue.detail.splice(index, 1);
-        })
+      }).then(() => {
+        if (index == 0) {
+          this.$message.warning("不能全部删除");
+          return;
+        }
+        this.curQue.detail.splice(index, 1);
+      });
     },
     addOption() {
       let leg = this.curQue.detail.length;

+ 3 - 1
src/components/Adult/inputModules/DialogueTem/components/SegbywordChs.vue

@@ -162,7 +162,7 @@ export default {
   },
   computed: {},
   watch: {
-    segList: {
+    curQue: {
       handler: function (newVal, oldVal) {
         if (newVal != oldVal) {
           this.getParaSegWordsResult();
@@ -373,6 +373,8 @@ export default {
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
+    console.log("segList");
+    console.log(this.segList);
     this.getParaSegWordsResult();
   },
   beforeCreate() {}, //生命周期 - 创建之前

+ 21 - 12
src/components/Adult/inputModules/DialogueTem/index.vue

@@ -122,7 +122,7 @@
 
     <!---分句-->
     <div class="NPC-Book-Paragraph" v-if="isClause">
-      <Clauseresult :curQue="curQue" :segByWord="segByWord" />
+      <Clauseresult :curQue="curQue" :segByWord="segByWord" v-if="isClause" />
     </div>
     <template v-if="curQue.font !== 'py'">
       <div class="lrc-box">
@@ -142,7 +142,12 @@
       </div>
       <!---分词-->
       <div class="NPC-Book-Word" v-if="isByWord">
-        <Segbyword :curQue="curQue" :paraIndex="paraIndex" :segList="segList" />
+        <Segbyword
+          :curQue="curQue"
+          :paraIndex="paraIndex"
+          :segList="segList"
+          v-if="isByWord"
+        />
       </div>
     </template>
     <!---答案-->
@@ -265,12 +270,6 @@ export default {
           isFn: false,
           isDisable: false,
         },
-        {
-          type: "record",
-          name: "录音题",
-          isFn: false,
-          isDisable: false,
-        },
       ],
       imgNumber: 1,
       mp3Number: 1,
@@ -305,6 +304,7 @@ export default {
           this.loading = false;
           this.segList = null;
           this.isWordTime = false;
+          console.log(this.isClause);
           this.initData();
         }
       },
@@ -322,11 +322,19 @@ export default {
     },
     // 更多配置选择
     handleCheckedFnChange(value) {
-      if (this.curQue.checkList.indexOf("input") < 0) {
-        this.curQue.answer = "";
+      let _this = this;
+      if (_this.curQue.checkList.indexOf("input") < 0) {
+        _this.curQue.answer = "";
       }
-      if (this.curQue.checkList.indexOf("judge") < 0) {
-        this.curQue.judge = [];
+      if (_this.curQue.checkList.indexOf("judge") < 0) {
+        _this.curQue.judge = [];
+      } else {
+        _this.curQue.judge = [];
+        _this.curQue.detail.forEach(() => {
+          _this.curQue.judge.push(
+            JSON.parse(JSON.stringify({ isJudge: false, judge: "" }))
+          );
+        });
       }
     },
     changeMp3(fileList) {
@@ -604,6 +612,7 @@ export default {
       this.cTVisible = true;
     },
     initData() {
+      console.log(this.curQue);
       if (this.curQue) {
         if (!this.curQue.number) {
           this.curQue.number = "";

+ 1 - 1
src/components/Adult/inputModules/SentenceModule.vue

@@ -1111,7 +1111,7 @@ export default {
               wordsList: [],
               hengList: [],
               config: {
-                fontSize: "20px",
+                fontSize: "16px",
                 fontColor: "#000",
                 fontFamily: "FZJCGFKTK",
                 wordPadding: [],

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

@@ -304,6 +304,9 @@ export default {
               }
             }
           }
+          if (items.Isexample && index == i) {
+            clss = "example";
+          }
         });
         return clss;
       } else {
@@ -694,6 +697,7 @@ export default {
             source: item.nodeId,
             target: this.curQue.option[item.AnswerList].nodeId,
             correct: true,
+            Isexample: item.Isexample,
           });
         }
       });
@@ -701,7 +705,8 @@ export default {
       this.judgeAnswer == "studentAnswer" ||
       this.judgeAnswer == "userAnswer"
     ) {
-      this.data.data.forEach((item) => {
+      this.data.data.forEach((item, index) => {
+        item.Isexample = this.curQue.con[index].Isexample;
         if (item.source) {
           this.curQue.con.forEach((con) => {
             if (item.source == con.nodeId) {
@@ -767,6 +772,11 @@ export default {
   /* 错误颜色 */
   border: 1px solid #ed342d !important;
 }
+.example {
+  background: rgba(0, 0, 0, 0.1) !important;
+  /* 错误颜色 */
+  border: 1px solid rgba(0, 0, 0, 0.1) !important;
+}
 .JoinLine {
   width: 100%;
   .main {