AnswerModel.vue 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331
  1. <!-- -->
  2. <template>
  3. <div
  4. class="NNPE-ArticleView"
  5. :class="['NPC-ArticleAnswerView-' + judgeAnswer]"
  6. v-if="curQue && Bookanswer"
  7. >
  8. <div
  9. class="aduioLine-box"
  10. v-if="
  11. curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].id
  12. "
  13. >
  14. <AudioLine
  15. audioId="'answerAudio'"
  16. :mp3="curQue.mp3_list[0].id"
  17. :getCurTime="getCurTime"
  18. ref="audioLine"
  19. />
  20. </div>
  21. <template v-if="resArr.length > 0">
  22. <div class="NPC-sentences-list">
  23. <p class="notice" v-if="curQue.notice">{{ curQue.notice }}</p>
  24. <div
  25. :class="[
  26. 'NNPE-detail',
  27. item.isTitle ? 'NNPE-detail-title' : '',
  28. item.timeList.length > 0 &&
  29. curTime >= item.timeList[0].bg &&
  30. curTime <= item.timeList[item.timeList.length - 1].ed
  31. ? 'active'
  32. : '',
  33. ]"
  34. v-for="(item, index) in resArr"
  35. :key="'detail' + index"
  36. >
  37. <div :class="['article-content', isHasRemark ? 'hasRemark' : '']">
  38. <RoleChs :curRole="item.roleDetail" :type="1" />
  39. <div class="wordsList-box">
  40. <div
  41. class="roleDetail"
  42. v-if="item.roleDetail.detail.wordsList.length > 0"
  43. >
  44. <span class="pinyin">{{
  45. item.roleDetail.detail.wordsList | handlePinyin
  46. }}</span>
  47. <span class="chs">{{
  48. item.roleDetail.detail.wordsList | handleChs
  49. }}</span>
  50. </div>
  51. <div
  52. class="para-con"
  53. :style="{ background: item.roleDetail.color.bg }"
  54. >
  55. <div
  56. class="NNPE-words"
  57. v-for="(pItem, pIndex) in item.wordsList"
  58. :key="'wordsList' + pIndex"
  59. :class="[
  60. pItem.chs != '“' && pItem.wordIndex == 0
  61. ? 'textLeft'
  62. : 'textCenter',
  63. pItem.chs == '“' ? 'textRight' : '',
  64. ]"
  65. >
  66. <template v-if="!pItem.width">
  67. <template v-if="pItem.isShow">
  68. <template
  69. v-if="
  70. item.wordsList[pIndex + 1] &&
  71. item.wordsList[pIndex + 1].chs &&
  72. chsFhList.indexOf(item.wordsList[pIndex + 1].chs) > -1
  73. "
  74. >
  75. <span class="NNPE-words-box">
  76. <span
  77. v-if="item.isHasPY > 0 && pyPosition == 'top'"
  78. class="NNPE-pinyin"
  79. :class="[
  80. pItem.className ? pItem.className : '',
  81. pItem.pinyin && noFont.indexOf(pItem.pinyin) > -1
  82. ? 'noFont'
  83. : '',
  84. ]"
  85. >{{ pItem.pinyin | handlePY }}</span
  86. >
  87. <template v-if="!pItem.isHeng">
  88. <span
  89. class="NNPE-chs"
  90. :class="[
  91. item.timeList.length > 0 &&
  92. curTime >=
  93. item.timeList[pItem.sentIndex]
  94. .wordsResultList[pItem.wordIndex].wordBg &&
  95. curTime <= item.timeList[pItem.sentIndex].ed
  96. ? 'wordActive'
  97. : '',
  98. pItem.config.underLine
  99. ? 'NNPE-chs-underline'
  100. : '',
  101. ]"
  102. >{{ pItem.chs }}</span
  103. >
  104. </template>
  105. <template v-else>
  106. <template v-if="judgeAnswer == 'standardAnswer'">
  107. <EditDiv
  108. :id="
  109. 'dialogue_' +
  110. Math.random().toString(36).substr(2) +
  111. '_' +
  112. pItem.hengIndex
  113. "
  114. class="answer-input userRight"
  115. v-model="curQue.answerArr[pItem.hengIndex - 1]"
  116. :canEdit="false"
  117. />
  118. </template>
  119. <template v-else>
  120. <EditDiv
  121. :id="
  122. 'dialogue_' +
  123. Math.random().toString(36).substr(2) +
  124. '_' +
  125. pItem.hengIndex
  126. "
  127. class="answer-input"
  128. :class="[
  129. curQue.answerArr &&
  130. curQue.answerArr[pItem.hengIndex - 1] &&
  131. curQue.answerArr[pItem.hengIndex - 1] ==
  132. Bookanswer.input[pItem.hengIndex - 1].value
  133. ? 'userRight'
  134. : curQue.answerArr &&
  135. curQue.answerArr[pItem.hengIndex - 1] &&
  136. curQue.answerArr[pItem.hengIndex - 1] !=
  137. Bookanswer.input[pItem.hengIndex - 1]
  138. .value
  139. ? 'userError'
  140. : '',
  141. ]"
  142. v-model="
  143. Bookanswer.input[pItem.hengIndex - 1].value
  144. "
  145. :canEdit="
  146. TaskModel == 'ANSWER' || judgeAnswer
  147. ? false
  148. : true
  149. "
  150. :hengIndex="pItem.hengIndex - 1"
  151. @saveBlankTF="saveBlankTF"
  152. />
  153. </template>
  154. </template>
  155. <span
  156. v-if="item.isHasPY > 0 && pyPosition == 'bottom'"
  157. class="NNPE-pinyin"
  158. :class="[
  159. pItem.className ? pItem.className : '',
  160. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  161. ]"
  162. >{{ pItem.pinyin | handlePY }}</span
  163. >
  164. </span>
  165. <span
  166. class="NNPE-words-box"
  167. v-if="item.wordsList[pIndex + 1]"
  168. >
  169. <span
  170. v-if="item.isHasPY > 0 && pyPosition == 'top'"
  171. class="NNPE-pinyin"
  172. :class="[
  173. noFont.indexOf(
  174. item.wordsList[pIndex + 1].pinyin
  175. ) > -1
  176. ? 'noFont'
  177. : '',
  178. ]"
  179. style="text-align: left"
  180. >{{
  181. item.wordsList[pIndex + 1].pinyin | handlePY
  182. }}</span
  183. >
  184. <span
  185. class="NNPE-chs"
  186. style="text-align: left"
  187. :class="[
  188. item.timeList.length > 0 &&
  189. curTime >=
  190. item.timeList[pItem.sentIndex].wordsResultList[
  191. pItem.wordIndex
  192. ].wordBg &&
  193. curTime <= item.timeList[pItem.sentIndex].ed
  194. ? 'wordActive'
  195. : '',
  196. ]"
  197. >{{ item.wordsList[pIndex + 1].chs }}</span
  198. >
  199. <span
  200. v-if="item.isHasPY > 0 && pyPosition == 'bottom'"
  201. class="NNPE-pinyin"
  202. :class="[
  203. noFont.indexOf(
  204. item.wordsList[pIndex + 1].pinyin
  205. ) > -1
  206. ? 'noFont'
  207. : '',
  208. ]"
  209. style="text-align: left"
  210. >{{
  211. item.wordsList[pIndex + 1].pinyin | handlePY
  212. }}</span
  213. >
  214. </span>
  215. <span
  216. class="NNPE-words-box"
  217. v-if="
  218. item.wordsList[pIndex + 2] &&
  219. item.wordsList[pIndex + 2].chs &&
  220. chsFhList.indexOf(item.wordsList[pIndex + 2].chs) >
  221. -1
  222. "
  223. >
  224. <span
  225. v-if="
  226. item.isHasPY > 0 &&
  227. curQue.pyPosition == 'top' &&
  228. config.isShowPY
  229. "
  230. :class="[
  231. 'NNPE-pinyin',
  232. noFont.indexOf(
  233. item.wordsList[pIndex + 2].pinyin
  234. ) > -1
  235. ? 'noFont'
  236. : '',
  237. ]"
  238. style="text-align: left"
  239. >{{ item.wordsList[pIndex + 2].pinyin }}</span
  240. >
  241. <span
  242. class="NNPE-chs"
  243. style="text-align: left"
  244. :class="[
  245. isPlaying &&
  246. item.timeList &&
  247. item.timeList[pItem.sentIndex] &&
  248. curTime >= item.timeList[pItem.sentIndex].bg &&
  249. curTime <= item.timeList[pItem.sentIndex].ed
  250. ? 'active'
  251. : '',
  252. pItem.chstimeList &&
  253. pItem.chstimeList[pItem.leg - 1] &&
  254. curTime >=
  255. pItem.chstimeList[pItem.leg - 1].wordBg &&
  256. curQue.wordTime &&
  257. curTime <= item.timeList[pItem.sentIndex].ed
  258. ? 'wordActive'
  259. : '',
  260. ]"
  261. >{{ item.wordsList[pIndex + 2].chs }}</span
  262. >
  263. <span
  264. v-if="
  265. item.isHasPY > 0 &&
  266. curQue.pyPosition == 'bottom' &&
  267. config.isShowPY
  268. "
  269. :class="[
  270. 'NNPE-pinyin',
  271. noFont.indexOf(
  272. item.wordsList[pIndex + 2].pinyin
  273. ) > -1
  274. ? 'noFont'
  275. : '',
  276. ]"
  277. style="text-align: left"
  278. >{{ item.wordsList[pIndex + 2].pinyin }}</span
  279. >
  280. </span>
  281. </template>
  282. <!--下一个元素不是标点-->
  283. <template v-else>
  284. <span
  285. v-if="item.isHasPY > 0 && pyPosition == 'top'"
  286. class="NNPE-pinyin"
  287. :class="[
  288. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  289. pItem.className ? pItem.className : '',
  290. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  291. ]"
  292. >{{ pItem.pinyin | handlePY }}</span
  293. >
  294. <template v-if="!pItem.isHeng">
  295. <span
  296. v-if="pItem.chs != '#'"
  297. class="NNPE-chs"
  298. :class="[
  299. item.timeList.length > 0 &&
  300. curTime >=
  301. item.timeList[pItem.sentIndex].wordsResultList[
  302. pItem.wordIndex
  303. ].wordBg &&
  304. curTime <= item.timeList[pItem.sentIndex].ed
  305. ? 'wordActive'
  306. : '',
  307. pItem.chs != '“' && pItem.padding
  308. ? 'padding'
  309. : '',
  310. pItem.config.underLine
  311. ? 'NNPE-chs-underline'
  312. : '',
  313. ]"
  314. >{{ pItem.chs }}</span
  315. >
  316. </template>
  317. <template v-else>
  318. <template v-if="judgeAnswer == 'standardAnswer'">
  319. <EditDiv
  320. :id="
  321. 'dialogue_' +
  322. Math.random().toString(36).substr(2) +
  323. '_' +
  324. pItem.hengIndex
  325. "
  326. class="answer-input userRight"
  327. v-model="curQue.answerArr[pItem.hengIndex - 1]"
  328. :canEdit="false"
  329. />
  330. </template>
  331. <template v-else>
  332. <EditDiv
  333. :id="
  334. 'dialogue_' +
  335. Math.random().toString(36).substr(2) +
  336. '_' +
  337. pItem.hengIndex
  338. "
  339. class="answer-input"
  340. :class="[
  341. curQue.answerArr &&
  342. curQue.answerArr[pItem.hengIndex - 1] &&
  343. curQue.answerArr[pItem.hengIndex - 1] ==
  344. Bookanswer.input[pItem.hengIndex - 1].value
  345. ? 'userRight'
  346. : curQue.answerArr &&
  347. curQue.answerArr[pItem.hengIndex - 1] &&
  348. curQue.answerArr[pItem.hengIndex - 1] !=
  349. Bookanswer.input[pItem.hengIndex - 1]
  350. .value
  351. ? 'userError'
  352. : '',
  353. ]"
  354. v-model="
  355. Bookanswer.input[pItem.hengIndex - 1].value
  356. "
  357. :canEdit="
  358. TaskModel == 'ANSWER' || judgeAnswer
  359. ? false
  360. : true
  361. "
  362. :hengIndex="pItem.hengIndex - 1"
  363. @saveBlankTF="saveBlankTF"
  364. />
  365. </template>
  366. </template>
  367. <span
  368. v-if="item.isHasPY > 0 && pyPosition == 'bottom'"
  369. class="NNPE-pinyin"
  370. :class="[
  371. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  372. pItem.className ? pItem.className : '',
  373. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  374. ]"
  375. >{{ pItem.pinyin | handlePY }}</span
  376. >
  377. </template>
  378. </template>
  379. </template>
  380. <template v-else>
  381. <span
  382. :style="{
  383. height: pItem.height + 'px',
  384. width: pItem.width + 'px',
  385. }"
  386. ></span>
  387. </template>
  388. </div>
  389. <div v-if="item.enwords" class="enwords">
  390. {{ item.enwords }}
  391. </div>
  392. </div>
  393. <div class="clearFix"></div>
  394. <div class="answer-box">
  395. <div class="input-record" v-if="item.isRecord">
  396. <Soundrecord
  397. type="normal"
  398. class="normal-box"
  399. :TaskModel="TaskModel"
  400. :answerRecordList="Bookanswer.recordList[index]"
  401. :tmIndex="index"
  402. @handleWav="handleWav"
  403. />
  404. </div>
  405. <template
  406. class="input-record"
  407. v-if="
  408. curQue.checkList && curQue.checkList.indexOf('judge') > -1
  409. "
  410. >
  411. <div class="judge-box" v-if="curQue.judge[index].isJudge">
  412. <a
  413. :class="[
  414. 'right-btn',
  415. TaskModel != 'ANSWER' ? 'right-btn-hover' : '',
  416. judgeAnswerClass('right', index),
  417. ]"
  418. @click="handleSelectJudge('right', index)"
  419. >
  420. </a>
  421. <a
  422. :class="[
  423. 'error-btn',
  424. TaskModel != 'ANSWER' ? 'error-btn-hover' : '',
  425. judgeAnswerClass('error', index),
  426. ]"
  427. @click="handleSelectJudge('error', index)"
  428. >
  429. </a>
  430. </div>
  431. </template>
  432. </div>
  433. </div>
  434. </div>
  435. <div
  436. class="remarkBox remark-top"
  437. v-if="
  438. item.remarkDetail &&
  439. (item.remarkDetail.chs || item.remarkDetail.en)
  440. "
  441. >
  442. <RemarkChs :remarkDetail="item.remarkDetail" />
  443. </div>
  444. </div>
  445. <!-- <div class="dia-article-record">
  446. <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
  447. </div> -->
  448. </div>
  449. </template>
  450. <template v-if="paraArr.length > 0">
  451. <div class="NPC-sentences-list">
  452. <p class="notice" v-if="curQue.notice">{{ curQue.notice }}</p>
  453. <div
  454. :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
  455. v-for="(item, index) in paraArr"
  456. :key="'detail' + index"
  457. >
  458. <div :class="['article-content', isHasRemark ? 'hasRemark' : '']">
  459. <RoleChs :curRole="item.roleDetail" :type="1" />
  460. <div class="wordsList-box">
  461. <div
  462. class="roleDetail"
  463. v-if="item.roleDetail.detail.wordsList.length > 0"
  464. >
  465. <span class="pinyin">{{
  466. item.roleDetail.detail.wordsList | handlePinyin
  467. }}</span>
  468. <span class="chs">{{
  469. item.roleDetail.detail.wordsList | handleChs
  470. }}</span>
  471. </div>
  472. <div
  473. class="para-con"
  474. :style="{ background: item.roleDetail.color.bg }"
  475. >
  476. <div
  477. class="NNPE-words"
  478. v-for="(pItem, pIndex) in item.wordsList"
  479. :key="'wordsList' + pIndex"
  480. >
  481. <template v-if="!pItem.isHeng">
  482. <span class="NNPE-para-pinyin padding">{{
  483. pItem.con
  484. }}</span>
  485. </template>
  486. <template v-else>
  487. <template v-if="judgeAnswer == 'standardAnswer'">
  488. <EditDiv
  489. :id="
  490. 'dialogue_' +
  491. Math.random().toString(36).substr(2) +
  492. '_' +
  493. pItem.hengIndex
  494. "
  495. class="answer-input userRight"
  496. v-model="curQue.answerArr[pItem.hengIndex - 1]"
  497. :canEdit="false"
  498. />
  499. </template>
  500. <template v-else>
  501. <EditDiv
  502. :id="
  503. 'dialogue_' +
  504. Math.random().toString(36).substr(2) +
  505. '_' +
  506. pItem.hengIndex
  507. "
  508. class="answer-input"
  509. :class="[
  510. curQue.answerArr &&
  511. curQue.answerArr[pItem.hengIndex - 1] &&
  512. curQue.answerArr[pItem.hengIndex - 1] ==
  513. Bookanswer.input[pItem.hengIndex - 1].value
  514. ? 'userRight'
  515. : curQue.answerArr &&
  516. curQue.answerArr[pItem.hengIndex - 1] &&
  517. curQue.answerArr[pItem.hengIndex - 1] !=
  518. Bookanswer.input[pItem.hengIndex - 1].value
  519. ? 'userError'
  520. : '',
  521. ]"
  522. v-model="Bookanswer.input[pItem.hengIndex - 1].value"
  523. :canEdit="
  524. TaskModel == 'ANSWER' || judgeAnswer ? false : true
  525. "
  526. :hengIndex="pItem.hengIndex - 1"
  527. @saveBlankTF="saveBlankTF"
  528. />
  529. </template>
  530. </template>
  531. </div>
  532. <div v-if="item.enwords" class="enwords">
  533. {{ item.enwords }}
  534. </div>
  535. </div>
  536. <div class="clearFix"></div>
  537. <div class="answer-box">
  538. <div class="input-record" v-if="item.isRecord">
  539. <Soundrecord
  540. type="normal"
  541. class="normal-box"
  542. :TaskModel="TaskModel"
  543. :answerRecordList="Bookanswer.recordList[index]"
  544. :tmIndex="index"
  545. @handleWav="handleWav"
  546. />
  547. </div>
  548. <template
  549. class="input-record"
  550. v-if="
  551. curQue.checkList && curQue.checkList.indexOf('judge') > -1
  552. "
  553. >
  554. <div class="judge-box" v-if="curQue.judge[index].isJudge">
  555. <a
  556. :class="[
  557. 'right-btn',
  558. TaskModel != 'ANSWER' ? 'right-btn-hover' : '',
  559. judgeAnswerClass('right', index),
  560. ]"
  561. @click="handleSelectJudge('right', index)"
  562. >
  563. </a>
  564. <a
  565. :class="[
  566. 'error-btn',
  567. TaskModel != 'ANSWER' ? 'error-btn-hover' : '',
  568. judgeAnswerClass('error', index),
  569. ]"
  570. @click="handleSelectJudge('error', index)"
  571. >
  572. </a>
  573. </div>
  574. </template>
  575. </div>
  576. </div>
  577. </div>
  578. <div
  579. class="remarkBox remark-top"
  580. v-if="
  581. item.remarkDetail &&
  582. (item.remarkDetail.chs || item.remarkDetail.en)
  583. "
  584. >
  585. <RemarkChs :remarkDetail="item.remarkDetail" />
  586. </div>
  587. </div>
  588. <!-- <div class="dia-article-record">
  589. <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
  590. </div> -->
  591. </div>
  592. </template>
  593. </div>
  594. </template>
  595. <script>
  596. import { timeStrToSen } from "../../../../utils/index";
  597. import AudioLine from "../AudioLine.vue";
  598. import RoleChs from "./RoleChs.vue";
  599. import RemarkChs from "./RemarkChs.vue";
  600. import Soundrecord from "../Soundrecord.vue";
  601. import EditDiv from "../EditDiv.vue";
  602. export default {
  603. name: "DialogueNormalModelChs",
  604. props: [
  605. "curQue",
  606. "pyPosition",
  607. "colorBox",
  608. "listIndex",
  609. "Bookanswer",
  610. "TaskModel",
  611. "judgeAnswer",
  612. ],
  613. components: {
  614. AudioLine,
  615. RoleChs,
  616. RemarkChs,
  617. Soundrecord,
  618. EditDiv,
  619. },
  620. filters: {
  621. handlePinyin(wordsList) {
  622. let str = "";
  623. wordsList.forEach((item, index) => {
  624. if (index < wordsList.length - 1) {
  625. str += item.pinyin + " ";
  626. } else {
  627. str += item.pinyin;
  628. }
  629. });
  630. return str;
  631. },
  632. handleChs(wordsList) {
  633. let str = "";
  634. wordsList.forEach((item, index) => {
  635. if (index < wordsList.length - 1) {
  636. str += item.chs + " ";
  637. } else {
  638. str += item.chs;
  639. }
  640. });
  641. return str;
  642. },
  643. handlePY(pinyin) {
  644. let reg = /_{2,}/g;
  645. let py = "";
  646. if (!reg.test(pinyin)) {
  647. py = pinyin;
  648. }
  649. return py;
  650. },
  651. },
  652. data() {
  653. return {
  654. resArr: [],
  655. curTime: 0, //单位s
  656. chsFhList: [",", "。", "”", ":", "》", "《", "?", "!", ";"],
  657. enFhList: [",", ".", ";", "?", "!", ":", ">", "<"],
  658. newWords: ["鱼", "辩礼义"],
  659. noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "/", "_"],
  660. oldHz: "",
  661. hz: "",
  662. top: 0,
  663. left: 0,
  664. articleImg: {}, // 文章图片
  665. isHasRemark: false,
  666. paraArr: [],
  667. answer: [],
  668. hengIndex: 0,
  669. };
  670. },
  671. computed: {
  672. judgeAnswerClass() {
  673. return function (type, index) {
  674. let _this = this;
  675. let classname = "";
  676. let answer = _this.Bookanswer.judge[index].value;
  677. let correct = _this.curQue.judge[index].judge;
  678. if (_this.judgeAnswer == "standardAnswer") {
  679. if (correct == type) {
  680. classname = "userRight_" + type;
  681. }
  682. } else if (
  683. _this.judgeAnswer == "studentAnswer" ||
  684. _this.judgeAnswer == "userAnswer"
  685. ) {
  686. if (answer == type) {
  687. if (correct) {
  688. if (answer == correct) {
  689. classname = "userRight_" + type;
  690. } else {
  691. classname = "userError_" + type;
  692. }
  693. } else {
  694. classname = "active";
  695. }
  696. }
  697. } else {
  698. if (answer == type) {
  699. classname = "active";
  700. }
  701. }
  702. return classname;
  703. };
  704. },
  705. },
  706. watch: {},
  707. //方法集合
  708. methods: {
  709. // 判断题选择
  710. handleSelectJudge(obj, index) {
  711. let _this = this;
  712. if (_this.TaskModel != "ANSWER" || !judgeAnswer) {
  713. _this.$set(_this.Bookanswer.judge[index], "value", obj);
  714. let correct = _this.curQue.judge[index].judge;
  715. if (correct) {
  716. if (correct == obj) {
  717. _this.$set(
  718. _this.Bookanswer.judge[index],
  719. "userAnswerJudge",
  720. "[JUDGE##T##JUDGE]"
  721. );
  722. } else {
  723. _this.$set(
  724. _this.Bookanswer.judge[index],
  725. "userAnswerJudge",
  726. "[JUDGE##F##JUDGE]"
  727. );
  728. }
  729. }
  730. }
  731. _this.$forceUpdate();
  732. },
  733. handleWav(list, tmIndex) {
  734. tmIndex = tmIndex ? tmIndex : 0;
  735. this.$set(this.Bookanswer.recordList, tmIndex, list);
  736. },
  737. saveBlankTF(value, hengIndex) {
  738. let _this = this;
  739. let answerArr = this.curQue.answerArr;
  740. if (answerArr.length > 0) {
  741. if (value.trim() == answerArr[hengIndex]) {
  742. _this.$set(
  743. _this.Bookanswer.input[hengIndex],
  744. "userAnswerJudge",
  745. "[JUDGE##T##JUDGE]"
  746. );
  747. } else {
  748. _this.$set(
  749. _this.Bookanswer.input[hengIndex],
  750. "userAnswerJudge",
  751. "[JUDGE##F##JUDGE]"
  752. );
  753. }
  754. }
  755. },
  756. getCurTime(curTime) {
  757. this.curTime = curTime * 1000;
  758. },
  759. handleData() {
  760. let resArr = [];
  761. let reg = /_{2,}/g;
  762. let leg = this.curQue.detail.length;
  763. let curQue = JSON.parse(JSON.stringify(this.curQue));
  764. this.curQue.answerArr = this.curQue.answer
  765. ? this.curQue.answer.split("\n")
  766. : [];
  767. let hengIndex = 0;
  768. curQue.detail.forEach((dItem, dIndex) => {
  769. let isHasPY = 0;
  770. let isRecord = 0;
  771. let roleDetail = this.getRole(dItem);
  772. let remarkDetail = dItem.remark;
  773. if (remarkDetail && (remarkDetail.chs || remarkDetail.en)) {
  774. this.isHasRemark = true;
  775. }
  776. let paraArr = [];
  777. if (dItem.wordsList && dItem.wordsList.length > 0) {
  778. dItem.wordsList.forEach((sItem, sIndex) => {
  779. sItem.forEach((wItem, wIndex) => {
  780. this.mergeWordSymbol(wItem);
  781. if (wItem.pinyin) {
  782. isHasPY++;
  783. }
  784. let obj = {
  785. paraIndex: dIndex, //段落索引
  786. sentIndex: sIndex, //在段落中句子索引
  787. wordIndex: wIndex, //单词的索引
  788. pinyin: wItem.pinyin,
  789. chs: wItem.chs,
  790. isHeng: reg.test(wItem.chs),
  791. padding: true, //wItem.padding,
  792. className: wItem.className,
  793. isShow: wItem.isShow,
  794. isNewWord: this.newWords.indexOf(wItem.chs) > -1 ? true : false,
  795. config: {
  796. fontColor: wItem.fontColor,
  797. fontFamily: wItem.fontFamily,
  798. fontSize: wItem.fontSize,
  799. underLine: wItem.underLine,
  800. wordPadding: wItem.wordPadding,
  801. },
  802. };
  803. if (obj.isHeng) {
  804. isRecord = isRecord + 1;
  805. hengIndex = hengIndex + 1;
  806. obj.hengIndex = hengIndex;
  807. obj.answer = "";
  808. }
  809. paraArr.push(obj);
  810. });
  811. });
  812. let curSentencesLeg = dItem.sentences.length;
  813. let startLeg = dIndex == 0 ? 0 : curQue.detail[dIndex - 1].endLeg;
  814. let endLeg = startLeg + curSentencesLeg;
  815. dItem.endLeg = endLeg;
  816. let timeList = [];
  817. if (curQue.wordTime && curQue.wordTime.length > 0) {
  818. timeList = curQue.wordTime.slice(startLeg, endLeg);
  819. }
  820. let enwords =
  821. dItem.sentencesEn && dItem.sentencesEn.length > 0
  822. ? dItem.sentencesEn.join(" ")
  823. : "";
  824. let paraObj = {
  825. wordsList: paraArr,
  826. enwords: enwords,
  827. timeList: timeList,
  828. roleDetail: roleDetail,
  829. remarkDetail: remarkDetail,
  830. isRecord:
  831. isRecord > 0 ||
  832. (curQue.checkList && curQue.checkList.indexOf("record") > -1)
  833. ? true
  834. : false,
  835. isHasPY: isHasPY,
  836. };
  837. resArr.push(paraObj);
  838. }
  839. });
  840. this.resArr = resArr;
  841. console.log(resArr);
  842. // 循环文章图片
  843. if (curQue.img_list) {
  844. curQue.img_list.forEach((item) => {
  845. this.articleImg[item.imgNumber] = item.id;
  846. });
  847. }
  848. },
  849. handlePYData() {
  850. let pararArr = [];
  851. let curQue = JSON.parse(JSON.stringify(this.curQue));
  852. this.hengIndex = 0;
  853. curQue.detail.forEach((dItem, dIndex) => {
  854. let para = dItem.para;
  855. let paraObj = this.handlePara(para);
  856. let roleDetail = this.getRole(dItem);
  857. let remarkDetail = dItem.remark;
  858. if (remarkDetail && (remarkDetail.chs || remarkDetail.en)) {
  859. this.isHasRemark = true;
  860. }
  861. let obj = {
  862. wordsList: paraObj.wordsList,
  863. roleDetail: roleDetail,
  864. remarkDetail: remarkDetail,
  865. isRecord: paraObj.isRecord,
  866. };
  867. pararArr.push(obj);
  868. });
  869. this.paraArr = pararArr;
  870. },
  871. //词和标点合一起
  872. mergeWordSymbol(wItem) {
  873. if (this.chsFhList.indexOf(wItem.chs) > -1) {
  874. wItem.isShow = false;
  875. } else {
  876. wItem.isShow = true;
  877. }
  878. },
  879. //获取角色
  880. getRole(dItem) {
  881. let roleIndex = dItem.roleIndex;
  882. let resObj = null;
  883. let roleList = JSON.parse(JSON.stringify(this.curQue.roleList));
  884. for (let i = 0; i < roleList.length; i++) {
  885. let item = roleList[i];
  886. if (item.id == roleIndex) {
  887. resObj = item;
  888. resObj.color = this.colorBox[i];
  889. break;
  890. }
  891. }
  892. return resObj;
  893. },
  894. //判断是否有padding
  895. judgePad(sItem, wItem, curIndex) {
  896. let leg = sItem.length;
  897. if (curIndex < leg - 1) {
  898. let nextIndex = curIndex + 1;
  899. let chs = sItem[nextIndex].chs;
  900. if (
  901. this.chsFhList.indexOf(chs) > -1 ||
  902. this.chsFhList.indexOf(wItem.chs) > -1
  903. ) {
  904. wItem.padding = false;
  905. } else {
  906. wItem.padding = true;
  907. }
  908. if (this.enFhList.indexOf(wItem.pinyin) > -1) {
  909. wItem.className = "textLeft";
  910. }
  911. }
  912. },
  913. //转化时间
  914. handleTimeList(list) {
  915. let listRes = [];
  916. list.forEach((item) => {
  917. let res = timeStrToSen(item);
  918. listRes.push(res);
  919. });
  920. return listRes;
  921. },
  922. //点击播放某个句子
  923. handleChangeTime(time) {
  924. this.curTime = time;
  925. this.$refs.audioLine.onTimeupdateTime(time / 1000);
  926. },
  927. //处理数组
  928. handlePara(para) {
  929. para = para.trim();
  930. para = para.replace(/\s+/g, " ");
  931. para = para.replace(/_{2,}/g, "^ ");
  932. let paraArr = para.split(/\s/g);
  933. let resArr = [];
  934. paraArr.forEach((item, index) => {
  935. let obj = {
  936. isHeng: false,
  937. con: item,
  938. };
  939. if (item == "^") {
  940. obj.isHeng = true;
  941. obj.answer = "";
  942. this.hengIndex++;
  943. obj.hengIndex = this.hengIndex;
  944. }
  945. resArr.push(obj);
  946. });
  947. let isRecord = /^/g.test(para);
  948. return { wordsList: resArr, isRecord: isRecord };
  949. },
  950. },
  951. //生命周期 - 创建完成(可以访问当前this实例)
  952. created() {},
  953. //生命周期 - 挂载完成(可以访问DOM元素)
  954. mounted() {
  955. if (this.curQue) {
  956. if (this.curQue.font == "cn" || !this.curQue.font) {
  957. this.handleData();
  958. } else {
  959. this.handlePYData();
  960. }
  961. }
  962. },
  963. beforeCreate() {}, //生命周期 - 创建之前
  964. beforeMount() {}, //生命周期 - 挂载之前
  965. beforeUpdate() {}, //生命周期 - 更新之前
  966. updated() {}, //生命周期 - 更新之后
  967. beforeDestroy() {}, //生命周期 - 销毁之前
  968. destroyed() {}, //生命周期 - 销毁完成
  969. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  970. };
  971. </script>
  972. <style lang='scss' scoped>
  973. //@import url(); 引入公共css类
  974. .NNPE-ArticleView {
  975. width: 100%;
  976. .clearFix {
  977. clear: both;
  978. overflow: hidden;
  979. }
  980. .NPC-sentences-list {
  981. .NPC-article-empty {
  982. display: flex;
  983. justify-content: flex-start;
  984. align-items: flex-start;
  985. > div {
  986. height: 24px;
  987. &.empty-left {
  988. width: 100%;
  989. box-sizing: border-box;
  990. &.hasRemark {
  991. width: 553px;
  992. box-sizing: border-box;
  993. border-right: 1px rgba(0, 0, 0, 0.1) solid;
  994. }
  995. }
  996. &.empty-right {
  997. flex: 1;
  998. }
  999. }
  1000. &-bottom {
  1001. > div {
  1002. height: 40px;
  1003. }
  1004. }
  1005. }
  1006. .dia-article-record {
  1007. width: 100%;
  1008. border-top: 1px solid rgba(0, 0, 0, 0.1);
  1009. .luyin-box {
  1010. justify-content: start;
  1011. padding: 8px 12px;
  1012. height: 40px;
  1013. width: 280px;
  1014. justify-content: flex-start;
  1015. }
  1016. }
  1017. }
  1018. .NNPE-detail {
  1019. clear: both;
  1020. overflow: hidden;
  1021. display: flex;
  1022. justify-content: flex-start;
  1023. align-items: flex-start;
  1024. &.active {
  1025. background: rgba(0, 0, 0, 0.06);
  1026. }
  1027. .article-content {
  1028. width: 100%;
  1029. box-sizing: border-box;
  1030. padding: 8px 24px 8px 24px;
  1031. display: flex;
  1032. justify-content: flex-start;
  1033. align-items: flex-start;
  1034. &.hasRemark {
  1035. width: 553px;
  1036. border-right: 1px rgba(0, 0, 0, 0.1) solid;
  1037. padding: 8px 0px 8px 23px;
  1038. }
  1039. &.paraLast {
  1040. padding-bottom: 24px;
  1041. }
  1042. }
  1043. .NNPE-words {
  1044. float: left;
  1045. &-box {
  1046. float: left;
  1047. > span {
  1048. display: block;
  1049. &.NNPE-pinyin {
  1050. font-family: "GB-PINYINOK-B";
  1051. font-weight: normal;
  1052. font-size: 14px;
  1053. line-height: 22px;
  1054. color: #000000;
  1055. height: 21px;
  1056. &.noFont {
  1057. font-family: initial;
  1058. }
  1059. &.textLeft {
  1060. text-align: left;
  1061. }
  1062. }
  1063. &.NNPE-chs {
  1064. font-family: "FZJCGFKTK";
  1065. font-size: 20px;
  1066. line-height: 28px;
  1067. color: #000000;
  1068. &.active {
  1069. background: rgba(60, 200, 99, 0.2);
  1070. }
  1071. &.wordActive {
  1072. color: #de4444;
  1073. }
  1074. &.NNPE-chs-underline {
  1075. text-decoration: underline;
  1076. }
  1077. }
  1078. &.padding {
  1079. padding: 0 3px;
  1080. }
  1081. }
  1082. }
  1083. &.textLeft {
  1084. text-align: left;
  1085. }
  1086. &.textCenter {
  1087. text-align: center;
  1088. }
  1089. &.textRight {
  1090. text-align: right;
  1091. }
  1092. > span {
  1093. display: block;
  1094. &.NNPE-pinyin {
  1095. font-family: "GB-PINYINOK-B";
  1096. font-weight: normal;
  1097. font-size: 14px;
  1098. line-height: 22px;
  1099. color: #000000;
  1100. height: 21px;
  1101. &.noFont {
  1102. font-family: initial;
  1103. }
  1104. &.textLeft {
  1105. text-align: left;
  1106. }
  1107. }
  1108. &.NNPE-chs {
  1109. font-family: "FZJCGFKTK";
  1110. font-size: 20px;
  1111. line-height: 28px;
  1112. color: #000000;
  1113. &.active {
  1114. background: rgba(60, 200, 99, 0.2);
  1115. }
  1116. &.wordActive {
  1117. color: #de4444;
  1118. }
  1119. &.NNPE-chs-underline {
  1120. text-decoration: underline;
  1121. }
  1122. }
  1123. &.padding {
  1124. padding: 0 3px;
  1125. }
  1126. }
  1127. .answer-input {
  1128. min-height: 28px;
  1129. box-sizing: border-box;
  1130. border: 0;
  1131. border-bottom: 1px #000 solid;
  1132. background: 0 0;
  1133. min-width: 100px;
  1134. outline: 0;
  1135. text-align: left;
  1136. font-family: "FZJCGFKTK";
  1137. font-size: 20px;
  1138. padding: 0 10px;
  1139. box-sizing: border-box;
  1140. color: #000000;
  1141. line-height: 26px;
  1142. }
  1143. }
  1144. .enwords {
  1145. font-family: "robot";
  1146. font-weight: normal;
  1147. font-size: 14px;
  1148. line-height: 22px;
  1149. color: rgba(0, 0, 0, 0.85);
  1150. }
  1151. &.NNPE-detail-title {
  1152. .wordsList-box {
  1153. > div {
  1154. display: flex;
  1155. justify-content: center;
  1156. }
  1157. }
  1158. }
  1159. .index {
  1160. width: 48px;
  1161. box-sizing: border-box;
  1162. padding: 8px;
  1163. text-align: right;
  1164. border-right: 1px solid rgba(0, 0, 0, 0.1);
  1165. b {
  1166. font-weight: 400;
  1167. color: #000000;
  1168. line-height: 1.5;
  1169. }
  1170. }
  1171. .wordsList-box {
  1172. width: 100%;
  1173. padding: 0px 24px 0px 8px;
  1174. clear: both;
  1175. overflow: hidden;
  1176. .roleDetail {
  1177. height: 36px;
  1178. display: flex;
  1179. justify-content: flex-start;
  1180. align-items: center;
  1181. .pinyin {
  1182. font-family: "GB-PINYINOK-B";
  1183. font-size: 14px;
  1184. line-height: 22px;
  1185. color: rgba(0, 0, 0, 0.85);
  1186. margin-right: 4px;
  1187. }
  1188. .chs {
  1189. font-family: "FZJCGFKTK";
  1190. font-size: 16px;
  1191. line-height: 24px;
  1192. color: rgba(0, 0, 0, 0.85);
  1193. }
  1194. }
  1195. > .para-con {
  1196. float: left;
  1197. border: 1px solid rgba(0, 0, 0, 0.1);
  1198. box-sizing: border-box;
  1199. padding: 8px 12px 8px 12px;
  1200. border-radius: 8px;
  1201. }
  1202. > img {
  1203. width: 100%;
  1204. display: block;
  1205. }
  1206. .input-record {
  1207. margin-right: 8px;
  1208. .mini-box {
  1209. width: 64px;
  1210. border: 1px solid rgba(0, 0, 0, 0.1);
  1211. border-radius: 8px;
  1212. padding: 0 12px;
  1213. }
  1214. .normal-box {
  1215. width: 129px;
  1216. border: 1px solid rgba(0, 0, 0, 0.1);
  1217. border-radius: 8px;
  1218. padding: 0 12px;
  1219. }
  1220. }
  1221. }
  1222. }
  1223. .remarkBox {
  1224. flex: 1;
  1225. display: flex;
  1226. align-items: center;
  1227. justify-content: center;
  1228. &.remark72 {
  1229. padding-top: 72px;
  1230. }
  1231. &.remark-top {
  1232. padding-top: 44px;
  1233. }
  1234. }
  1235. .NNPE-para-pinyin {
  1236. font-weight: normal;
  1237. font-size: 20px;
  1238. line-height: 28px;
  1239. color: #000000;
  1240. height: 28px;
  1241. }
  1242. }
  1243. .NPC-ArticleAnswerView {
  1244. &-userAnswer,
  1245. &-standardAnswer,
  1246. &-studentAnswer {
  1247. .NNPE-detail {
  1248. .NNPE-words {
  1249. .answer-input {
  1250. &.userRight {
  1251. color: #2ca767;
  1252. }
  1253. &.userError {
  1254. color: #ed342d;
  1255. }
  1256. }
  1257. }
  1258. }
  1259. }
  1260. }
  1261. .judge-box {
  1262. display: flex;
  1263. justify-content: center;
  1264. a {
  1265. width: 32px;
  1266. height: 32px;
  1267. background: #fff url("../../../../assets/newImage/common/right-btn.png")
  1268. center no-repeat;
  1269. background-size: 24px;
  1270. border-radius: 8px;
  1271. border: 1px solid rgba(0, 0, 0, 0.1);
  1272. display: flex;
  1273. justify-content: center;
  1274. align-items: center;
  1275. > img {
  1276. width: 24px;
  1277. height: 24px;
  1278. }
  1279. &.right-btn-hover:hover,
  1280. &.active {
  1281. background-color: #e5fff0;
  1282. border-color: #00c850;
  1283. }
  1284. &.error-btn {
  1285. background: #fff url("../../../../assets/newImage/common/error-btn.png")
  1286. center no-repeat;
  1287. background-size: 24px;
  1288. margin-left: 4px;
  1289. &.error-btn-hover:hover,
  1290. &.active {
  1291. background-color: #ffe5e5;
  1292. border-color: #de4444;
  1293. }
  1294. }
  1295. &.userRight_right {
  1296. background-color: rgba(44, 167, 103, 0.1);
  1297. border: 1px solid #2ca767;
  1298. }
  1299. &.userError_right {
  1300. border: 1px solid #ed342d;
  1301. background: rgba(237, 52, 45, 0.1)
  1302. url("../../../../assets/newImage/common/judge-dui.png") center no-repeat;
  1303. background-size: 24px;
  1304. }
  1305. &.userRight_error {
  1306. border: 1px solid #2ca767;
  1307. background: rgba(44, 167, 103, 0.1)
  1308. url("../../../../assets/newImage/common/judge-cuo.png") center no-repeat;
  1309. background-size: 24px;
  1310. }
  1311. &.userError_error {
  1312. background-color: rgba(237, 52, 45, 0.1);
  1313. border: 1px solid #ed342d;
  1314. }
  1315. }
  1316. }
  1317. .answer-box {
  1318. display: flex;
  1319. justify-content: flex-start;
  1320. align-items: center;
  1321. margin-top: 8px;
  1322. }
  1323. </style>