Browse Source

修改北语问题

natasha 1 năm trước cách đây
mục cha
commit
445faa13c6

+ 1 - 1
src/components/Adult/common/SentenceSegTemp.vue

@@ -47,7 +47,7 @@
         </ul> -->
       </div>
     </div>
-    <div class="adult-book-input-item" v-if="type=='sentence_single_chs'">
+    <div class="adult-book-input-item">
         <span class="adult-book-lable">句子缩进:</span>
         <el-radio-group v-model="detail.textindent">
             <el-radio :label="true">是</el-radio>

+ 35 - 1
src/components/Adult/inputModules/CourseStart.vue

@@ -26,7 +26,7 @@
         ></el-input>
       </div>
       <div>
-        <SentenceSegwordChs :curQue="curQue.detail" :type="type" />
+        <SentenceSegwordChs :curQue="curQue.detail" :type="'sort_chs'" />
       </div>
       <div class="adult-book-input-item">
         <span class="adult-book-lable">英文:</span>
@@ -42,6 +42,13 @@
         ></el-input>
       </div>
       <div class="adult-book-input-item">
+        <span class="adult-book-lable">句子缩进:</span>
+        <el-radio-group v-model="curQue.textindent">
+            <el-radio :label="true">是</el-radio>
+            <el-radio :label="false">否</el-radio>
+        </el-radio-group>
+      </div>
+      <div class="adult-book-input-item">
         <span class="adult-book-lable">内容:</span>
         <el-input
           class="adult-book-input"
@@ -54,6 +61,9 @@
           show-word-limit
         ></el-input>
       </div>
+      <div>
+        <SentenceSegwordChs :name="'内容分句'" :curQue="curQue.conDetail" :type="type" />
+      </div>
     </div>
   </div>
 </template>
@@ -77,6 +87,7 @@ export default {
         titleType: "",
         en: "",
         con: "",
+        textindent: false,
         detail: {
           type: "detail",
           pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
@@ -85,6 +96,14 @@ export default {
           seg_words: "",
           wordsList: [],
         },
+        conDetail:{
+          type: "detail",
+          pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
+          sentence: "", //句子
+          segList: [], //分词结果
+          seg_words: "",
+          wordsList: [],
+        },
       },
     };
   },
