<!--  -->
<template>
  <div v-if="curQue" class="NNPE-ArticleView">
    <div
      v-if="
        ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
          config.isHasPY ||
          config.isHasEN) &&
        curQue.property.mp3_position === 'top'
      "
      class="aduioLine-box aduioLine-practice-npc"
    >
      <div class="aduioLine-content">
        <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
          <AudioLine
            ref="audioLine"
            audio-id="artPhraseAudio"
            :mp3="curQue.mp3_list[0].url"
            :get-cur-time="getCurTime"
            :mp3-source="curQue.mp3_list[0].source"
            :width="colLength == 2 ? 200 : 700"
            :attrib="attrib"
          />
        </template>
      </div>
      <div class="aduioLine-right">
        <!-- <span
          :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
          @click="changePinyin"
          v-if="config.isHasPY"
        ></span>
        <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
        <SvgIcon
          v-if="config.isHasPY"
          icon-class="pin-btn"
          size="16"
          :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
          :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
          @click="changePinyin"
        />
        <SvgIcon
          v-if="config.isHasEN"
          icon-class="en-btn"
          size="16"
          :class="['EN-16', config.isShowEN ? '' : 'disabled']"
          :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
          @click="changeEN"
        />
      </div>
    </div>
    <template v-if="!config.isHasEN || (config.isHasEN && !config.isShowEN)">
      <template v-if="resArr.length > 0">
        <div class="NPC-sentences-list">
          <div class="NPC-article-empty">
            <div :class="['empty-left', isHasRemark ? 'hasRemark' : '']"></div>
            <div class="empty-right"></div>
          </div>
          <div
            v-for="(item, index) in resArr"
            :key="'detail' + index"
            :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
          >
            <div
              class="wordsList-box"
              :class="[
                curQue.detail[index].paragraphAttr
                  ? 'wordsList-box-' + curQue.detail[index].paragraphAttr.paragraphAlign
                  : '',
                'article-content',
                isHasRemark ? 'hasRemark' : '',
              ]"
            >
              <template v-if="item.sourceList.length > 0 && item.sourcePosition === 'before'">
                <img
                  v-if="item.sourceList[0] && item.sourceList[0].type === 'image'"
                  :src="item.sourceList[0].file_url_open"
                />
                <video
                  :src="item.sourceList[0].file_url_open"
                  width="100%"
                  height="400"
                  controls
                  controlsList="nodownload"
                  v-else
                ></video>
              </template>
              <div :class="['para-' + item.paraAlign]">
                <div
                  v-for="(pItem, pIndex) in item.wordsList"
                  :key="'wordsList' + pIndex"
                  class="NNPE-words"
                  :class="[
                    pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
                    pItem.chs == '“' ? 'textRight' : '',
                  ]"
                  @click="showWordDetail($event, pItem.chs, pItem.words)"
                >
                  <template v-if="!pItem.width">
                    <template v-if="pItem.isShow">
                      <template
                        v-if="
                          item.wordsList[pIndex + 1] &&
                          item.wordsList[pIndex + 1].chs &&
                          (chsFhList.indexOf(item.wordsList[pIndex + 1].chs) > -1 ||
                            NumberList.indexOf(item.wordsList[pIndex + 1].chs) > -1)
                        "
                      >
                        <span class="NNPE-words-box">
                          <span
                            v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
                            :class="[
                              'NNPE-pinyin',
                              pItem.className ? pItem.className : '',
                              noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                            ]"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, pItem.pinyin)"
                            >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
                          >
                          <span
                            :class="[
                              'NNPE-chs',
                              newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
                              pItem.words ? 'active' : '',
                            ]"
                            :style="{
                              fontFamily: pItem.config.fontFamily,
                              textDecoration: pItem.config.textDecoration,
                              borderBottom: pItem.config.border === 'dotted' ? '1px dotted' : '',
                              fontWeight: pItem.config.fontWeight,
                              height:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                              lineHeight:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              color:
                                newWordList.indexOf(pItem.chs) > -1 || pItem.words
                                  ? attrib
                                    ? attrib.topic_color
                                    : pItem.config.color
                                  : pItem.config.color,
                            }"
                            ><span
                              v-for="(wItem, wIndex) in pItem.leg"
                              :key="'ci' + wIndex + pIndex + index"
                              :class="[
                                pItem.chstimeList &&
                                pItem.chstimeList[wIndex] &&
                                curTime >= pItem.chstimeList[wIndex].wordBg &&
                                curTime < item.timeList[pItem.sentIndex].ed
                                  ? 'wordActive'
                                  : '',
                              ]"
                              :style="{
                                color:
                                  pItem.chstimeList &&
                                  pItem.chstimeList[wIndex] &&
                                  curTime >= pItem.chstimeList[wIndex].wordBg &&
                                  curTime < item.timeList[pItem.sentIndex].ed &&
                                  attrib
                                    ? attrib.topic_color
                                    : pItem.config.color,
                              }"
                              @click.stop="viewNotes($event, pItem.chs[wIndex], pItem.chs)"
                              >{{ pItem.chs[wIndex] }}</span
                            ></span
                          >
                          <span
                            v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
                            :class="[
                              'NNPE-pinyin',
                              pItem.className ? pItem.className : '',
                              noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                            ]"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, pItem.pinyin)"
                            >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
                          >
                        </span>
                        <span class="NNPE-words-box">
                          <span
                            v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
                            :class="[
                              'NNPE-pinyin',
                              noFont.indexOf(item.wordsList[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.wordsList[pIndex + 1].pinyin)"
                            >{{
                              NumberList.indexOf(item.wordsList[pIndex + 1].pinyin) == -1
                                ? item.wordsList[pIndex + 1].pinyin
                                : ''
                            }}</span
                          >
                          <span
                            class="NNPE-chs"
                            style="text-align: left"
                            :style="{
                              fontFamily: item.wordsList[pIndex + 1].config.fontFamily,
                              textDecoration: item.wordsList[pIndex + 1].config.textDecoration,
                              borderBottom: item.wordsList[pIndex + 1].config.border === 'dotted' ? '1px dotted' : '',
                              fontWeight: item.wordsList[pIndex + 1].config.fontWeight,
                              color: item.wordsList[pIndex + 1].config.color,
                              height:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                              lineHeight:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                            }"
                            @click.stop="
                              viewNotes(
                                $event,
                                item.wordsList[pIndex + 1].words
                                  ? item.wordsList[pIndex + 1].words
                                  : item.wordsList[pIndex + 1].chs,
                              )
                            "
                            >{{ item.wordsList[pIndex + 1].chs }}</span
                          >
                          <span
                            v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
                            :class="[
                              'NNPE-pinyin',
                              noFont.indexOf(item.wordsList[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.wordsList[pIndex + 1].pinyin)"
                            >{{
                              NumberList.indexOf(item.wordsList[pIndex + 1].pinyin) == -1
                                ? item.wordsList[pIndex + 1].pinyin
                                : ''
                            }}</span
                          >
                        </span>

                        <span
                          v-if="
                            item.wordsList[pIndex + 2] &&
                            item.wordsList[pIndex + 2].chs &&
                            (chsFhList.indexOf(item.wordsList[pIndex + 2].chs) > -1 ||
                              NumberList.indexOf(item.wordsList[pIndex + 2].chs) > -1)
                          "
                          class="NNPE-words-box"
                        >
                          <span
                            v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
                            :class="[
                              'NNPE-pinyin',
                              noFont.indexOf(item.wordsList[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.wordsList[pIndex + 2].pinyin)"
                            >{{
                              NumberList.indexOf(item.wordsList[pIndex + 2].pinyin) == -1
                                ? item.wordsList[pIndex + 2].pinyin
                                : ''
                            }}</span
                          >
                          <span
                            class="NNPE-chs"
                            style="text-align: left"
                            :style="{
                              fontFamily: item.wordsList[pIndex + 2].config.fontFamily,
                              textDecoration: item.wordsList[pIndex + 2].config.textDecoration,
                              borderBottom: item.wordsList[pIndex + 2].config.border === 'dotted' ? '1px dotted' : '',
                              fontWeight: item.wordsList[pIndex + 2].config.fontWeight,
                              color: item.wordsList[pIndex + 2].config.color,
                              height:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                              lineHeight:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                            }"
                            @click.stop="
                              viewNotes(
                                $event,
                                item.wordsList[pIndex + 2].words
                                  ? item.wordsList[pIndex + 2].words
                                  : item.wordsList[pIndex + 2].chs,
                              )
                            "
                            >{{ item.wordsList[pIndex + 2].chs }}</span
                          >
                          <span
                            v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
                            :class="[
                              'NNPE-pinyin',
                              noFont.indexOf(item.wordsList[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.wordsList[pIndex + 2].pinyin)"
                            >{{
                              NumberList.indexOf(item.wordsList[pIndex + 2].pinyin) == -1
                                ? item.wordsList[pIndex + 2].pinyin
                                : ''
                            }}</span
                          >
                        </span>
                      </template>
                      <template v-else>
                        <span
                          v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
                          class="NNPE-pinyin"
                          :class="[
                            pItem.chs != '“' && pItem.padding ? 'padding' : '',
                            pItem.className ? pItem.className : '',
                            noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                          ]"
                          :style="{
                            fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                            height:
                              attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
                          }"
                          @click.stop="viewNotes($event, pItem.pinyin)"
                          >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
                        >
                        <span
                          class="NNPE-chs"
                          :class="[
                            pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
                            newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
                            pItem.words ? 'active' : '',
                          ]"
                          :style="{
                            fontFamily: pItem.config.fontFamily,
                            textDecoration: pItem.config.textDecoration,
                            borderBottom: pItem.config.border === 'dotted' ? '1px dotted' : '',
                            fontWeight: pItem.config.fontWeight,
                            height:
                              attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                            fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                            lineHeight:
                              attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                            color:
                              newWordList.indexOf(pItem.chs) > -1 || pItem.words
                                ? attrib
                                  ? attrib.topic_color
                                  : pItem.config.color
                                : pItem.config.color,
                          }"
                          ><span
                            v-for="(wItem, wIndex) in pItem.leg"
                            :key="'ci' + wIndex + pIndex + index"
                            :class="[
                              pItem.chstimeList &&
                              pItem.chstimeList[wIndex] &&
                              curTime >= pItem.chstimeList[wIndex].wordBg &&
                              curTime < item.timeList[pItem.sentIndex].ed
                                ? 'wordActive'
                                : '',
                            ]"
                            :style="{
                              color:
                                pItem.chstimeList &&
                                pItem.chstimeList[wIndex] &&
                                curTime >= pItem.chstimeList[wIndex].wordBg &&
                                curTime < item.timeList[pItem.sentIndex].ed &&
                                attrib
                                  ? attrib.topic_color
                                  : pItem.config.color,
                            }"
                            @click.stop="viewNotes($event, pItem.chs[wIndex], pItem.chs)"
                            >{{ pItem.chs[wIndex] }}</span
                          ></span
                        >
                        <span
                          v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
                          class="NNPE-pinyin"
                          :class="[
                            pItem.chs != '“' && pItem.padding ? 'padding' : '',
                            pItem.className ? pItem.className : '',
                            noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                          ]"
                          :style="{
                            fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                            height:
                              attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
                          }"
                          @click.stop="viewNotes($event, pItem.pinyin)"
                          >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
                        >
                      </template>
                    </template>
                  </template>
                  <template v-else>
                    <span
                      :style="{
                        height: pItem.height + 'px',
                        width: pItem.width + 'px',
                      }"
                    ></span>
                  </template>
                </div>
              </div>
              <div
                v-if="curQue.property.multilingual_position === 'para'"
                class="multilingual-para"
                :class="[item.isTitle ? 'multilingual-para-center' : '', 'multilingual-' + item.paraAlign]"
              >
                {{
                  curQue.detail[index].multilingualTextList && curQue.detail[index].multilingualTextList[multilingual]
                    ? curQue.detail[index].multilingualTextList[multilingual].join(' ')
                    : ''
                }}
              </div>
              <template v-if="item.sourceList.length > 0 && item.sourcePosition === 'after'">
                <img
                  v-if="item.sourceList[0] && item.sourceList[0].type === 'image'"
                  :src="item.sourceList[0].file_url_open"
                />
                <video
                  :src="item.sourceList[0].file_url_open"
                  width="100%"
                  height="400"
                  controls
                  controlsList="nodownload"
                  v-else
                ></video>
              </template>
            </div>
            <div v-if="item.remarkDetail" :class="['remarkBox', 'remark-top-8']">
              <RemarkChs :remark-detail="item.remarkDetail" :margin-top="8" />
            </div>
          </div>
          <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
            {{ items }}
          </div> -->
        </div>
      </template>
    </template>
    <template v-else>
      <template v-if="resObj">
        <!-- 段落对齐方式和备注在此模式里没有写，如果段落里添加了英文后需要在此添加段落对齐和备注 -->

        <div class="NPC-sentences-list">
          <div v-for="(item, index) in resObj.sentList" :key="'detail' + index" :class="['NNPE-detail-box']">
            <div :class="['NNPE-details']">
              <div
                v-if="item.enwords && config.isShowEN && curQue.enPosition && curQue.enPosition == 'top'"
                :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
              >
                {{ item.enwords }}
              </div>
              <div style="overflow: hidden; clear: both"></div>
              <div
                v-for="(pItem, pIndex) in item.sentArr"
                :key="'wordsList' + pIndex"
                class="NNPE-words"
                :class="[
                  pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
                  pItem.chs == '“' ? 'textRight' : '',
                ]"
                @click="showWordDetail($event, pItem.chs, pItem.words)"
              >
                <template v-if="!pItem.width">
                  <template v-if="pItem.isShow">
                    <template
                      v-if="
                        item.sentArr[pIndex + 1] &&
                        item.sentArr[pIndex + 1].chs &&
                        (chsFhList.indexOf(item.sentArr[pIndex + 1].chs) > -1 ||
                          NumberList.indexOf(item.sentArr[pIndex + 1].chs) > -1)
                      "
                    >
                      <span class="NNPE-words-box">
                        <template v-if="curQue.property.pinyin_position == 'top'">
                          <span
                            v-if="config.isShowPY"
                            class="NNPE-pinyin"
                            :class="[
                              pItem.className ? pItem.className : '',
                              sentIndex == index ? 'wordBlank' : '',
                              noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                            ]"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, pItem.pinyin)"
                            >{{ pItem.pinyin }}</span
                          >
                        </template>
                        <span
                          class="NNPE-chs"
                          :class="[
                            pItem.padding && config.isShowPY ? 'padding' : '',
                            sentIndex == index ? 'wordBlank' : '',
                            newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
                            pItem.words ? 'active' : '',
                          ]"
                        >
                          <template v-for="(wItem, wIndex) in pItem.leg">
                            <span
                              :key="'ci' + wIndex + pIndex + index"
                              :class="[]"
                              :style="{
                                fontFamily: pItem.config.fontFamily,
                                textDecoration: pItem.config.textDecoration,
                                borderBottom: pItem.config.border === 'dotted' ? '1px dotted' : '',
                                fontWeight: pItem.config.fontWeight,
                                color: pItem.config.color,
                                height:
                                  attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                                fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                                lineHeight:
                                  attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              }"
                              @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs[wIndex], pItem.chs)"
                              >{{ pItem.chs[wIndex] }}</span
                            >
                          </template>
                        </span>
                        <template v-if="curQue.property.pinyin_position == 'bottom'">
                          <span
                            v-if="config.isShowPY"
                            class="NNPE-pinyin"
                            :class="[
                              pItem.className ? pItem.className : '',
                              sentIndex == index ? 'wordBlank' : '',
                              noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                            ]"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, pItem.pinyin)"
                            >{{ pItem.pinyin }}</span
                          >
                        </template>
                      </span>
                      <span class="NNPE-words-box">
                        <template v-if="curQue.property.pinyin_position == 'top'">
                          <span
                            v-if="config.isShowPY"
                            :class="[
                              'NNPE-pinyin',
                              sentIndex == index ? 'wordBlank' : '',
                              noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.sentArr[pIndex + 1].pinyin)"
                            >{{ item.sentArr[pIndex + 1].pinyin }}</span
                          >
                        </template>
                        <span class="NNPE-chs" style="text-align: left">
                          <span
                            :class="[]"
                            :style="{
                              fontFamily: item.sentArr[pIndex + 1].config.fontFamily,
                              textDecoration: item.sentArr[pIndex + 1].config.textDecoration,
                              borderBottom: item.sentArr[pIndex + 1].config.border === 'dotted' ? '1px dotted' : '',
                              fontWeight: item.sentArr[pIndex + 1].config.fontWeight,
                              color: item.sentArr[pIndex + 1].config.color,
                              height:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                              lineHeight:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                            }"
                            @click.stop="
                              viewNotes(
                                $event,
                                item.sentArr[pIndex + 1].words
                                  ? item.sentArr[pIndex + 1].words
                                  : item.sentArr[pIndex + 1].chs,
                              )
                            "
                          >
                            {{
                              NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
                                ? item.sentArr[pIndex + 1].chs
                                : ''
                            }}</span
                          >
                        </span>
                        <template v-if="curQue.property.pinyin_position == 'bottom'">
                          <span
                            v-if="config.isShowPY"
                            :class="[
                              'NNPE-pinyin',
                              sentIndex == index ? 'wordBlank' : '',
                              noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.sentArr[pIndex + 1].pinyin)"
                            >{{ item.sentArr[pIndex + 1].pinyin }}</span
                          >
                        </template>
                      </span>
                      <span
                        v-if="
                          item.sentArr[pIndex + 2] &&
                          item.sentArr[pIndex + 2].chs &&
                          chsFhList.indexOf(item.sentArr[pIndex + 2].chs) > -1
                        "
                        class="NNPE-words-box"
                      >
                        <template v-if="curQue.property.pinyin_position == 'top'">
                          <span
                            v-if="config.isShowPY"
                            :class="[
                              'NNPE-pinyin',
                              sentIndex == index ? 'wordBlank' : '',
                              noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.sentArr[pIndex + 2].pinyin)"
                            >{{ item.sentArr[pIndex + 2].pinyin }}</span
                          >
                        </template>
                        <span class="NNPE-chs" style="text-align: left">
                          <span
                            :class="[]"
                            :style="{
                              fontFamily: item.sentArr[pIndex + 2].config.fontFamily,
                              textDecoration: item.sentArr[pIndex + 2].config.textDecoration,
                              borderBottom: item.sentArr[pIndex + 2].config.border === 'dotted' ? '1px dotted' : '',
                              fontWeight: item.sentArr[pIndex + 2].config.fontWeight,
                              color: item.sentArr[pIndex + 2].config.color,
                              height:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                              lineHeight:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                            }"
                            @click.stop="
                              viewNotes(
                                $event,
                                item.sentArr[pIndex + 2].words
                                  ? item.sentArr[pIndex + 2].words
                                  : item.sentArr[pIndex + 2].chs,
                              )
                            "
                          >
                            {{
                              NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
                                ? item.sentArr[pIndex + 2].chs
                                : ''
                            }}</span
                          >
                        </span>
                        <template v-if="curQue.property.pinyin_position == 'bottom'">
                          <span
                            v-if="config.isShowPY"
                            :class="[
                              'NNPE-pinyin',
                              sentIndex == index ? 'wordBlank' : '',
                              noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
                            ]"
                            style="text-align: left"
                            :style="{
                              fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                              height:
                                attrib && attrib.pinyin_size
                                  ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
                                  : '22px',
                            }"
                            @click.stop="viewNotes($event, item.sentArr[pIndex + 1].pinyin)"
                            >{{ item.sentArr[pIndex + 2].pinyin }}</span
                          >
                        </template>
                      </span>
                    </template>
                    <template v-else>
                      <template v-if="curQue.property.pinyin_position == 'top'">
                        <span
                          v-if="config.isShowPY"
                          class="NNPE-pinyin"
                          :class="[
                            pItem.chs != '“' && pItem.padding ? 'padding' : '',
                            pItem.className ? pItem.className : '',
                            sentIndex == index ? 'wordBlank' : '',
                            noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                          ]"
                          :style="{
                            fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                            height:
                              attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
                          }"
                          @click.stop="viewNotes($event, pItem.pinyin)"
                          >{{ pItem.pinyin }}</span
                        >
                      </template>
                      <span
                        class="NNPE-chs"
                        :class="[
                          pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
                          sentIndex == index ? 'wordBlank' : '',
                          newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
                          pItem.words ? 'active' : '',
                        ]"
                      >
                        <template v-for="(wItem, wIndex) in pItem.leg">
                          <span
                            :key="'ci' + wIndex + pIndex + index"
                            :class="[]"
                            :style="{
                              fontFamily: pItem.config.fontFamily,
                              textDecoration: pItem.config.textDecoration,
                              borderBottom: pItem.config.border === 'dotted' ? '1px dotted' : '',
                              fontWeight: pItem.config.fontWeight,
                              color: pItem.config.color,
                              height:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                              fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
                              lineHeight:
                                attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
                            }"
                            @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs[wIndex], pItem.chs)"
                            >{{ pItem.chs[wIndex] }}</span
                          >
                        </template>
                      </span>
                      <template v-if="curQue.property.pinyin_position == 'bottom'">
                        <span
                          v-if="config.isShowPY"
                          class="NNPE-pinyin"
                          :class="[
                            pItem.chs != '“' && pItem.padding ? 'padding' : '',
                            pItem.className ? pItem.className : '',
                            sentIndex == index ? 'wordBlank' : '',
                            noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                          ]"
                          :style="{
                            fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
                            height:
                              attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
                          }"
                          @click.stop="viewNotes($event, pItem.pinyin)"
                          >{{ pItem.pinyin }}</span
                        >
                      </template>
                    </template>
                  </template>
                </template>
                <template v-else>
                  <span
                    :style="{
                      height: pItem.height + 'px',
                      width: pItem.width + 'px',
                    }"
                  ></span>
                </template>
              </div>
              <div style="overflow: hidden; clear: both"></div>
              <div
                v-if="
                  item.enwords &&
                  config.isShowEN &&
                  (!curQue.enPosition || (curQue.enPosition && curQue.enPosition == 'bottom'))
                "
                :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
              >
                {{ item.enwords }}
              </div>
              <div
                v-if="curQue.property.multilingual_position === 'para'"
                class="multilingual-para"
                :class="[item.isTitle ? 'multilingual-para-center' : '', 'multilingual-' + item.paraAlign]"
              >
                {{
                  curQue.detail[index].multilingualTextList[multilingual]
                    ? curQue.detail[index].multilingualTextList[multilingual].join(' ')
                    : ''
                }}
              </div>
            </div>
          </div>
          <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
            {{ items }}
          </div> -->
        </div>
      </template>
    </template>
    <template v-for="(items, indexs) in curQue.detail">
      <div
        v-if="
          curQue.property.multilingual_position === 'all' &&
          items.multilingualTextList &&
          items.multilingualTextList[multilingual] &&
          items.multilingualTextList[multilingual].length > 0
        "
        :key="indexs"
        class="multilingual"
      >
        <div
          class="multilingual-para"
          :class="[items.isTitle ? 'multilingual-para-center' : '', 'multilingual-' + items.paraAlign]"
        >
          {{
            items.multilingualTextList && items.multilingualTextList[multilingual]
              ? items.multilingualTextList[multilingual].join(' ')
              : ''
          }}
        </div>
      </div>
    </template>
    <div
      v-if="
        ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
          config.isHasPY ||
          config.isHasEN) &&
        curQue.property.mp3_position === 'bottom'
      "
      class="aduioLine-box aduioLine-practice-npc aduioLine-box-bottom"
    >
      <div class="aduioLine-content">
        <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
          <AudioLine
            ref="audioLine"
            audio-id="artPhraseAudio"
            :mp3="curQue.mp3_list[0].url"
            :get-cur-time="getCurTime"
            :mp3-source="curQue.mp3_list[0].source"
            :width="colLength == 2 ? 200 : 700"
            :attrib="attrib"
          />
        </template>
      </div>
      <div class="aduioLine-right">
        <!-- <span
          :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
          @click="changePinyin"
          v-if="config.isHasPY"
        ></span>
        <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
        <SvgIcon
          v-if="config.isHasPY"
          icon-class="pin-btn"
          size="16"
          :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
          :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
          @click="changePinyin"
        />
        <SvgIcon
          v-if="config.isHasEN"
          icon-class="en-btn"
          size="16"
          :class="['EN-16', config.isShowEN ? '' : 'disabled']"
          :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
          @click="changeEN"
        />
      </div>
    </div>
    <template v-if="isShow">
      <div
        ref="wordcard"
        class="NNPE-wordDetail"
        :style="{
          marginLeft:
            word.detail.new_word.length === 1
              ? '-152px'
              : windowWidth > word.detail.new_word.length * 126 + 48
                ? '-' + (word.detail.new_word.length * 63 + 24) + 'px'
                : '0px',
          left: windowWidth > word.detail.new_word.length * 126 + 48 ? '' : '0px',
        }"
      >
        <Wordcard
          :word="word"
          :change-word-card="changeWordCard"
          :theme-color="themeColor"
          :current-tree-i-d="currentTreeID"
          :TaskModel="TaskModel"
          :write-list="curQue.Bookanswer.writeModel"
          :mp3-url="activeWord ? activeWord.newWordMp3 : ''"
          :bg="activeWord ? activeWord.bg : null"
          :ed="activeWord ? activeWord.ed : null"
          :attrib="attrib"
          :is-mobile="isMobile"
          @changeCurQue="changeCurQue"
        />
      </div>
    </template>
    <template v-if="isNoteShow">
      <div
        ref="notecard"
        class="NNPE-wordDetail"
        :style="{
          marginLeft: windowWidth > 642 ? '-321px' : '0px',
          left: windowWidth > 642 ? '' : '0px',
          width: isMobile ? '100%' : '',
        }"
      >
        <Notecard :item="curNoteCon" :change-card="changeCard" :attrib="attrib" :is-mobile="isMobile" />
      </div>
    </template>
  </div>
