PhraseModelChs.vue 31 KB

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