@@ -100,6 +119,21 @@ export default {
   created() {
     if (!this.curQue) {
       this.changeCurQue(this.data_structure);
+    }else{
+        if (!this.curQue.hasOwnProperty("textindent")) {
+            this.$set(this.curQue, "textindent", false);
+        }
+        if (!this.curQue.hasOwnProperty("conDetail")) {
+            let obj = {
+                type: "detail",
+                pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
+                sentence: "", //句子
+                segList: [], //分词结果
+                seg_words: "",
+                wordsList: [],
+            }
+            this.$set(this.curQue, "conDetail", obj);
+        }
     }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)

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

@@ -1113,6 +1113,7 @@ export default {
       } else {
         let obj = {
           hengLeg: -1,
+          textindent: false, // 缩进
           detail: [
             {
               pyPosition: "top", //top 拼音在上面;bottom 拼音在下面

+ 65 - 15
src/components/Adult/preview/CourseStart.vue

@@ -68,9 +68,29 @@
       <b class="content-en" v-if="curQue.en">{{ curQue.en }}</b>
     </div>
     <div class="item-intro-box">
-      <div class="item-intro" v-if="curQue.con">
+      <div class="item-intro" :style="{textIndent:curQue.textindent?'2em':''}" v-if="curQue.con">
         {{ curQue.con }}
       </div>
+      <template v-if="curQue.conDetail&&curQue.conDetail.sentence">
+        <div class="item-intro">
+            <OneSentenceTemp
+                :detail="curQue.conDetail"
+                :TaskModel="TaskModel"
+                :Bookanswer="[]"
+                :correctAnswer="[]"
+                :isInput="
+                    false
+                "
+                :pyPosition="'top'"
+                :pyColors="'rgba(255, 255, 255, 0.85)'"
+                :fn_check_list="[]"
+                :pyNumber="pyNumber"
+                :record_check="[]"
+                :maxFontsize="maxFontsize"
+                :textIndent="curQue.textindent"
+            />
+        </div>
+      </template>
     </div>
     <a class="start-btn" @click="handleNNPEnext">开始学习</a>
   </div>
@@ -79,15 +99,18 @@
 <script>
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
+import OneSentenceTemp from "./components/OneSentenceTemp.vue";
 export default {
   //import引入的组件需要注入到对象中才能使用
-  components: {},
-  props: ["curQue", "handleNNPEnext"],
+  components: {OneSentenceTemp},
+  props: ["curQue", "handleNNPEnext","TaskModel"],
   data() {
     //这里存放数据
     return {
       chsFhList: [",", "。", "“", ":", "》", "?", "!", ";"],
       noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"], // 对应不要拼音字体
+      pyNumber: 0,
+      maxFontsize: 16
     };
   },
   //计算属性 类似于data概念
@@ -98,18 +121,45 @@ export default {
   methods: {
     // 处理数据
     handleData() {
-      let _this = this;
-      let curQue = JSON.parse(JSON.stringify(this.curQue));
-      let paraArr = [];
-      curQue.detail.wordsList.forEach((sItem, sIndex) => {
-        let obj = {
-          pinyin: sItem.pinyin,
-          chs: sItem.chs,
-          isShow: true,
-        };
-        paraArr.push(obj);
-      });
-      this.$set(_this.curQue.detail, "resArr", paraArr);
+        let _this = this;
+        let curQue = JSON.parse(JSON.stringify(this.curQue));
+        let paraArr = [];
+        curQue.detail.wordsList.forEach((sItem, sIndex) => {
+            let obj = {
+                pinyin: sItem.pinyin,
+                chs: sItem.chs,
+                isShow: true,
+            };
+            paraArr.push(obj);
+        });
+        this.$set(_this.curQue.detail, "resArr", paraArr);
+
+        if(this.curQue.hasOwnProperty("conDetail")){
+            let isHasPY = 0;
+            let maxFontsize = 16;
+              if (this.curQue.conDetail.wordsList.length > 0) {
+                this.curQue.conDetail.wordsList.forEach((sItem, sIndex) => {
+                  this.mergeWordSymbol(sItem);
+                  if (sItem.pinyin) {
+                    isHasPY++;
+                  }
+                  sItem.fontColor='rgba(255, 255, 255, 0.85)'
+                  let fontSize = JSON.parse(JSON.stringify(sItem.fontSize));
+                  fontSize = Number(fontSize.replace("px", ""));
+                  maxFontsize = fontSize > maxFontsize ? fontSize : maxFontsize;
+                });
+              } 
+            this.maxFontsize = maxFontsize;
+            this.pyNumber = isHasPY;
+        }
+    },
+    //词和标点合一起
+    mergeWordSymbol(sItem) {
+      if (this.chsFhList.indexOf(sItem.chs) > -1) {
+        sItem.isShow = false;
+      } else {
+        sItem.isShow = true;
+      }
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)

+ 2 - 0
src/components/Adult/preview/SentenceModule.vue

@@ -205,6 +205,7 @@
                         :record_check="sdItem.fn_check_list.record_check"
                         :hengLeg="sdItem.hengLeg"
                         :maxFontsize="sdItem.maxFontsize"
+                        :textIndent="sdItem.textindent"
                       />
                       <template
                         v-if="
@@ -595,6 +596,7 @@
                         :record_check="sdItem.fn_check_list.record_check"
                         :hengLeg="sdItem.hengLeg"
                         :maxFontsize="sdItem.maxFontsize"
+                        :textIndent="sdItem.textindent"
                       />
                       <template
                         v-if="

+ 3 - 0
src/components/Adult/preview/Voicefullscreen.vue

@@ -207,6 +207,7 @@
             @dblclick="showWordDetail($event, pItem)"
             @click="playWord(pItem)"
           >
+          <template v-if="NumberList.indexOf(pItem.chs) == -1">
             <template v-if="!pItem.width">
               <template v-if="pItem.isShow">
                 <template
@@ -478,6 +479,8 @@
                 }"
               ></span>
             </template>
+          </template>
+            
           </div>
         </div>
         <div style="clear: both; overflow: hidden"></div>

+ 26 - 1
src/components/Adult/preview/components/OneSentenceTemp.vue

@@ -40,6 +40,9 @@
                     : '',
                   pItem.underLine ? 'NPC-pinyin-underline' : '',
                 ]"
+                :style="{
+                    color: pyColors ? pyColors : ''
+                }"
                 >{{ pItem.pinyin | handlePY }}</span
               >
               <template v-if="!pItem.isHeng">
@@ -221,6 +224,9 @@
                 v-if="pyNumber > 0 && pyPosition == 'bottom'"
                 class="NPC-pinyin"
                 :class="[noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',pItem.underLine ? 'NPC-pinyin-underline' : '',]"
+                :style="{
+                    color: pyColors ? pyColors : ''
+                }"
                 >{{ pItem.pinyin | handlePY }}</span
               >
             </span>
@@ -234,6 +240,9 @@
                     : '',
                   detail.wordsList[pIndex + 1].underLine ? 'NPC-pinyin-underline' : '',
                 ]"
+                :style="{
+                    color: pyColors ? pyColors : ''
+                }"
                 style="text-align: left"
                 >{{ detail.wordsList[pIndex + 1].pinyin | handlePY }}</span
               >
@@ -269,6 +278,9 @@
                     : '',
                   detail.wordsList[pIndex + 1].underLine ? 'NPC-pinyin-underline' : '',
                 ]"
+                :style="{
+                    color: pyColors ? pyColors : ''
+                }"
                 style="text-align: left"
                 >{{ detail.wordsList[pIndex + 1].pinyin | handlePY }}</span
               >
@@ -290,6 +302,9 @@
                     : '',
                   detail.wordsList[pIndex + 2].underLine ? 'NPC-pinyin-underline' : '',
                 ]"
+                :style="{
+                    color: pyColors ? pyColors : ''
+                }"
                 style="text-align: left"
                 >{{ detail.wordsList[pIndex + 2].pinyin }}</span
               >
@@ -318,6 +333,9 @@
                     : '',
                   detail.wordsList[pIndex + 2].underLine ? 'NPC-pinyin-underline' : '',
                 ]"
+                :style="{
+                    color: pyColors ? pyColors : ''
+                }"
                 style="text-align: left"
                 >{{ detail.wordsList[pIndex + 2].pinyin }}</span
               >
@@ -334,6 +352,9 @@
                 noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                 pItem.underLine ? 'NPC-pinyin-underline' : '',
               ]"
+              :style="{
+                color: pyColors ? pyColors : ''
+              }"
               >{{ pItem.pinyin | handlePY }}</span
             >
             <template v-if="!pItem.isHeng">
@@ -519,6 +540,9 @@
                 noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                 pItem.underLine ? 'NPC-pinyin-underline' : '',
               ]"
+              :style="{
+                color: pyColors ? pyColors : ''
+              }"
               >{{ pItem.pinyin | handlePY }}</span
             >
           </template>
@@ -583,7 +607,8 @@ export default {
     "maxFontsize",
     "judgeAnswer",
     "correctAnswer",
-    "textIndent"
+    "textIndent",
+    "pyColors"
   ],
   filters: {
     handlePY(pinyin) {