</template>

<script>
import AudioLine from '../voice_matrix/components/AudioLine.vue';
import Wordcard from './components/Wordcard.vue'; // 卡片
import Notecard from './components/Notecard.vue'; // 注释
import RemarkChs from '../dialogue_article/RemarkChs.vue';

export default {
  name: 'PhraseModelChs',
  components: {
    AudioLine,
    Wordcard,
    Notecard,
    RemarkChs,
  },
  props: [
    'curQue',
    'bodyLeft',
    'NNPENewWordList',
    'themeColor',
    'noFont',
    'currentTreeID',
    'config',
    'TaskModel',
    'NNPEAnnotationList',
    'colLength',
    'multilingual',
    'attrib',
    'isMobile',
  ],
  data() {
    return {
      resArr: [],
      resObj: null,
      curTime: 0, // 单位s
      chsFhList: ['，', '。', '”', '：', '》', '？', '！', '；', '#', '、'],
      enFhList: [',', '.', ';', '?', '!', ':', '>', '<'],
      NumberList: ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'],
      newWords: ['鱼', '辩礼义'],
      oldHz: '',
      hz: '',
      clientY: 0,
      top: 0,
      left: 0,
      articleImg: {}, // 文章图片
      newWordList: [],
      word: null,
      isShow: false,
      screenHeight: 0,
      cardHeight: 0,
      contentWidth: 732,
      noteNum: '',
      curNoteCon: null,
      isNoteShow: false,
      oldNoteNum: '',
      clickType: '',
      sentIndex: -1,
      highWords: null,
      highWordsArr: [],
      highIndex: 0,
      activeWord: null,
      windowWidth: window.innerWidth,
      isHasRemark: false,
    };
  },
  computed: {},
  watch: {
    hz: {
      handler(val) {
        let _this = this;
        if (val) {
          _this.handleNewWords(val);
        }
      },
      // 深度观察监听
      deep: true,
    },
    isShow: {
      handler(val) {
        let _this = this;
        if (val) {
          setTimeout(() => {
            _this.cardHeight = _this.$refs.wordcard.offsetHeight;
            if (_this.screenHeight - _this.clientY > _this.cardHeight) {
              _this.top = _this.clientY + 20;
            } else {
              _this.top = _this.clientY - _this.cardHeight - 30;
            }
          }, 0);
        }
      },
      // 深度观察监听
      deep: true,
    },
    noteNum: {
      handler(val) {
        let _this = this;
        if (val) {
          _this.handleNote(val);
        }
      },
      // 深度观察监听
      deep: true,
    },
    isNoteShow: {
      handler(val) {
        let _this = this;
        if (val) {
          setTimeout(() => {
            _this.cardHeight = _this.$refs.notecard.offsetHeight;
            if (_this.screenHeight - _this.clientY > _this.cardHeight) {
              _this.top = _this.clientY + 20;
            } else {
              _this.top = _this.clientY - _this.cardHeight - 30;
            }
          }, 50);
        }
      },
      // 深度观察监听
      deep: true,
    },
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    if (this.NNPENewWordList && this.NNPENewWordList.length > 0) {
      this.handleNewword();
    }
    if (this.curQue) {
      this.handleData();
    }
    window.addEventListener('resize', this.getScreenHeight);
    this.getScreenHeight();
  },
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {
    window.removeEventListener('resize', this.getScreenHeight);
  }, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {},
  // 方法集合
  methods: {
    // 拼音的显示和隐藏
    changePinyin() {
      if (this.config.isHasPY) {
        this.$emit('changeConfig', 'isShowPY');
      }
    },
    // 英文的显示和隐藏
    changeEN() {
      if (this.config.isHasEN) {
        this.$emit('changeConfig', 'isShowEN');
      }
    },
    getCurTime(curTime) {
      this.curTime = curTime;
    },
    handleData() {
      let resArr = [];
      let leg = this.curQue.detail.length;
      let curQue = JSON.parse(JSON.stringify(this.curQue));
      let dhaspinyin = false; // 每段是否有拼音
      curQue.detail.forEach((dItem, dIndex) => {
        dhaspinyin = false;
        let remarkDetail = dItem.remark;
        if (
          remarkDetail &&
          (remarkDetail.chs || remarkDetail.en || (remarkDetail.img_list && remarkDetail.img_list.length > 0))
        ) {
          this.isHasRemark = true;
        }

        let paraArr = [];
        if (dItem.paraAlign !== 'center') {
          paraArr = [
            {
              pinyin: '',
              chs: '',
              width: 20,
              height: 20,
            },
            {
              width: 20,
              height: 20,
              pinyin: '',
              chs: '',
            },
          ];
        }
        dItem.wordsList.forEach((sItem, sIndex) => {
          sItem.forEach((wItem, wIndex) => {
            let sentence = dItem.sentences[sIndex];
            // this.judgePad(sItem, wItem, wIndex);
            this.mergeWordSymbol(sItem, wItem, wIndex);
            let words = '';
            if (this.newWordList.length > 0) {
              if (!this.highWords) {
                this.findLightWord(wItem, wIndex, sentence, sItem);
                words = this.highWords ? this.highWords.words : '';
              } else if (wIndex > this.highWords.endIndex - 1) {
                this.highWords = null;
                this.findLightWord(wItem, wIndex, sentence, sItem);
                words = this.highWords ? this.highWords.words : '';
              } else {
                words = this.highWords ? this.highWords.words : '';
              }
            }
            let obj = {
              paraIndex: dIndex, // 段落索引
              sentIndex: sIndex, // 在段落中句子索引
              wordIndex: wIndex, // 单词的索引
              pinyin:
                curQue.pinyin_type === 'pinyin'
                  ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
                    ? wItem.pinyin_up
                    : wItem.pinyin
                  : wItem.pinyin_tone,
              chs: wItem.chs,
              padding: true, // wItem.padding,
              className: wItem.className,
              isShow: wItem.isShow,
              isNewWord: this.newWords.indexOf(wItem.chs) > -1,
              words,
              leg: wItem.chs.length,
              config: {
                fontFamily: wItem.fontFamily,
                color: wItem.color,
                textDecoration: wItem.textDecoration,
                border: wItem.border,
                fontWeight: wItem.fontWeight,
              },
            };
            paraArr.push(obj);
            if (wItem.pinyin) dhaspinyin = true;
          });
        });

        let paraObj = {
          wordsList: paraArr,
          dhaspinyin,
          isTitle: dItem.isTitle,
          paraAlign: dItem.paraAlign,
          remarkDetail,
          sourceList: dItem.sourceList ? dItem.sourceList : [],
          sourcePosition: dItem.sourcePosition,
        };
        resArr.push(paraObj);
      });
      this.resArr = resArr;

      // 循环文章图片
      if (curQue.img_list) {
        curQue.img_list.forEach((item) => {
          this.articleImg[item.imgNumber] = item.id;
        });
      }
      let resArrs = [];
      let sentArrTotal = [];
      let timeArr = [];
      let wordTimeList = curQue.wordTime;
      curQue.detail.forEach((dItem, dIndex) => {
        dItem.wordsList.forEach((sItem, sIndex) => {
          let sentArr = [];

          sItem.forEach((wItem, wIndex) => {
            let startIndex = wIndex === 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
            let endIndex = wIndex === 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
            // this.judgePad(sItem, wItem, wIndex);
            this.mergeWordSymbols(wItem);
            let obj = {
              paraIndex: dIndex, // 段落索引
              sentIndex: sIndex, // 在段落中句子索引
              wordIndex: wIndex, // 单词的索引
              pinyin:
                curQue.pinyin_type === 'pinyin'
                  ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
                    ? wItem.pinyin_up
                    : wItem.pinyin
                  : wItem.pinyin_tone,
              chs: wItem.chs,
              padding: true,
              className: wItem.className,
              isShow: wItem.isShow,
              startIndex,
              endIndex,
              leg: wItem.chs.length,
              timeList: [],
              config: {
                fontFamily: wItem.fontFamily,
                color: wItem.color,
                textDecoration: wItem.textDecoration,
                border: wItem.border,
                fontWeight: wItem.fontWeight,
              },
            };
            sentArr.push(obj);
          });
          let objs = {
            sentArr,
            enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/'/g, '’'),
            paraAlign: dItem.paraAlign,
            sourceList: dItem.sourceList ? dItem.sourceList : [],
            sourcePosition: dItem.sourcePosition,
          };
          sentArrTotal.push(sentArr);
          resArrs.push(objs);
        });
        timeArr.push(dItem.timeList);
      });
      if (wordTimeList && wordTimeList.length > 0) {
        this.mergeWordTime(sentArrTotal, wordTimeList);
      }
      let timeList = [];
      timeArr.forEach((item) => {
        item.forEach((aItem) => {
          if (timeList.indexOf(aItem) < 0) {
            timeList.push(aItem);
          }
        });
      });
      this.resObj = { sentList: resArrs, timeList };
    },
    findLightWord(wItem, startIndex, sentence, sItem) {
      let endIndex = 0;
      let words = '';
      this.newWordList.forEach((item) => {
        if (item.length === 1) {
          if (item === wItem.chs && !wItem.banLight) {
            words = wItem.chs;
            endIndex = startIndex + 1;
          }
        } else if (item[0] === wItem.chs && sentence.indexOf(item) > -1) {
          let index = null;
          let chsStr = '';
          for (let i = startIndex; i < sItem.length + 1; i++) {
            index = i;
            if (chsStr.length === item.length) {
              break;
            } else {
              chsStr += sItem[i] ? sItem[i].chs : '';
            }
          }
          if (chsStr === item && !wItem.banLight) {
            words = item;
            endIndex = index;
          }
        } else if (wItem.new_word && wItem.new_word === item && !wItem.banLight) {
          words = item;
          endIndex = startIndex + 1;
        }
      });
      if (words) {
        this.highWords = { words, endIndex };
      } else {
        this.highWords = null;
      }
    },
    // 词和标点合一起
    mergeWordSymbol(sItem, wItem, curIndex) {
      let leg = sItem.length;
      if (wItem && wItem.chs) {
        // let nextIndex = curIndex + 1;
        // let chs = sItem[nextIndex].chs;
        // let pinyin = sItem[nextIndex].pinyin;
        // if (this.chsFhList.indexOf(chs) > -1) {
        //   wItem.chs = "<a>" + wItem.chs + "</a><a>" + chs + "</a>";
        //   wItem.pinyin = "<a>" + wItem.pinyin + "</a><a>" + pinyin + "</a>";
        // }
        if (this.chsFhList.indexOf(wItem.chs) > -1 || this.NumberList.indexOf(wItem.chs) > -1) {
          wItem.isShow = false;
        } else {
          wItem.isShow = true;
        }
      }

      // if (this.enFhList.indexOf(wItem.pinyin) > -1) {
      //   wItem.className = "textLeft";
      // }
    },
    mergeWordSymbols(wItem) {
      if (this.chsFhList.indexOf(wItem.chs) > -1 || this.NumberList.indexOf(wItem.chs) > -1) {
        wItem.isShow = false;
      } else {
        wItem.isShow = true;
      }
    },
    mergeWordTime(resArr, wordTimeList) {
      resArr.forEach((item, index) => {
        let wordsResultList = wordTimeList[index].wordsResultList;
        item.forEach((wItem) => {
          let startIndex = wItem.startIndex;
          let endIndex = wItem.endIndex;
          wItem.timeList = wordsResultList.slice(startIndex, endIndex);
        });
      });
    },
    // 判断是否有padding
    judgePad(sItem, wItem, curIndex) {
      let leg = sItem.length;
      if (curIndex < leg - 1) {
        let nextIndex = curIndex + 1;
        let chs = sItem[nextIndex].chs;
        if (this.chsFhList.indexOf(chs) > -1 || this.chsFhList.indexOf(wItem.chs) > -1) {
          wItem.padding = false;
        } else {
          wItem.padding = true;
        }
        if (this.enFhList.indexOf(wItem.pinyin) > -1) {
          wItem.className = 'textLeft';
        }
      }
    },
    // 转化时间
    handleTimeList(list) {
      let listRes = [];
      list.forEach((item) => {
        let res = this.timeStrToSen(item);
        listRes.push(res);
      });
      return listRes;
    },
    // 分：秒转秒
    timeStrToSen(time) {
      if (!time) {
        return -1;
      }
      let pos = time.indexOf(':');
      let min = 0;
      let sec = 0;
      if (pos > 0) {
        min = parseInt(time.substring(0, pos));
        sec = parseFloat(time.substring(pos + 1));
      }
      return min * 60 + sec;
    },
    // 点击播放某个句子
    handleChangeTime(time) {
      this.curTime = time;
      this.$refs.audioLine.onTimeupdateTime(time);
    },
    handleNewword() {
      let NewWordList = [];
      this.NNPENewWordList.forEach((wItem) => {
        // item.forEach((wItem) => {
        if (wItem.new_word) {
          NewWordList.push(wItem.new_word);
        } else if (wItem.detail && wItem.detail.sentence) {
          NewWordList.push(wItem.detail.sentence);
        }
        // });
      });
      this.newWordList = JSON.parse(JSON.stringify(NewWordList));
    },

    showWordDetail(e, word, words) {
      let _this = this;
      _this.highIndex = 0;
      _this.highWordsArr = [];
      if (word && this.newWordList.indexOf(word) > -1) {
        this.highWordsArr.push(word);
      }
      if (words && word !== words && this.newWordList.indexOf(words) > -1) {
        this.highWordsArr.push(words);
      }
      if (this.newWordList.indexOf(word) > -1 || this.newWordList.indexOf(words) > -1) {
        if (word && this.newWordList.indexOf(word) > -1) {
          if (_this.oldHz !== word) {
            this.isShow = false;
            setTimeout(() => {
              _this.hz = word;
            }, 50);
          }
        } else if (words && this.newWordList.indexOf(words) > -1) {
          if (_this.oldHz !== words) {
            this.isShow = false;
            setTimeout(() => {
              _this.hz = words;
            }, 50);
          }
        }
        _this.clientY = e.clientY;
        let left = e.clientX;
        let width = 0;

        if (word.length === 1 || word.length === 2) {
          width = 304;
        } else if (word.length === 3 || word.length === 4) {
          width = 432;
        } else if (word.length > 3) {
          width = 560;
        }

        if (left - this.bodyLeft > this.contentWidth / 2) {
          _this.left = left - width + 10;
        } else {
          _this.left = left;
        }
      }
    },
    hideWordDetail() {
      this.isShow = false;
    },
    changeWordCard(isShow) {
      this.isShow = isShow;
      this.oldHz = '';
      this.hz = '';
    },
    // 处理分词数据
    handleNewWords(val, top, left) {
      this.isShow = true;
      this.word = null;
      for (let i = 0; i < this.NNPENewWordList.length; i++) {
        let item = this.NNPENewWordList[i];
        // for (let j = 0; j < pItem.length; j++) {
        // let item = pItem[j];
        if (item.new_word.trim() === val.trim()) {
          let wordlist = val.split('');
          this.word = { list: wordlist, detail: item, top, left };
          break;
        }
        // }
      }
      this.oldHz = val;
    },
    getScreenHeight() {
      this.screenHeight = window.innerHeight;
    },
    changeCurQue(answer) {
      if (answer) {
        let writeModel = this.curQue.Bookanswer.writeModel;
        let hz = answer.hz;
        if (writeModel.hasOwnProperty(hz)) {
          writeModel[hz].push(answer);
        } else {
          writeModel[hz] = [answer];
        }
      }
    },
    viewNotes(e, noteNum, noteNums) {
      let _this = this;
      _this.clickType = 'note';
      _this.activeWord = null;
      let noteIndex = '';
      if (_this.NumberList.indexOf(noteNum) > -1) {
        for (let i = 0; i < _this.NumberList.length; i++) {
          if (_this.NumberList[i] === noteNum) {
            noteIndex = `${String(i)}`;
            break;
          }
        }
        this.showNoteDetail(e, noteIndex);
      } else if (this.newWordList.indexOf(noteNum) > -1) {
        if (_this.oldHz !== noteNum) {
          this.isShow = false;
          _this.NNPENewWordList.forEach((items) => {
            // item.forEach((items) => {
            if (items.new_word === noteNum) {
              this.activeWord = items;
            }
            // });
          });
          setTimeout(() => {
            _this.hz = noteNum;
          }, 50);
        }
        _this.clientY = e.clientY;
        let left = e.clientX;
        let width = 0;

        if (noteNum.length === 1 || noteNum.length === 2) {
          width = 304;
        } else if (noteNum.length === 3 || noteNum.length === 4) {
          width = 432;
        } else if (noteNum.length > 3) {
          width = 560;
        }

        if (left - this.bodyLeft > this.contentWidth / 2) {
          _this.left = left - width + 10;
        } else {
          _this.left = left;
        }
      } else if (this.newWordList.indexOf(noteNums) > -1) {
        if (_this.oldHz !== noteNums) {
          this.isShow = false;
          _this.NNPENewWordList.forEach((items) => {
            // item.forEach((items) => {
            if (items.new_word === noteNums) {
              this.activeWord = items;
            }
            // });
          });
          setTimeout(() => {
            _this.hz = noteNums;
          }, 50);
        }
        _this.clientY = e.clientY;
        let left = e.clientX;
        let width = 0;

        if (noteNums.length === 1 || noteNums.length === 2) {
          width = 304;
        } else if (noteNums.length === 3 || noteNums.length === 4) {
          width = 432;
        } else if (noteNums.length > 3) {
          width = 560;
        }

        if (left - this.bodyLeft > this.contentWidth / 2) {
          _this.left = left - width + 10;
        } else {
          _this.left = left;
        }
      }
    },
    showNoteDetail(e, noteNum) {
      let _this = this;
      if (_this.oldNoteNum !== noteNum) {
        this.isNoteShow = false;
        setTimeout(() => {
          _this.noteNum = noteNum;
        }, 50);
      }
      _this.clientY = e.clientY;
      let left = e.clientX;
      let width = 642;
      if (left - this.bodyLeft > this.contentWidth / 2) {
        _this.left = left - width + 10;
      } else if (left - 200 > 500) {
        _this.left = 500;
      } else {
        _this.left = left - 200;
      }
    },
    // 处理注释数据
    handleNote(val) {
      let _this = this;
      _this.isNoteShow = true;
      _this.oldNoteNum = val;
      let noteIndex = Number(val);
      if (_this.NNPEAnnotationList && _this.NNPEAnnotationList.length > 0) {
        _this.curNoteCon = _this.NNPEAnnotationList[noteIndex] ? _this.NNPEAnnotationList[noteIndex] : null;
      }
    },
    changeCard(isShow) {
      let _this = this;
      _this.isNoteShow = isShow;
      _this.oldNoteNum = '';
      _this.noteNum = '';
    },
  }, // 如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang="scss" scoped>
.NNPE-ArticleView {
  width: 100%;

  .aduioLine-practice-npc {
    display: flex;
    align-items: center;
    justify-content: flex-start;

    .aduioLine-content {
      flex: 1;
    }

    .aduioLine-right {
      box-sizing: border-box;
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 69px;
      height: 40px;
      padding: 0 12px;
      border-left: 1px solid rgba(0, 0, 0, 10%);

      > span {
        width: 16px;
        height: 16px;
        cursor: pointer;
      }
    }
  }

  .NPC-sentences-list {
    // padding: 24px 0;

    .NPC-article-empty {
      display: flex;
      align-items: flex-start;
      justify-content: flex-start;

      > div {
        height: 24px;

        &.empty-left {
          box-sizing: border-box;
          width: 100%;

          &.hasRemark {
            box-sizing: border-box;
            width: 60%;
            border-right: 1px rgba(0, 0, 0, 10%) solid;
          }
        }

        &.empty-right {
          flex: 1;
        }
      }

      &-bottom {
        > div {
          height: 40px;
        }
      }
    }
  }

  .multilingual {
    padding: 6px 24px 12px;
    word-break: break-word;
  }

  .NNPE-detail {
    // overflow: hidden; // 为了不遮挡备注内容
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    clear: both;
    color: rgba(0, 0, 0, 100%);

    .para-center {
      display: flex;
      flex-flow: wrap;
      justify-content: center;
      width: 100%;
    }

    .para-right {
      display: flex;
      flex-flow: wrap;
      justify-content: end;
      width: 100%;
    }

    .NNPE-words {
      float: left;
      padding-bottom: 5px;

      &-box {
        float: left;

        > span {
          display: block;

          &.NNPE-pinyin {
            height: 22px;
            font-family: 'League';
            font-size: 14px;
            font-weight: normal;
            line-height: 1.5;

            &.noFont {
              font-family: initial;
            }

            &.textLeft {
              text-align: left;
            }
          }

          &.NNPE-chs {
            font-family: '楷体';
            font-size: 20px;
            line-height: 1.4;

            &.active {
              color: #de4444;
            }
          }

          &.padding {
            padding: 0 3px;
          }
        }
      }

      &.textLeft {
        text-align: left;
      }

      &.textCenter {
        text-align: center;
      }

      &.textRight {
        text-align: right;
      }

      > span {
        display: block;

        &.NNPE-pinyin {
          height: 22px;
          font-family: 'League';
          font-size: 14px;
          font-weight: normal;
          line-height: 1.5;

          &.noFont {
            font-family: initial;
          }

          &.textLeft {
            text-align: left;
          }
        }

        &.NNPE-chs {
          font-family: '楷体';
          font-size: 20px;
          line-height: 1.4;

          &.active {
            color: #de4444;
          }
        }

        &.padding {
          padding: 0 3px;
        }
      }
    }

    &.NNPE-detail-title {
      .wordsList-box {
        > div {
          display: flex;
          flex-flow: wrap;
          justify-content: center;
          width: 100%;
        }
      }
    }

    .index {
      box-sizing: border-box;
      width: 48px;
      padding: 8px;
      text-align: right;
      border-right: 1px solid rgba(0, 0, 0, 10%);

      b {
        font-weight: 400;
        line-height: 1.5;
        color: #000;
      }
    }

    .wordsList-box {
      // display: flex;
      width: 100%;
      padding: 6px 24px 12px;

      &-left {
        justify-content: flex-start;
      }

      &-center {
        justify-content: center;
      }

      &-right {
        justify-content: flex-end;
      }

      > div {
        overflow: hidden;
        clear: both;
      }

      > img {
        display: block;
        max-width: 100%;
        margin: 0 auto;
      }
    }
  }

  .article-content {
    box-sizing: border-box;

    // display: flex;
    // align-items: flex-start;
    // justify-content: flex-start;
    width: 100%;

    &.hasRemark {
      width: 60%;
      padding: 8px 0 8px 23px;
      border-right: 1px rgba(0, 0, 0, 10%) solid;
    }

    &.paraLast {
      padding-bottom: 24px;
    }
  }

  .remarkBox {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;

    &.remark72 {
      padding-top: 72px;
    }

    &.remark-top {
      padding-top: 44px;
    }

    &.remark-top-8 {
      padding-top: 8px;
    }
  }

  .NNPE-wordDetail {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 116;
    max-width: 100%;
    margin-top: -196px;
    overflow: auto;

    // box-shadow: 0 4px 16px rgba(0, 0, 0, 15%);

    //   width: 260px;
    //   height: 200px;
    //   background: #cc0;
  }

  .NNPE-detail-box {
    box-sizing: border-box;
    width: 100%;
    padding: 8px 24px;
    margin-bottom: 8px;

    &.active {
      background: rgba(222, 68, 68, 15%);
    }
  }

  .NNPE-details {
    overflow: hidden;
    clear: both;

    .NNPE-words {
      float: left;

      &-box {
        float: left;

        > span {
          display: block;

          &.NNPE-pinyin {
            height: 20px;
            font-family: 'League';
            font-size: 14px;
            font-weight: normal;
            line-height: 20px;
            color: rgba(0, 0, 0, 65%);

            &.noFont {
              font-family: initial;
            }

            &.textLeft {
              text-align: left;
            }

            &.wordBlank {
              color: rgba(0, 0, 0, 65%);
            }
          }

          &.NNPE-chs {
            font-family: '楷体';
            font-size: 20px;
            line-height: 28px;
            color: rgba(0, 0, 0, 65%);

            &.active {
              color: #de4444;
            }

            &.wordBlank {
              color: rgba(0, 0, 0, 65%);
            }
          }

          // &.padding {
          //   padding-right: 6px;
          // }
        }
      }

      &.textLeft {
        text-align: left;
      }

      &.textCenter {
        text-align: center;
      }

      &.textRight {
        text-align: right;
      }

      > span {
        display: block;

        &.NNPE-pinyin {
          height: 20px;
          font-family: 'League';
          font-size: 14px;
          font-weight: normal;
          line-height: 20px;
          color: rgba(0, 0, 0, 65%);

          &.noFont {
            font-family: initial;
          }

          &.textLeft {
            text-align: left;
          }

          &.wordBlank {
            color: rgba(0, 0, 0, 65%);
          }
        }

        &.NNPE-chs {
          font-family: '楷体';
          font-size: 20px;
          line-height: 28px;
          color: rgba(0, 0, 0, 65%);

          &.active {
            color: #de4444;
          }

          &.wordBlank {
            color: rgba(0, 0, 0, 65%);
          }
        }

        &.padding {
          padding: 0 3px;
        }
      }
    }
  }

  .enwords {
    padding-left: 3px;
    font-family: 'Helvetica';
    font-size: 14px;
    font-weight: normal;
    line-height: 22px;
    color: rgba(0, 0, 0, 65%);
    word-break: break-word;

    &.wordBlank {
      color: rgba(0, 0, 0, 65%);
    }
  }

  .multilingual-para {
    text-indent: 40px;
    word-break: break-word;

    &-center,
    &.multilingual-center {
      text-align: center;
      text-indent: 0;
    }

    &.multilingual-right {
      text-align: right;
    }
  }
}
</style>
