PhraseModelChs.vue 30 KB

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