Pārlūkot izejas kodu

课文组件生词模式分词以及去掉拼音里的注释角标

natasha 1 mēnesi atpakaļ
vecāks
revīzija
f21c1f3cf6

+ 53 - 4
src/views/book/courseware/preview/components/article/PhraseModelChs.vue

@@ -124,8 +124,32 @@
                                     : ''
                                   : '',
                             }"
-                            @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs)"
-                            >{{ pItem.chs }}</span
+                            ><span
+                              v-for="(wItem, wIndex) in pItem.leg"
+                              :key="'ci' + wIndex + pIndex + index"
+                              :class="[
+                                isPlaying &&
+                                pItem.chstimeList &&
+                                pItem.chstimeList[wIndex] &&
+                                curTime >= pItem.chstimeList[wIndex].wordBg &&
+                                curTime < item.timeList[pItem.sentIndex].ed
+                                  ? 'wordActive'
+                                  : '',
+                              ]"
+                              :style="{
+                                color:
+                                  isPlaying &&
+                                  pItem.chstimeList &&
+                                  pItem.chstimeList[wIndex] &&
+                                  curTime >= pItem.chstimeList[wIndex].wordBg &&
+                                  curTime < item.timeList[pItem.sentIndex].ed &&
+                                  attrib
+                                    ? attrib.topic_color
+                                    : '',
+                              }"
+                              @click.stop="viewNotes($event, pItem.chs[wIndex])"
+                              >{{ pItem.chs[wIndex] }}</span
+                            ></span
                           >
                           <span
                             v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
@@ -323,8 +347,32 @@
                                   : ''
                                 : '',
                           }"
-                          @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs)"
-                          >{{ pItem.chs }}</span
+                          ><span
+                            v-for="(wItem, wIndex) in pItem.leg"
+                            :key="'ci' + wIndex + pIndex + index"
+                            :class="[
+                              isPlaying &&
+                              pItem.chstimeList &&
+                              pItem.chstimeList[wIndex] &&
+                              curTime >= pItem.chstimeList[wIndex].wordBg &&
+                              curTime < item.timeList[pItem.sentIndex].ed
+                                ? 'wordActive'
+                                : '',
+                            ]"
+                            :style="{
+                              color:
+                                isPlaying &&
+                                pItem.chstimeList &&
+                                pItem.chstimeList[wIndex] &&
+                                curTime >= pItem.chstimeList[wIndex].wordBg &&
+                                curTime < item.timeList[pItem.sentIndex].ed &&
+                                attrib
+                                  ? attrib.topic_color
+                                  : '',
+                            }"
+                            @click.stop="viewNotes($event, pItem.chs[wIndex])"
+                            >{{ pItem.chs[wIndex] }}</span
+                          ></span
                         >
                         <span
                           v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
@@ -1057,6 +1105,7 @@ export default {
               isShow: wItem.isShow,
               isNewWord: this.newWords.indexOf(wItem.chs) > -1,
               words,
+              leg: wItem.chs.length,
               config: {
                 fontFamily: wItem.fontFamily,
               },

+ 3 - 0
src/views/book/courseware/preview/components/article/components/Wordcard.vue

@@ -253,6 +253,7 @@ export default {
       collFlag: false,
       praMp3: '',
       isPhone: false, // 是否是移动端打开
+      NumberList: ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'],
     };
   },
   computed: {},
@@ -276,6 +277,8 @@ export default {
       }
     }
     this.word.detail.new_word = new_word_str;
+    const regex = new RegExp(`[${this.NumberList.join('')}]`, 'g');
+    this.word.detail.pinyin = this.word.detail.pinyin.replace(regex, '');
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {