PhraseModelChs.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. <!-- -->
  2. <template>
  3. <div class="NNPE-ArticleView" v-if="curQue">
  4. <div class="aduioLine-box aduioLine-practice" v-if="
  5. curQue.mp3_list &&
  6. curQue.mp3_list.length > 0 &&
  7. curQue.mp3_list[0].id
  8. ">
  9. <div class="aduioLine-content">
  10. <template
  11. v-if="
  12. curQue.mp3_list &&
  13. curQue.mp3_list.length > 0 &&
  14. curQue.mp3_list[0].id
  15. "
  16. >
  17. <AudioLine
  18. audioId="diaPhraAudio"
  19. :mp3="curQue.mp3_list[0].id"
  20. :getCurTime="getCurTime"
  21. :mp3Source="curQue.mp3_list[0].source"
  22. :width="590"
  23. ref="audioLine"
  24. />
  25. </template>
  26. </div>
  27. <div class="aduioLine-right">
  28. <span
  29. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  30. @click="changePinyin"
  31. ></span>
  32. <span
  33. :class="['EN-16', config.isShowEN ? '' : 'disabled']"
  34. @click="changeEN"
  35. ></span>
  36. </div>
  37. </div>
  38. <template v-if="resArr.length > 0">
  39. <div class="NPC-sentences-list">
  40. <div class="NPC-article-empty">
  41. <div :class="['empty-left', isHasRemark ? 'hasRemark' : '']"></div>
  42. <div class="empty-right"></div>
  43. </div>
  44. <p
  45. :class="['notice', isHasRemark ? 'hasRemark' : '']"
  46. v-if="curQue.notice"
  47. >
  48. {{ curQue.notice }}
  49. </p>
  50. <div
  51. :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
  52. v-for="(item, index) in resArr"
  53. :key="'detail' + index"
  54. >
  55. <div :class="['article-content', isHasRemark ? 'hasRemark' : '']">
  56. <RoleChs :curRole="item.roleDetail" :type="1" />
  57. <div class="wordsList-box">
  58. <img
  59. :src="articleImg[index]"
  60. v-if="articleImg[0] && index == 0"
  61. />
  62. <div
  63. class="roleDetail"
  64. v-if="item.roleDetail.detail.wordsList.length > 0"
  65. >
  66. <span class="pinyin">{{
  67. item.roleDetail.detail.wordsList | handlePinyin
  68. }}</span>
  69. <span class="chs">{{
  70. item.roleDetail.detail.wordsList | handleChs
  71. }}</span>
  72. </div>
  73. <div
  74. class="para-con"
  75. :style="{ background: item.roleDetail.color.bg }"
  76. >
  77. <div
  78. class="NNPE-words"
  79. v-for="(pItem, pIndex) in item.wordsList"
  80. :key="'wordsList' + pIndex"
  81. :class="[
  82. pItem.chs != '“' && pItem.wordIndex == 0
  83. ? 'textLeft'
  84. : 'textCenter',
  85. pItem.chs == '“' ? 'textRight' : '',
  86. ]"
  87. @click="showWordDetail($event, pItem.chs)"
  88. >
  89. <template v-if="!pItem.width">
  90. <template v-if="pItem.isShow">
  91. <template
  92. v-if="
  93. item.wordsList[pIndex + 1] &&
  94. item.wordsList[pIndex + 1].chs &&
  95. chsFhList.indexOf(item.wordsList[pIndex + 1].chs) > -1|| item.wordsList[pIndex + 1].chs== '#'
  96. "
  97. >
  98. <span class="NNPE-words-box">
  99. <span
  100. v-if="curQue.pyPosition == 'top' && config.isShowPY && item.dhaspinyin"
  101. class="NNPE-pinyin"
  102. :class="[
  103. pItem.className ? pItem.className : '',
  104. noFont.indexOf(item.pinyin) > -1 ? 'noFont' : '',
  105. ]"
  106. @click.stop="viewNotes($event, pItem.pinyin)"
  107. >{{ pItem.pinyin }}</span
  108. >
  109. <span
  110. class="NNPE-chs"
  111. :class="[
  112. newWordList.indexOf(pItem.chs) > -1
  113. ? 'newActive'
  114. : '',
  115. ]"
  116. >{{ NumberList.indexOf(pItem.pinyin)==-1 ? pItem.chs : '' }}</span
  117. >
  118. <span
  119. v-if="
  120. curQue.pyPosition == 'bottom' && config.isShowPY && item.dhaspinyin
  121. "
  122. class="NNPE-pinyin"
  123. :class="[
  124. pItem.className ? pItem.className : '',
  125. noFont.indexOf(item.pinyin) > -1 ? 'noFont' : '',
  126. ]"
  127. @click.stop="viewNotes($event, pItem.pinyin)"
  128. >{{ pItem.pinyin }}</span
  129. >
  130. </span>
  131. <span class="NNPE-words-box">
  132. <span
  133. v-if="curQue.pyPosition == 'top' && config.isShowPY && item.dhaspinyin"
  134. class="NNPE-pinyin"
  135. style="text-align: left"
  136. :class="[
  137. noFont.indexOf(
  138. item.wordsList[pIndex + 1].pinyin
  139. ) > -1
  140. ? 'noFont'
  141. : '',
  142. ]"
  143. @click.stop="viewNotes($event, item.wordsList[pIndex + 1].pinyin)"
  144. >{{ item.wordsList[pIndex + 1].pinyin }}</span
  145. >
  146. <span class="NNPE-chs" style="text-align: left">{{
  147. NumberList.indexOf(item.wordsList[pIndex + 1].pinyin)==-1 ? item.wordsList[pIndex + 1].chs : ''
  148. }}</span>
  149. <span
  150. v-if="
  151. curQue.pyPosition == 'bottom' && config.isShowPY && item.dhaspinyin
  152. "
  153. class="NNPE-pinyin"
  154. :class="[
  155. noFont.indexOf(
  156. item.wordsList[pIndex + 1].pinyin
  157. ) > -1
  158. ? 'noFont'
  159. : '',
  160. ]"
  161. @click.stop="viewNotes($event, item.wordsList[pIndex + 1].pinyin)"
  162. style="text-align: left"
  163. >{{ item.wordsList[pIndex + 1].pinyin }}</span
  164. >
  165. </span>
  166. <span
  167. class="NNPE-words-box"
  168. v-if="
  169. item.wordsList[pIndex + 2] &&
  170. item.wordsList[pIndex + 2].chs &&
  171. chsFhList.indexOf(item.wordsList[pIndex + 2].chs) >
  172. -1
  173. "
  174. >
  175. <span
  176. v-if="curQue.pyPosition == 'top' && config.isShowPY && item.dhaspinyin"
  177. :class="[
  178. 'NNPE-pinyin',
  179. noFont.indexOf(
  180. item.wordsList[pIndex + 2].pinyin
  181. ) > -1
  182. ? 'noFont'
  183. : '',
  184. ]"
  185. @click.stop="viewNotes($event, item.wordsList[pIndex + 2].pinyin)"
  186. style="text-align: left"
  187. >{{ item.wordsList[pIndex + 2].pinyin }}</span
  188. >
  189. <span
  190. class="NNPE-chs"
  191. style="text-align: left"
  192. :class="[
  193. pItem.chstimeList &&
  194. pItem.chstimeList[pItem.leg - 1] &&
  195. curTime >=
  196. pItem.chstimeList[pItem.leg - 1].wordBg &&
  197. curQue.wordTime &&
  198. curTime <= item.timeList[pItem.sentIndex].ed
  199. ? 'wordActive'
  200. : '',
  201. ]"
  202. >{{ NumberList.indexOf(item.wordsList[pIndex + 2].pinyin)==-1 ? item.wordsList[pIndex + 2].chs : '' }}</span
  203. >
  204. <span
  205. v-if="
  206. curQue.pyPosition == 'bottom' && config.isShowPY && item.dhaspinyin
  207. "
  208. :class="[
  209. 'NNPE-pinyin',
  210. noFont.indexOf(
  211. item.wordsList[pIndex + 2].pinyin
  212. ) > -1
  213. ? 'noFont'
  214. : '',
  215. ]"
  216. @click.stop="viewNotes($event, item.wordsList[pIndex + 2].pinyin)"
  217. style="text-align: left"
  218. >{{ item.wordsList[pIndex + 2].pinyin }}</span
  219. >
  220. </span>
  221. </template>
  222. <template v-else>
  223. <span
  224. v-if="curQue.pyPosition == 'top' && config.isShowPY && item.dhaspinyin"
  225. class="NNPE-pinyin"
  226. :class="[
  227. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  228. pItem.className ? pItem.className : '',
  229. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  230. ]"
  231. @click.stop="viewNotes($event, pItem.pinyin)"
  232. >{{ pItem.pinyin }}</span
  233. >
  234. <span
  235. v-if="pItem.chs != '#'"
  236. class="NNPE-chs"
  237. :class="[
  238. newWordList.indexOf(pItem.chs) > -1
  239. ? 'newActive'
  240. : '',
  241. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  242. ]"
  243. >{{ NumberList.indexOf(pItem.pinyin)==-1 ? pItem.chs : '' }}</span
  244. >
  245. <span
  246. v-if="
  247. curQue.pyPosition == 'bottom' && config.isShowPY && item.dhaspinyin
  248. "
  249. class="NNPE-pinyin"
  250. :class="[
  251. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  252. pItem.className ? pItem.className : '',
  253. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  254. ]"
  255. @click.stop="viewNotes($event, pItem.pinyin)"
  256. >{{ pItem.pinyin }}</span
  257. >
  258. </template>
  259. </template>
  260. </template>
  261. <template v-else>
  262. <span
  263. :style="{
  264. height: pItem.height + 'px',
  265. width: pItem.width + 'px',
  266. }"
  267. ></span>
  268. </template>
  269. </div>
  270. <div style="clear: both; overflow: hidden"></div>
  271. <div v-if="config.isShowEN && item.enwords" class="enwords">
  272. {{ item.enwords }}
  273. </div>
  274. </div>
  275. <img :src="articleImg[index + 1]" v-if="articleImg[index + 1]" />
  276. </div>
  277. </div>
  278. <div class="remarkBox remark-top">
  279. <RemarkChs :remarkDetail="item.remarkDetail" />
  280. </div>
  281. </div>
  282. <div class="NPC-article-empty NPC-article-empty-bottom">
  283. <div :class="['empty-left', isHasRemark ? 'hasRemark' : '']"></div>
  284. <div class="empty-right"></div>
  285. </div>
  286. <div class="dia-article-record" v-if="1 == 2">
  287. <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
  288. </div>
  289. </div>
  290. </template>
  291. <template v-if="isShow">
  292. <div
  293. ref="wordcard"
  294. class="NNPE-wordDetail"
  295. :style="{ top: top + 'px', left: left + 'px' }"
  296. >
  297. <Wordcard
  298. :word="word"
  299. :changeWordCard="changeWordCard"
  300. :themeColor="themeColor"
  301. :currentTreeID="currentTreeID"
  302. :TaskModel="TaskModel"
  303. :writeList="curQue.Bookanswer.writeModel"
  304. @changeCurQue="changeCurQue"
  305. />
  306. </div>
  307. </template>
  308. <template v-if="isNoteShow">
  309. <div
  310. ref="notecard"
  311. class="NNPE-wordDetail"
  312. :style="{ top: top + 'px', left: left + 'px' }"
  313. >
  314. <Notecard :item="curNoteCon" :changeCard="changeCard" />
  315. </div>
  316. </template>
  317. </div>
  318. </template>
  319. <script>
  320. import { timeStrToSen } from "../../../../utils/index";
  321. import AudioLine from "../AudioLine.vue";
  322. import Wordcard from "../components/Wordcard.vue"; // 卡片
  323. import Notecard from "../components/Notecard.vue"; // 注释
  324. import RoleChs from "./RoleChs.vue";
  325. import RemarkChs from "./RemarkChs.vue";
  326. import Soundrecord from "../Soundrecord.vue";
  327. export default {
  328. name: "PhraseModelChs",
  329. props: [
  330. "curQue",
  331. "bodyLeft",
  332. "NNPENewWordList",
  333. "NNPEAnnotationList",
  334. "colorBox",
  335. "themeColor",
  336. "noFont",
  337. "currentTreeID",
  338. "config",
  339. "TaskModel",
  340. ],
  341. components: {
  342. AudioLine,
  343. Wordcard,
  344. RoleChs,
  345. RemarkChs,
  346. Soundrecord,
  347. Notecard,
  348. },
  349. filters: {
  350. handlePinyin(wordsList) {
  351. let str = "";
  352. wordsList.forEach((item, index) => {
  353. if (index < wordsList.length - 1) {
  354. str += item.pinyin + " ";
  355. } else {
  356. str += item.pinyin;
  357. }
  358. });
  359. return str;
  360. },
  361. handleChs(wordsList) {
  362. let str = "";
  363. wordsList.forEach((item, index) => {
  364. if (index < wordsList.length - 1) {
  365. str += item.chs + " ";
  366. } else {
  367. str += item.chs;
  368. }
  369. });
  370. return str;
  371. },
  372. },
  373. data() {
  374. return {
  375. resArr: [],
  376. curTime: 0, //单位s
  377. chsFhList: [",", "。", "”", ":", "》", "《", "?", "!", ";"],
  378. enFhList: [",", ".", ";", "?", "!", ":", ">", "<"],
  379. NumberList: [
  380. "①",
  381. "②",
  382. "③",
  383. "④",
  384. "⑤",
  385. "⑥",
  386. "⑦",
  387. "⑧",
  388. "⑨",
  389. "⑩",
  390. "⑪",
  391. "⑫",
  392. "⑬",
  393. "⑭",
  394. "⑮",
  395. "⑯",
  396. "⑰",
  397. "⑱",
  398. "⑲",
  399. "⑳",
  400. ],
  401. newWords: ["鱼", "辩礼义"],
  402. oldHz: "",
  403. hz: "",
  404. clientY: "",
  405. top: 0,
  406. left: 0,
  407. articleImg: {}, // 文章图片
  408. newWordList: [],
  409. word: null,
  410. isShow: false,
  411. screenHeight: 0,
  412. cardHeight: 0,
  413. isHasRemark: false,
  414. clickType: "",
  415. isNoteShow: false,
  416. noteNum: "",
  417. oldNoteNum: "",
  418. curNoteCon: null,
  419. contentWidth: 732,
  420. };
  421. },
  422. computed: {},
  423. watch: {
  424. hz: {
  425. handler: function (val, oldVal) {
  426. let _this = this;
  427. if (val) {
  428. _this.handleNewWords(val, _this.top, _this.left);
  429. }
  430. },
  431. // 深度观察监听
  432. deep: true,
  433. },
  434. isShow: {
  435. handler: function (val, oldVal) {
  436. let _this = this;
  437. if (val) {
  438. setTimeout(() => {
  439. _this.cardHeight = _this.$refs.wordcard.offsetHeight;
  440. if (_this.screenHeight - _this.clientY > _this.cardHeight) {
  441. _this.top = _this.clientY + 20;
  442. } else {
  443. _this.top = _this.clientY - _this.cardHeight - 30;
  444. }
  445. }, 50);
  446. }
  447. },
  448. // 深度观察监听
  449. deep: true,
  450. },
  451. noteNum: {
  452. handler: function (val, oldVal) {
  453. let _this = this;
  454. if (val) {
  455. _this.handleNote(val);
  456. }
  457. },
  458. // 深度观察监听
  459. deep: true,
  460. },
  461. isNoteShow: {
  462. handler: function (val, oldVal) {
  463. let _this = this;
  464. if (val) {
  465. setTimeout(() => {
  466. _this.cardHeight = _this.$refs.notecard.offsetHeight;
  467. if (_this.screenHeight - _this.clientY > _this.cardHeight) {
  468. _this.top = _this.clientY + 20;
  469. } else {
  470. _this.top = _this.clientY - _this.cardHeight - 30;
  471. }
  472. }, 50);
  473. }
  474. },
  475. // 深度观察监听
  476. deep: true,
  477. },
  478. },
  479. //方法集合
  480. methods: {
  481. //拼音的显示和隐藏
  482. changePinyin() {
  483. if (this.config.isHasPY) {
  484. this.$emit("changeConfig", "isShowPY");
  485. }
  486. },
  487. // 英文的显示和隐藏
  488. changeEN() {
  489. if (this.config.isHasEN) {
  490. this.$emit("changeConfig", "isShowEN");
  491. }
  492. },
  493. handleWav() {},
  494. getCurTime(curTime) {
  495. this.curTime = curTime;
  496. },
  497. handleData() {
  498. let resArr = [];
  499. let leg = this.curQue.detail.length;
  500. let curQue = JSON.parse(JSON.stringify(this.curQue));
  501. let dhaspinyin = false; // 每段是否有拼音
  502. curQue.detail.forEach((dItem, dIndex) => {
  503. dhaspinyin = false
  504. let roleDetail = this.getRole(dItem);
  505. let remarkDetail = dItem.remark;
  506. if (remarkDetail && (remarkDetail.chs || remarkDetail.en)) {
  507. this.isHasRemark = true;
  508. }
  509. let paraArr = [];
  510. dItem.wordsList.forEach((sItem, sIndex) => {
  511. sItem.forEach((wItem, wIndex) => {
  512. //this.judgePad(sItem, wItem, wIndex);
  513. this.mergeWordSymbol(wItem);
  514. let obj = {
  515. paraIndex: dIndex, //段落索引
  516. sentIndex: sIndex, //在段落中句子索引
  517. wordIndex: wIndex, //单词的索引
  518. pinyin: wItem.pinyin,
  519. chs: wItem.chs,
  520. padding: true, //wItem.padding,
  521. className: wItem.className,
  522. isShow: wItem.isShow,
  523. isNewWord: this.newWords.indexOf(wItem.chs) > -1 ? true : false,
  524. };
  525. paraArr.push(obj);
  526. if(wItem.pinyin) dhaspinyin=true
  527. });
  528. });
  529. let enwords =
  530. dItem.sentencesEn && dItem.sentencesEn.length > 0
  531. ? dItem.sentencesEn.join(" ")
  532. : "";
  533. let paraObj = {
  534. wordsList: paraArr,
  535. enwords: enwords,
  536. roleDetail: roleDetail,
  537. remarkDetail: remarkDetail,
  538. dhaspinyin:dhaspinyin
  539. };
  540. resArr.push(paraObj);
  541. });
  542. this.resArr = resArr;
  543. // 循环文章图片
  544. if (curQue.img_list) {
  545. curQue.img_list.forEach((item) => {
  546. this.articleImg[item.imgNumber] = item.id;
  547. });
  548. }
  549. },
  550. //词和标点合一起
  551. mergeWordSymbol(wItem) {
  552. if (this.chsFhList.indexOf(wItem.chs) > -1||this.NumberList.indexOf(wItem.pinyin)>-1) {
  553. wItem.isShow = false;
  554. } else {
  555. wItem.isShow = true;
  556. }
  557. },
  558. //获取角色
  559. getRole(dItem) {
  560. let roleIndex = dItem.roleIndex;
  561. let resObj = null;
  562. let roleList = JSON.parse(JSON.stringify(this.curQue.roleList));
  563. for (let i = 0; i < roleList.length; i++) {
  564. let item = roleList[i];
  565. if (item.id == roleIndex) {
  566. resObj = item;
  567. resObj.color = this.colorBox[i];
  568. break;
  569. }
  570. }
  571. return resObj;
  572. },
  573. //判断是否有padding
  574. judgePad(sItem, wItem, curIndex) {
  575. let leg = sItem.length;
  576. if (curIndex < leg - 1) {
  577. let nextIndex = curIndex + 1;
  578. let chs = sItem[nextIndex].chs;
  579. if (
  580. this.chsFhList.indexOf(chs) > -1 ||
  581. this.chsFhList.indexOf(wItem.chs) > -1
  582. ) {
  583. wItem.padding = false;
  584. } else {
  585. wItem.padding = true;
  586. }
  587. if (this.enFhList.indexOf(wItem.pinyin) > -1) {
  588. wItem.className = "textLeft";
  589. }
  590. }
  591. },
  592. //转化时间
  593. handleTimeList(list) {
  594. let listRes = [];
  595. list.forEach((item) => {
  596. let res = timeStrToSen(item);
  597. listRes.push(res);
  598. });
  599. return listRes;
  600. },
  601. //点击播放某个句子
  602. handleChangeTime(time) {
  603. this.curTime = time;
  604. this.$refs.audioLine.onTimeupdateTime(time);
  605. },
  606. handleNewword() {
  607. let NewWordList = [];
  608. this.NNPENewWordList.forEach((item) => {
  609. item.forEach((wItem) => {
  610. NewWordList.push(wItem.new_word);
  611. });
  612. });
  613. this.newWordList = JSON.parse(JSON.stringify(NewWordList));
  614. },
  615. showWordDetail(e, word) {
  616. let _this = this;
  617. if (this.newWordList.indexOf(word) > -1) {
  618. if (_this.oldHz != word) {
  619. this.isShow = false;
  620. setTimeout(() => {
  621. _this.hz = word;
  622. }, 50);
  623. }
  624. _this.clientY = e.clientY;
  625. let left = e.clientX;
  626. let width = 0;
  627. if (word.length == 1 || word.length == 2) {
  628. width = 304;
  629. } else if (word.length == 3 || word.length == 4) {
  630. width = 432;
  631. } else if (word.length > 3) {
  632. width = 560;
  633. }
  634. if (left - this.bodyLeft > this.contentWidth / 2) {
  635. _this.left = left - width + 10;
  636. } else {
  637. _this.left = left;
  638. }
  639. }
  640. },
  641. hideWordDetail() {
  642. this.isShow = false;
  643. },
  644. changeWordCard(isShow) {
  645. this.isShow = isShow;
  646. this.oldHz = "";
  647. this.hz = "";
  648. },
  649. // 处理分词数据
  650. handleNewWords(val, top, left) {
  651. this.isShow = true;
  652. this.word = null;
  653. for (let i = 0; i < this.NNPENewWordList.length; i++) {
  654. let pItem = this.NNPENewWordList[i];
  655. for (let j = 0; j < pItem.length; j++) {
  656. let item = pItem[j];
  657. if (item.new_word.trim() == val.trim()) {
  658. let wordlist = val.split("");
  659. this.word = { list: wordlist, detail: item, top: top, left: left };
  660. break;
  661. }
  662. }
  663. }
  664. this.oldHz = val;
  665. },
  666. viewNotes(e, noteNum) {
  667. let _this = this;
  668. _this.clickType = "note";
  669. let noteIndex = "";
  670. if (_this.NumberList.indexOf(noteNum) > -1) {
  671. for (let i = 0; i < _this.NumberList.length; i++) {
  672. if (_this.NumberList[i] == noteNum) {
  673. noteIndex = "" + i + "";
  674. break;
  675. }
  676. }
  677. }
  678. this.showNoteDetail(e, noteIndex);
  679. },
  680. showNoteDetail(e, noteNum) {
  681. let _this = this;
  682. if (_this.oldNoteNum != noteNum) {
  683. this.isNoteShow = false;
  684. setTimeout(() => {
  685. _this.noteNum = noteNum;
  686. }, 50);
  687. }
  688. _this.clientY = e.clientY;
  689. let left = e.clientX;
  690. let width = 642;
  691. if (left - this.bodyLeft > this.contentWidth / 2) {
  692. _this.left = left - width + 10;
  693. } else {
  694. _this.left = left - 200;
  695. }
  696. },
  697. // 处理注释数据
  698. handleNote(val) {
  699. let _this = this;
  700. _this.isNoteShow = true;
  701. _this.oldNoteNum = val;
  702. let noteIndex = Number(val);
  703. if (_this.NNPEAnnotationList && _this.NNPEAnnotationList.length > 0) {
  704. _this.curNoteCon = _this.NNPEAnnotationList[noteIndex]
  705. ? _this.NNPEAnnotationList[noteIndex]
  706. : null;
  707. }
  708. },
  709. changeCard(isShow) {
  710. let _this = this;
  711. _this.isNoteShow = isShow;
  712. _this.oldNoteNum = "";
  713. _this.noteNum = "";
  714. },
  715. getScreenHeight() {
  716. this.screenHeight = window.innerHeight;
  717. },
  718. changeCurQue(answer) {
  719. if (answer) {
  720. let writeModel = this.curQue.Bookanswer.writeModel;
  721. let hz = answer.hz;
  722. if (writeModel.hasOwnProperty(hz)) {
  723. writeModel[hz].push(answer);
  724. } else {
  725. writeModel[hz] = [answer];
  726. }
  727. console.log(this.curQue.Bookanswer);
  728. }
  729. },
  730. },
  731. //生命周期 - 创建完成(可以访问当前this实例)
  732. created() {},
  733. //生命周期 - 挂载完成(可以访问DOM元素)
  734. mounted() {
  735. console.log(this.curQue);
  736. if (this.curQue) {
  737. this.handleData();
  738. }
  739. console.log("生词");
  740. console.log(this.NNPENewWordList);
  741. if (this.NNPENewWordList && this.NNPENewWordList.length > 0) {
  742. this.handleNewword();
  743. }
  744. $(window).resize(() => {
  745. this.getScreenHeight();
  746. });
  747. this.getScreenHeight();
  748. },
  749. beforeCreate() {}, //生命周期 - 创建之前
  750. beforeMount() {}, //生命周期 - 挂载之前
  751. beforeUpdate() {}, //生命周期 - 更新之前
  752. updated() {}, //生命周期 - 更新之后
  753. beforeDestroy() {}, //生命周期 - 销毁之前
  754. destroyed() {}, //生命周期 - 销毁完成
  755. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  756. };
  757. </script>
  758. <style lang='scss' scoped>
  759. //@import url(); 引入公共css类
  760. .NNPE-ArticleView {
  761. width: 100%;
  762. .aduioLine-practice {
  763. display: flex;
  764. justify-content: flex-start;
  765. align-items: center;
  766. .aduioLine-content {
  767. flex: 1;
  768. }
  769. .aduioLine-right {
  770. display: flex;
  771. justify-content: space-between;
  772. align-items: center;
  773. width: 69px;
  774. height: 40px;
  775. box-sizing: border-box;
  776. padding: 0 12px;
  777. border-left: 1px solid rgba(0, 0, 0, 0.1);
  778. > span {
  779. width: 16px;
  780. height: 16px;
  781. cursor: pointer;
  782. }
  783. }
  784. }
  785. .NPC-sentences-list {
  786. .NPC-article-empty {
  787. display: flex;
  788. justify-content: flex-start;
  789. align-items: flex-start;
  790. > div {
  791. height: 24px;
  792. &.empty-left {
  793. width: 100%;
  794. box-sizing: border-box;
  795. &.hasRemark {
  796. width: 553px;
  797. box-sizing: border-box;
  798. border-right: 1px rgba(0, 0, 0, 0.1) solid;
  799. }
  800. }
  801. &.empty-right {
  802. flex: 1;
  803. }
  804. }
  805. &-bottom {
  806. > div {
  807. height: 40px;
  808. }
  809. }
  810. }
  811. .dia-article-record {
  812. width: 100%;
  813. border-top: 1px solid rgba(0, 0, 0, 0.1);
  814. .luyin-box {
  815. justify-content: start;
  816. padding: 8px 12px;
  817. height: 40px;
  818. width: 280px;
  819. justify-content: flex-start;
  820. }
  821. }
  822. }
  823. .NNPE-detail {
  824. clear: both;
  825. overflow: hidden;
  826. display: flex;
  827. justify-content: flex-start;
  828. align-items: flex-start;
  829. &.active {
  830. background: rgba(0, 0, 0, 0.06);
  831. }
  832. .article-content {
  833. width: 100%;
  834. box-sizing: border-box;
  835. padding: 8px 24px 8px 24px;
  836. display: flex;
  837. justify-content: flex-start;
  838. align-items: flex-start;
  839. &.hasRemark {
  840. width: 553px;
  841. border-right: 1px rgba(0, 0, 0, 0.1) solid;
  842. padding: 8px 0px 8px 23px;
  843. }
  844. &.paraLast {
  845. padding-bottom: 24px;
  846. }
  847. }
  848. .enwords {
  849. font-family: "robot";
  850. font-weight: normal;
  851. font-size: 14px;
  852. line-height: 22px;
  853. color: rgba(0, 0, 0, 0.85);
  854. padding-left: 3px;
  855. }
  856. .NNPE-words {
  857. float: left;
  858. &-box {
  859. float: left;
  860. > span {
  861. display: block;
  862. &.NNPE-pinyin {
  863. font-family: "GB-PINYINOK-B";
  864. font-weight: normal;
  865. font-size: 14px;
  866. line-height: 22px;
  867. color: #000000;
  868. height: 21px;
  869. &.noFont {
  870. font-family: initial;
  871. }
  872. &.textLeft {
  873. text-align: left;
  874. }
  875. }
  876. &.NNPE-chs {
  877. font-family: "FZJCGFKTK";
  878. font-size: 20px;
  879. line-height: 28px;
  880. color: #000000;
  881. &.active {
  882. background: rgba(60, 200, 99, 0.2);
  883. }
  884. &.wordActive {
  885. color: #de4444;
  886. }
  887. &.newActive {
  888. color: #de4444;
  889. }
  890. }
  891. &.padding {
  892. padding: 0 3px;
  893. }
  894. }
  895. }
  896. &.textLeft {
  897. text-align: left;
  898. }
  899. &.textCenter {
  900. text-align: center;
  901. }
  902. &.textRight {
  903. text-align: right;
  904. }
  905. > span {
  906. display: block;
  907. &.NNPE-pinyin {
  908. font-family: "GB-PINYINOK-B";
  909. font-weight: normal;
  910. font-size: 14px;
  911. line-height: 22px;
  912. color: #000000;
  913. height: 21px;
  914. &.noFont {
  915. font-family: initial;
  916. }
  917. &.textLeft {
  918. text-align: left;
  919. }
  920. }
  921. &.NNPE-chs {
  922. font-family: "FZJCGFKTK";
  923. font-size: 20px;
  924. line-height: 28px;
  925. color: #000000;
  926. &.active {
  927. background: rgba(60, 200, 99, 0.2);
  928. }
  929. &.wordActive {
  930. color: #de4444;
  931. }
  932. &.newActive {
  933. color: #de4444;
  934. }
  935. }
  936. &.padding {
  937. padding: 0 3px;
  938. }
  939. }
  940. }
  941. &.NNPE-detail-title {
  942. .wordsList-box {
  943. > div {
  944. display: flex;
  945. justify-content: center;
  946. }
  947. }
  948. }
  949. .index {
  950. width: 48px;
  951. box-sizing: border-box;
  952. padding: 8px;
  953. text-align: right;
  954. border-right: 1px solid rgba(0, 0, 0, 0.1);
  955. b {
  956. font-weight: 400;
  957. color: #000000;
  958. line-height: 1.5;
  959. }
  960. }
  961. .wordsList-box {
  962. width: 100%;
  963. padding: 0px 24px 0px 8px;
  964. clear: both;
  965. overflow: hidden;
  966. .roleDetail {
  967. height: 36px;
  968. display: flex;
  969. justify-content: flex-start;
  970. align-items: center;
  971. .pinyin {
  972. font-family: "GB-PINYINOK-B";
  973. font-size: 14px;
  974. line-height: 22px;
  975. color: rgba(0, 0, 0, 0.85);
  976. margin-right: 4px;
  977. }
  978. .chs {
  979. font-family: "FZJCGFKTK";
  980. font-size: 16px;
  981. line-height: 24px;
  982. color: rgba(0, 0, 0, 0.85);
  983. }
  984. }
  985. > .para-con {
  986. float: left;
  987. border: 1px solid rgba(0, 0, 0, 0.1);
  988. box-sizing: border-box;
  989. padding: 8px 12px 8px 12px;
  990. border-radius: 8px;
  991. }
  992. > img {
  993. width: 100%;
  994. display: block;
  995. }
  996. }
  997. }
  998. .remarkBox {
  999. flex: 1;
  1000. display: flex;
  1001. align-items: center;
  1002. justify-content: center;
  1003. &.remark72 {
  1004. padding-top: 72px;
  1005. }
  1006. &.remark-top {
  1007. padding-top: 44px;
  1008. }
  1009. }
  1010. .NNPE-wordDetail {
  1011. position: fixed;
  1012. z-index: 9999;
  1013. }
  1014. }
  1015. </style>