12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172 |
- <!-- -->
- <template>
- <div
- class="NNPE-ArticleView"
- :class="['NPC-ArticleAnswerView-' + judgeAnswer]"
- v-if="curQue && Bookanswer"
- >
- <div
- class="aduioLine-box"
- v-if="
- curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].id
- "
- >
- <AudioLine
- audioId="'answerAudio'"
- :mp3="curQue.mp3_list[0].id"
- :getCurTime="getCurTime"
- ref="audioLine"
- />
- </div>
- <template v-if="resArr.length > 0">
- <div class="NPC-sentences-list">
- <p class="notice" v-if="curQue.notice">{{ curQue.notice }}</p>
- <div
- :class="[
- 'NNPE-detail',
- item.isTitle ? 'NNPE-detail-title' : '',
- item.timeList.length > 0 &&
- curTime >= item.timeList[0].bg &&
- curTime <= item.timeList[item.timeList.length - 1].ed
- ? 'active'
- : '',
- ]"
- v-for="(item, index) in resArr"
- :key="'detail' + index"
- >
- <div :class="['article-content', isHasRemark ? 'hasRemark' : '']">
- <RoleChs :curRole="item.roleDetail" :type="1" />
- <div class="wordsList-box">
- <div
- class="roleDetail"
- v-if="item.roleDetail.detail.wordsList.length > 0"
- >
- <span class="pinyin">{{
- item.roleDetail.detail.wordsList | handlePinyin
- }}</span>
- <span class="chs">{{
- item.roleDetail.detail.wordsList | handleChs
- }}</span>
- </div>
- <div
- class="para-con"
- :style="{ background: item.roleDetail.color.bg }"
- >
- <div
- class="NNPE-words"
- v-for="(pItem, pIndex) in item.wordsList"
- :key="'wordsList' + pIndex"
- :class="[
- pItem.chs != '“' && pItem.wordIndex == 0
- ? 'textLeft'
- : 'textCenter',
- pItem.chs == '“' ? 'textRight' : '',
- ]"
- >
- <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
- "
- >
- <span class="NNPE-words-box">
- <span
- v-if="item.isHasPY > 0 && pyPosition == 'top'"
- class="NNPE-pinyin"
- :class="[
- pItem.className ? pItem.className : '',
- pItem.pinyin && noFont.indexOf(pItem.pinyin) > -1
- ? 'noFont'
- : '',
- ]"
- >{{ pItem.pinyin | handlePY }}</span
- >
- <template v-if="!pItem.isHeng">
- <span
- class="NNPE-chs"
- :class="[
- item.timeList.length > 0 &&
- curTime >=
- item.timeList[pItem.sentIndex]
- .wordsResultList[pItem.wordIndex].wordBg &&
- curTime <= item.timeList[pItem.sentIndex].ed
- ? 'wordActive'
- : '',
- pItem.config.underLine
- ? 'NNPE-chs-underline'
- : '',
- ]"
- >{{ pItem.chs }}</span
- >
- </template>
- <template v-else>
- <template v-if="judgeAnswer == 'standardAnswer'">
- <EditDiv
- :id="
- 'dialogue_' +
- Math.random().toString(36).substr(2) +
- '_' +
- pItem.hengIndex
- "
- class="answer-input userRight"
- v-model="curQue.answerArr[pItem.hengIndex - 1]"
- :canEdit="TaskModel == 'ANSWER' ? false : true"
- />
- </template>
- <template v-else>
- <EditDiv
- :id="
- 'dialogue_' +
- Math.random().toString(36).substr(2) +
- '_' +
- pItem.hengIndex
- "
- class="answer-input"
- :class="[
- curQue.answerArr &&
- curQue.answerArr[pItem.hengIndex - 1] &&
- curQue.answerArr[pItem.hengIndex - 1] ==
- Bookanswer.input[pItem.hengIndex - 1].value
- ? 'userRight'
- : curQue.answerArr &&
- curQue.answerArr[pItem.hengIndex - 1] &&
- curQue.answerArr[pItem.hengIndex - 1] !=
- Bookanswer.input[pItem.hengIndex - 1]
- .value
- ? 'userError'
- : '',
- ]"
- v-model="
- Bookanswer.input[pItem.hengIndex - 1].value
- "
- :canEdit="TaskModel == 'ANSWER' ? false : true"
- :hengIndex="pItem.hengIndex - 1"
- @saveBlankTF="saveBlankTF"
- />
- </template>
- </template>
- <span
- v-if="item.isHasPY > 0 && pyPosition == 'bottom'"
- class="NNPE-pinyin"
- :class="[
- pItem.className ? pItem.className : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
- ]"
- >{{ pItem.pinyin | handlePY }}</span
- >
- </span>
- <span
- class="NNPE-words-box"
- v-if="item.wordsList[pIndex + 1]"
- >
- <span
- v-if="item.isHasPY > 0 && pyPosition == 'top'"
- class="NNPE-pinyin"
- :class="[
- noFont.indexOf(
- item.wordsList[pIndex + 1].pinyin
- ) > -1
- ? 'noFont'
- : '',
- ]"
- style="text-align: left"
- >{{
- item.wordsList[pIndex + 1].pinyin | handlePY
- }}</span
- >
- <span
- class="NNPE-chs"
- style="text-align: left"
- :class="[
- item.timeList.length > 0 &&
- curTime >=
- item.timeList[pItem.sentIndex].wordsResultList[
- pItem.wordIndex
- ].wordBg &&
- curTime <= item.timeList[pItem.sentIndex].ed
- ? 'wordActive'
- : '',
- ]"
- >{{ item.wordsList[pIndex + 1].chs }}</span
- >
- <span
- v-if="item.isHasPY > 0 && pyPosition == 'bottom'"
- class="NNPE-pinyin"
- :class="[
- noFont.indexOf(
- item.wordsList[pIndex + 1].pinyin
- ) > -1
- ? 'noFont'
- : '',
- ]"
- style="text-align: left"
- >{{
- item.wordsList[pIndex + 1].pinyin | handlePY
- }}</span
- >
- </span>
- <span
- class="NNPE-words-box"
- v-if="
- item.wordsList[pIndex + 2] &&
- item.wordsList[pIndex + 2].chs &&
- chsFhList.indexOf(item.wordsList[pIndex + 2].chs) >
- -1
- "
- >
- <span
- v-if="
- item.isHasPY > 0 &&
- curQue.pyPosition == 'top' &&
- config.isShowPY
- "
- :class="[
- 'NNPE-pinyin',
- noFont.indexOf(
- item.wordsList[pIndex + 2].pinyin
- ) > -1
- ? 'noFont'
- : '',
- ]"
- style="text-align: left"
- >{{ item.wordsList[pIndex + 2].pinyin }}</span
- >
- <span
- class="NNPE-chs"
- style="text-align: left"
- :class="[
- isPlaying &&
- item.timeList &&
- item.timeList[pItem.sentIndex] &&
- curTime >= item.timeList[pItem.sentIndex].bg &&
- curTime <= item.timeList[pItem.sentIndex].ed
- ? 'active'
- : '',
- pItem.chstimeList &&
- pItem.chstimeList[pItem.leg - 1] &&
- curTime >=
- pItem.chstimeList[pItem.leg - 1].wordBg &&
- curQue.wordTime &&
- curTime <= item.timeList[pItem.sentIndex].ed
- ? 'wordActive'
- : '',
- ]"
- >{{ item.wordsList[pIndex + 2].chs }}</span
- >
- <span
- v-if="
- item.isHasPY > 0 &&
- curQue.pyPosition == 'bottom' &&
- config.isShowPY
- "
- :class="[
- 'NNPE-pinyin',
- noFont.indexOf(
- item.wordsList[pIndex + 2].pinyin
- ) > -1
- ? 'noFont'
- : '',
- ]"
- style="text-align: left"
- >{{ item.wordsList[pIndex + 2].pinyin }}</span
- >
- </span>
- </template>
- <!--下一个元素不是标点-->
- <template v-else>
- <span
- v-if="item.isHasPY > 0 && pyPosition == 'top'"
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
- ]"
- >{{ pItem.pinyin | handlePY }}</span
- >
- <template v-if="!pItem.isHeng">
- <span
- v-if="pItem.chs != '#'"
- class="NNPE-chs"
- :class="[
- item.timeList.length > 0 &&
- curTime >=
- item.timeList[pItem.sentIndex].wordsResultList[
- pItem.wordIndex
- ].wordBg &&
- curTime <= item.timeList[pItem.sentIndex].ed
- ? 'wordActive'
- : '',
- pItem.chs != '“' && pItem.padding
- ? 'padding'
- : '',
- pItem.config.underLine
- ? 'NNPE-chs-underline'
- : '',
- ]"
- >{{ pItem.chs }}</span
- >
- </template>
- <template v-else>
- <EditDiv
- class="answer-input"
- v-model="
- Bookanswer.input[pItem.hengIndex - 1].value
- "
- :canEdit="TaskModel == 'ANSWER' ? false : true"
- />
- </template>
- <span
- v-if="item.isHasPY > 0 && pyPosition == 'bottom'"
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
- ]"
- >{{ pItem.pinyin | handlePY }}</span
- >
- </template>
- </template>
- </template>
- <template v-else>
- <span
- :style="{
- height: pItem.height + 'px',
- width: pItem.width + 'px',
- }"
- ></span>
- </template>
- </div>
- <div v-if="item.enwords" class="enwords">
- {{ item.enwords }}
- </div>
- </div>
- <div class="clearFix"></div>
- <div class="answer-box">
- <div class="input-record" v-if="item.isRecord">
- <Soundrecord
- type="normal"
- class="normal-box"
- :TaskModel="TaskModel"
- :answerRecordList="Bookanswer.recordList[index]"
- :tmIndex="index"
- @handleWav="handleWav"
- />
- </div>
- <template
- class="input-record"
- v-if="
- curQue.checkList && curQue.checkList.indexOf('judge') > -1
- "
- >
- <div class="judge-box" v-if="curQue.judge[index].isJudge">
- <a
- :class="[
- 'right-btn',
- Bookanswer.judge[index] == 'right' ? 'active' : '',
- ]"
- @click="handleSelectJudge('right', index)"
- >
- <img
- src="../../../../assets/newImage/common/right-btn.png"
- />
- </a>
- <a
- :class="[
- 'error-btn',
- Bookanswer.judge[index] == 'error' ? 'active' : '',
- ]"
- @click="handleSelectJudge('error', index)"
- >
- <img
- src="../../../../assets/newImage/common/error-btn.png"
- />
- </a>
- </div>
- </template>
- </div>
- </div>
- </div>
- <div
- class="remarkBox remark-top"
- v-if="
- item.remarkDetail &&
- (item.remarkDetail.chs || item.remarkDetail.en)
- "
- >
- <RemarkChs :remarkDetail="item.remarkDetail" />
- </div>
- </div>
- <!-- <div class="dia-article-record">
- <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
- </div> -->
- </div>
- </template>
- <template v-if="paraArr.length > 0">
- <div class="NPC-sentences-list">
- <p class="notice" v-if="curQue.notice">{{ curQue.notice }}</p>
- <div
- :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
- v-for="(item, index) in paraArr"
- :key="'detail' + index"
- >
- <div :class="['article-content', isHasRemark ? 'hasRemark' : '']">
- <RoleChs :curRole="item.roleDetail" :type="1" />
- <div class="wordsList-box">
- <div
- class="roleDetail"
- v-if="item.roleDetail.detail.wordsList.length > 0"
- >
- <span class="pinyin">{{
- item.roleDetail.detail.wordsList | handlePinyin
- }}</span>
- <span class="chs">{{
- item.roleDetail.detail.wordsList | handleChs
- }}</span>
- </div>
- <div
- class="para-con"
- :style="{ background: item.roleDetail.color.bg }"
- >
- <div
- class="NNPE-words"
- v-for="(pItem, pIndex) in item.wordsList"
- :key="'wordsList' + pIndex"
- >
- <template v-if="!pItem.isHeng">
- <span class="NNPE-para-pinyin padding">{{
- pItem.con
- }}</span>
- </template>
- <template v-else>
- <EditDiv
- class="answer-input"
- v-model="Bookanswer.input[pItem.hengIndex - 1].value"
- :canEdit="TaskModel == 'ANSWER' ? false : true"
- />
- </template>
- </div>
- <div v-if="item.enwords" class="enwords">
- {{ item.enwords }}
- </div>
- </div>
- <div class="clearFix"></div>
- <div class="answer-box">
- <div class="input-record" v-if="item.isRecord">
- <Soundrecord
- type="normal"
- class="normal-box"
- :TaskModel="TaskModel"
- :answerRecordList="Bookanswer.recordList[index]"
- :tmIndex="index"
- @handleWav="handleWav"
- />
- </div>
- <template
- class="input-record"
- v-if="
- curQue.checkList && curQue.checkList.indexOf('judge') > -1
- "
- >
- <div class="judge-box" v-if="curQue.judge[index].isJudge">
- <a
- :class="[
- 'right-btn',
- Bookanswer.judge[index] == 'right' ? 'active' : '',
- ]"
- @click="handleSelectJudge('right', index)"
- >
- <img
- src="../../../../assets/newImage/common/right-btn.png"
- />
- </a>
- <a
- :class="[
- 'error-btn',
- Bookanswer.judge[index] == 'error' ? 'active' : '',
- ]"
- @click="handleSelectJudge('error', index)"
- >
- <img
- src="../../../../assets/newImage/common/error-btn.png"
- />
- </a>
- </div>
- </template>
- </div>
- </div>
- </div>
- <div
- class="remarkBox remark-top"
- v-if="
- item.remarkDetail &&
- (item.remarkDetail.chs || item.remarkDetail.en)
- "
- >
- <RemarkChs :remarkDetail="item.remarkDetail" />
- </div>
- </div>
- <!-- <div class="dia-article-record">
- <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
- </div> -->
- </div>
- </template>
- </div>
- </template>
- <script>
- import { timeStrToSen } from "../../../../utils/index";
- import AudioLine from "../AudioLine.vue";
- import RoleChs from "./RoleChs.vue";
- import RemarkChs from "./RemarkChs.vue";
- import Soundrecord from "../Soundrecord.vue";
- import EditDiv from "../EditDiv.vue";
- export default {
- name: "DialogueNormalModelChs",
- props: [
- "curQue",
- "pyPosition",
- "colorBox",
- "listIndex",
- "Bookanswer",
- "TaskModel",
- "judgeAnswer",
- ],
- components: {
- AudioLine,
- RoleChs,
- RemarkChs,
- Soundrecord,
- EditDiv,
- },
- filters: {
- handlePinyin(wordsList) {
- let str = "";
- wordsList.forEach((item, index) => {
- if (index < wordsList.length - 1) {
- str += item.pinyin + " ";
- } else {
- str += item.pinyin;
- }
- });
- return str;
- },
- handleChs(wordsList) {
- let str = "";
- wordsList.forEach((item, index) => {
- if (index < wordsList.length - 1) {
- str += item.chs + " ";
- } else {
- str += item.chs;
- }
- });
- return str;
- },
- handlePY(pinyin) {
- let reg = /_{2,}/g;
- let py = "";
- if (!reg.test(pinyin)) {
- py = pinyin;
- }
- return py;
- },
- },
- data() {
- return {
- resArr: [],
- curTime: 0, //单位s
- chsFhList: [",", "。", "”", ":", "》", "《", "?", "!", ";"],
- enFhList: [",", ".", ";", "?", "!", ":", ">", "<"],
- newWords: ["鱼", "辩礼义"],
- noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "/", "_"],
- oldHz: "",
- hz: "",
- top: 0,
- left: 0,
- articleImg: {}, // 文章图片
- isHasRemark: false,
- paraArr: [],
- answer: [],
- hengIndex: 0,
- };
- },
- computed: {},
- watch: {},
- //方法集合
- methods: {
- // 判断题选择
- handleSelectJudge(obj, index) {
- let _this = this;
- _this.$set(_this.Bookanswer.judge, index, obj);
- _this.$forceUpdate();
- },
- handleWav(list, tmIndex) {
- tmIndex = tmIndex ? tmIndex : 0;
- this.$set(this.Bookanswer.recordList, tmIndex, list);
- },
- saveBlankTF(value, hengIndex) {
- let answerArr = this.curQue.answerArr;
- if (answerArr.length > 0) {
- if (value.trim() == answerArr[hengIndex]) {
- _this.$set(
- _this.Bookanswer.input[hengIndex],
- "userAnswerJudge",
- "[JUDGE##T##JUDGE]"
- );
- } else {
- _this.$set(
- _this.Bookanswer.input[hengIndex],
- "userAnswerJudge",
- "[JUDGE##F##JUDGE]"
- );
- }
- }
- console.log(_this.Bookanswer.input)
- },
- getCurTime(curTime) {
- this.curTime = curTime * 1000;
- },
- handleData() {
- let resArr = [];
- let reg = /_{2,}/g;
- let leg = this.curQue.detail.length;
- let curQue = JSON.parse(JSON.stringify(this.curQue));
- this.curQue.answerArr = this.curQue.answer.split("\n");
- let hengIndex = 0;
- curQue.detail.forEach((dItem, dIndex) => {
- let isHasPY = 0;
- let isRecord = 0;
- let roleDetail = this.getRole(dItem);
- let remarkDetail = dItem.remark;
- if (remarkDetail && (remarkDetail.chs || remarkDetail.en)) {
- this.isHasRemark = true;
- }
- let paraArr = [];
- if (dItem.wordsList && dItem.wordsList.length > 0) {
- dItem.wordsList.forEach((sItem, sIndex) => {
- sItem.forEach((wItem, wIndex) => {
- this.mergeWordSymbol(wItem);
- if (wItem.pinyin) {
- isHasPY++;
- }
- let obj = {
- paraIndex: dIndex, //段落索引
- sentIndex: sIndex, //在段落中句子索引
- wordIndex: wIndex, //单词的索引
- pinyin: wItem.pinyin,
- chs: wItem.chs,
- isHeng: reg.test(wItem.chs),
- padding: true, //wItem.padding,
- className: wItem.className,
- isShow: wItem.isShow,
- isNewWord: this.newWords.indexOf(wItem.chs) > -1 ? true : false,
- config: {
- fontColor: wItem.fontColor,
- fontFamily: wItem.fontFamily,
- fontSize: wItem.fontSize,
- underLine: wItem.underLine,
- wordPadding: wItem.wordPadding,
- },
- };
- if (obj.isHeng) {
- isRecord = isRecord + 1;
- hengIndex = hengIndex + 1;
- obj.hengIndex = hengIndex;
- obj.answer = "";
- }
- paraArr.push(obj);
- });
- });
- let curSentencesLeg = dItem.sentences.length;
- let startLeg = dIndex == 0 ? 0 : curQue.detail[dIndex - 1].endLeg;
- let endLeg = startLeg + curSentencesLeg;
- dItem.endLeg = endLeg;
- let timeList = [];
- if (curQue.wordTime && curQue.wordTime.length > 0) {
- timeList = curQue.wordTime.slice(startLeg, endLeg);
- }
- let enwords =
- dItem.sentencesEn && dItem.sentencesEn.length > 0
- ? dItem.sentencesEn.join(" ")
- : "";
- let paraObj = {
- wordsList: paraArr,
- enwords: enwords,
- timeList: timeList,
- roleDetail: roleDetail,
- remarkDetail: remarkDetail,
- isRecord:
- isRecord > 0 ||
- (curQue.checkList && curQue.checkList.indexOf("record") > -1)
- ? true
- : false,
- isHasPY: isHasPY,
- };
- resArr.push(paraObj);
- }
- });
- this.resArr = resArr;
- // 循环文章图片
- if (curQue.img_list) {
- curQue.img_list.forEach((item) => {
- this.articleImg[item.imgNumber] = item.id;
- });
- }
- },
- handlePYData() {
- let pararArr = [];
- let curQue = JSON.parse(JSON.stringify(this.curQue));
- this.hengIndex = 0;
- curQue.detail.forEach((dItem, dIndex) => {
- let para = dItem.para;
- let paraObj = this.handlePara(para);
- let roleDetail = this.getRole(dItem);
- let remarkDetail = dItem.remark;
- if (remarkDetail && (remarkDetail.chs || remarkDetail.en)) {
- this.isHasRemark = true;
- }
- let obj = {
- wordsList: paraObj.wordsList,
- roleDetail: roleDetail,
- remarkDetail: remarkDetail,
- isRecord: paraObj.isRecord,
- };
- pararArr.push(obj);
- });
- this.paraArr = pararArr;
- },
- //词和标点合一起
- mergeWordSymbol(wItem) {
- if (this.chsFhList.indexOf(wItem.chs) > -1) {
- wItem.isShow = false;
- } else {
- wItem.isShow = true;
- }
- },
- //获取角色
- getRole(dItem) {
- let roleIndex = dItem.roleIndex;
- let resObj = null;
- let roleList = JSON.parse(JSON.stringify(this.curQue.roleList));
- for (let i = 0; i < roleList.length; i++) {
- let item = roleList[i];
- if (item.id == roleIndex) {
- resObj = item;
- resObj.color = this.colorBox[i];
- break;
- }
- }
- return resObj;
- },
- //判断是否有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 = timeStrToSen(item);
- listRes.push(res);
- });
- return listRes;
- },
- //点击播放某个句子
- handleChangeTime(time) {
- this.curTime = time;
- this.$refs.audioLine.onTimeupdateTime(time / 1000);
- },
- //处理数组
- handlePara(para) {
- para = para.trim();
- para = para.replace(/\s+/g, " ");
- para = para.replace(/_{2,}/g, "^ ");
- let paraArr = para.split(/\s/g);
- let resArr = [];
- paraArr.forEach((item, index) => {
- let obj = {
- isHeng: false,
- con: item,
- };
- if (item == "^") {
- obj.isHeng = true;
- obj.answer = "";
- this.hengIndex++;
- obj.hengIndex = this.hengIndex;
- }
- resArr.push(obj);
- });
- let isRecord = /^/g.test(para);
- return { wordsList: resArr, isRecord: isRecord };
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- if (this.curQue) {
- if (this.curQue.font == "cn" || !this.curQue.font) {
- this.handleData();
- } else {
- this.handlePYData();
- }
- }
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='scss' scoped>
- //@import url(); 引入公共css类
- .NNPE-ArticleView {
- width: 100%;
- .clearFix {
- clear: both;
- overflow: hidden;
- }
- .NPC-sentences-list {
- .NPC-article-empty {
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- > div {
- height: 24px;
- &.empty-left {
- width: 100%;
- box-sizing: border-box;
- &.hasRemark {
- width: 553px;
- box-sizing: border-box;
- border-right: 1px rgba(0, 0, 0, 0.1) solid;
- }
- }
- &.empty-right {
- flex: 1;
- }
- }
- &-bottom {
- > div {
- height: 40px;
- }
- }
- }
- .dia-article-record {
- width: 100%;
- border-top: 1px solid rgba(0, 0, 0, 0.1);
- .luyin-box {
- justify-content: start;
- padding: 8px 12px;
- height: 40px;
- width: 280px;
- justify-content: flex-start;
- }
- }
- }
- .NNPE-detail {
- clear: both;
- overflow: hidden;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- &.active {
- background: rgba(0, 0, 0, 0.06);
- }
- .article-content {
- width: 100%;
- box-sizing: border-box;
- padding: 8px 24px 8px 24px;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- &.hasRemark {
- width: 553px;
- border-right: 1px rgba(0, 0, 0, 0.1) solid;
- padding: 8px 0px 8px 23px;
- }
- &.paraLast {
- padding-bottom: 24px;
- }
- }
- .NNPE-words {
- float: left;
- &-box {
- float: left;
- > span {
- display: block;
- &.NNPE-pinyin {
- font-family: "GB-PINYINOK-B";
- font-weight: normal;
- font-size: 14px;
- line-height: 22px;
- color: #000000;
- height: 21px;
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- }
- &.NNPE-chs {
- font-family: "FZJCGFKTK";
- font-size: 20px;
- line-height: 28px;
- color: #000000;
- &.active {
- background: rgba(60, 200, 99, 0.2);
- }
- &.wordActive {
- color: #de4444;
- }
- &.NNPE-chs-underline {
- text-decoration: underline;
- }
- }
- &.padding {
- padding: 0 3px;
- }
- }
- }
- &.textLeft {
- text-align: left;
- }
- &.textCenter {
- text-align: center;
- }
- &.textRight {
- text-align: right;
- }
- > span {
- display: block;
- &.NNPE-pinyin {
- font-family: "GB-PINYINOK-B";
- font-weight: normal;
- font-size: 14px;
- line-height: 22px;
- color: #000000;
- height: 21px;
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- }
- &.NNPE-chs {
- font-family: "FZJCGFKTK";
- font-size: 20px;
- line-height: 28px;
- color: #000000;
- &.active {
- background: rgba(60, 200, 99, 0.2);
- }
- &.wordActive {
- color: #de4444;
- }
- &.NNPE-chs-underline {
- text-decoration: underline;
- }
- }
- &.padding {
- padding: 0 3px;
- }
- }
- .answer-input {
- min-height: 28px;
- box-sizing: border-box;
- border: 0;
- border-bottom: 1px #000 solid;
- background: 0 0;
- min-width: 100px;
- outline: 0;
- text-align: left;
- font-family: "FZJCGFKTK";
- font-size: 20px;
- padding: 0 10px;
- box-sizing: border-box;
- color: #000000;
- line-height: 26px;
- }
- }
- .enwords {
- font-family: "robot";
- font-weight: normal;
- font-size: 14px;
- line-height: 22px;
- color: rgba(0, 0, 0, 0.85);
- }
- &.NNPE-detail-title {
- .wordsList-box {
- > div {
- display: flex;
- justify-content: center;
- }
- }
- }
- .index {
- width: 48px;
- box-sizing: border-box;
- padding: 8px;
- text-align: right;
- border-right: 1px solid rgba(0, 0, 0, 0.1);
- b {
- font-weight: 400;
- color: #000000;
- line-height: 1.5;
- }
- }
- .wordsList-box {
- width: 100%;
- padding: 0px 24px 0px 8px;
- clear: both;
- overflow: hidden;
- .roleDetail {
- height: 36px;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .pinyin {
- font-family: "GB-PINYINOK-B";
- font-size: 14px;
- line-height: 22px;
- color: rgba(0, 0, 0, 0.85);
- margin-right: 4px;
- }
- .chs {
- font-family: "FZJCGFKTK";
- font-size: 16px;
- line-height: 24px;
- color: rgba(0, 0, 0, 0.85);
- }
- }
- > .para-con {
- float: left;
- border: 1px solid rgba(0, 0, 0, 0.1);
- box-sizing: border-box;
- padding: 8px 12px 8px 12px;
- border-radius: 8px;
- }
- > img {
- width: 100%;
- display: block;
- }
- .input-record {
- margin-right: 8px;
- .mini-box {
- width: 64px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- border-radius: 8px;
- padding: 0 12px;
- }
- .normal-box {
- width: 129px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- border-radius: 8px;
- padding: 0 12px;
- }
- }
- }
- }
- .remarkBox {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- &.remark72 {
- padding-top: 72px;
- }
- &.remark-top {
- padding-top: 44px;
- }
- }
- .NNPE-para-pinyin {
- font-weight: normal;
- font-size: 20px;
- line-height: 28px;
- color: #000000;
- height: 28px;
- }
- }
- .NPC-ArticleAnswerView {
- &-userAnswer,
- &-standardAnswer,
- &-studentAnswer {
- .answer-input {
- &.userRight {
- color: #2ca767;
- }
- &.userError {
- color: #ed342d;
- }
- }
- }
- }
- .judge-box {
- display: flex;
- justify-content: center;
- a {
- width: 32px;
- height: 32px;
- border-radius: 8px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- display: flex;
- justify-content: center;
- align-items: center;
- > img {
- width: 24px;
- height: 24px;
- }
- &:hover,
- &.active {
- background-color: #e5fff0;
- border-color: #00c850;
- }
- }
- a.error-btn {
- margin-left: 4px;
- &:hover,
- &.active {
- background-color: #ffe5e5;
- border-color: #de4444;
- }
- }
- }
- .answer-box {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- margin-top: 8px;
- }
- </style>
|