index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. <!-- eslint-disable vue/no-v-html -->
  2. <template>
  3. <div class="article-preview" :style="getAreaStyle()">
  4. <SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
  5. <div class="main">
  6. <div class="NPC-ArticleView NPC-ArticleView-container">
  7. <div class="ArticleView-header">
  8. <a class="ArticleView-full" @click="fullScreen" title="全屏">
  9. <svg-icon
  10. icon-class="icon-full"
  11. size="24"
  12. :style="{
  13. color: data.unified_attrib && data.unified_attrib.topic_color ? data.unified_attrib.topic_color : '',
  14. }"
  15. />
  16. </a>
  17. <div>
  18. <div
  19. v-if="
  20. (tokenData && tokenData.popedom_code_list && tokenData.popedom_code_list.indexOf(2100001) != -1) ||
  21. (tokenData && tokenData.user_type === 'APP')
  22. "
  23. class="left"
  24. :style="{ marginLeft: '40px' }"
  25. @click="submit"
  26. title="文本分析"
  27. >
  28. <!-- <img src="@/assets/wbfx-icon.png" alt="" /> -->
  29. <svg-icon
  30. icon-class="icon-wbfx"
  31. size="24"
  32. :style="{
  33. color: data.unified_attrib && data.unified_attrib.topic_color ? data.unified_attrib.topic_color : '',
  34. }"
  35. />
  36. </div>
  37. </div>
  38. <div class="right">
  39. <!-- <template v-if="data.property.is_enable_new_word === 'true'">
  40. <el-switch
  41. v-model="showPhrases"
  42. style="display: block"
  43. :active-color="bookInfo.theme_color"
  44. inactive-color="rgba(0,0,0,0.1)"
  45. active-text=""
  46. inactive-text="本课生词"
  47. @change="handleSwitchChange('showPractice', 'showWord')"
  48. />
  49. </template>
  50. <template v-if="data.property.is_enable_read === 'true'">
  51. <el-switch
  52. v-model="showPractice"
  53. style="display: block"
  54. :active-color="bookInfo.theme_color"
  55. inactive-color="rgba(0,0,0,0.1)"
  56. active-text=""
  57. inactive-text="语音练习"
  58. @change="handleSwitchChange('showPhrases', 'showWord')"
  59. />
  60. </template>
  61. <template v-if="data.property.is_enable_word === 'true'">
  62. <el-switch
  63. v-model="showWord"
  64. style="display: block"
  65. :active-color="bookInfo.theme_color"
  66. inactive-color="rgba(0,0,0,0.1)"
  67. active-text=""
  68. inactive-text="取词"
  69. @change="handleSwitchChange('showPhrases', 'showPractice')"
  70. />
  71. </template> -->
  72. <a
  73. v-if="data.property.is_enable_new_word === 'true'"
  74. @click="handleSwitchChange('showPractice', 'showWord', 'showPhrases')"
  75. :style="{
  76. color:
  77. showPhrases && data.unified_attrib && data.unified_attrib.topic_color
  78. ? data.unified_attrib.topic_color
  79. : '',
  80. }"
  81. ><svg-icon icon-class="icon-article-ci" size="24" />本课生词</a
  82. >
  83. <a
  84. v-if="data.property.is_enable_read === 'true'"
  85. @click="handleSwitchChange('showPhrases', 'showWord', 'showPractice')"
  86. :style="{
  87. color:
  88. showPractice && data.unified_attrib && data.unified_attrib.topic_color
  89. ? data.unified_attrib.topic_color
  90. : '',
  91. }"
  92. ><svg-icon icon-class="icon-article-practice" size="24" />语音练习</a
  93. >
  94. <a
  95. v-if="data.property.is_enable_word === 'true'"
  96. @click="handleSwitchChange('showPhrases', 'showPractice', 'showWord')"
  97. :style="{
  98. color:
  99. showWord && data.unified_attrib && data.unified_attrib.topic_color
  100. ? data.unified_attrib.topic_color
  101. : '',
  102. }"
  103. ><svg-icon icon-class="icon-article-phrase" size="24" />取词</a
  104. >
  105. </div>
  106. </div>
  107. <div ref="ArticleViewbody" class="ArticleView-body">
  108. <NormalModelChs
  109. v-if="!showPhrases && !showPractice && !showWord"
  110. :cur-que="data"
  111. :title-fontsize="titleFontsize"
  112. :word-fontsize="wordFontsize"
  113. :body-left="bodyLeft"
  114. :body-width="bodyWidth"
  115. :attrib="data.unified_attrib"
  116. :no-font="noFont"
  117. :config="config"
  118. :NNPEAnnotationList="NNPEAnnotationList"
  119. :col-length="colLength"
  120. :multilingual="showLang && getLang() ? getLang() : ''"
  121. @changeConfig="changeConfig"
  122. />
  123. <PhraseModel
  124. v-if="showPhrases"
  125. :cur-que="data"
  126. :title-fontsize="titleFontsize"
  127. :word-fontsize="wordFontsize"
  128. :NNPENewWordList="NNPENewWordList"
  129. :attrib="data.unified_attrib"
  130. :no-font="noFont"
  131. :body-left="bodyLeft"
  132. :config="config"
  133. :TaskModel="isJudgingRightWrong ? 'ANSWER' : ''"
  134. :NNPEAnnotationList="NNPEAnnotationList"
  135. :col-length="colLength"
  136. :NpcNewWordMp3="NpcNewWordMp3"
  137. :multilingual="showLang && getLang() ? getLang() : ''"
  138. @changeConfig="changeConfig"
  139. />
  140. <Practice
  141. v-if="showPractice"
  142. :cur-que="data"
  143. :title-fontsize="titleFontsize"
  144. :word-fontsize="wordFontsize"
  145. :attrib="data.unified_attrib"
  146. :no-font="noFont"
  147. :NNPENewWordList="NNPENewWordList"
  148. :config="config"
  149. :TaskModel="isJudgingRightWrong ? 'ANSWER' : ''"
  150. :col-length="colLength"
  151. :NpcNewWordMp3="NpcNewWordMp3"
  152. :is-full="isFull"
  153. :multilingual="showLang && getLang() ? getLang() : ''"
  154. @changeConfig="changeConfig"
  155. />
  156. <WordModel
  157. v-if="showWord"
  158. :cur-que="data"
  159. :title-fontsize="titleFontsize"
  160. :word-fontsize="wordFontsize"
  161. :body-left="bodyLeft"
  162. :body-width="bodyWidth"
  163. :NNPENewWordList="NNPENewWordList"
  164. :attrib="data.unified_attrib"
  165. :no-font="noFont"
  166. :config="config"
  167. :TaskModel="isJudgingRightWrong ? 'ANSWER' : ''"
  168. :col-length="colLength"
  169. :multilingual="showLang && getLang() ? getLang() : ''"
  170. @changeConfig="changeConfig"
  171. />
  172. </div>
  173. <div :id="'screen-' + mathNum" class="voice-full-screen">
  174. <Voicefullscreen
  175. v-if="isFull && resObj"
  176. :theme-color="bookInfo.theme_color"
  177. :cur-que="data"
  178. :sent-list="resObj.sentList"
  179. :sent-index="0"
  180. :mp3="data.mp3_list && data.mp3_list[0] ? data.mp3_list[0].url : ''"
  181. :no-font="noFont"
  182. :NNPENewWordList="NNPENewWordList"
  183. :is-full="isFull"
  184. :config="config"
  185. :TaskModel="isJudgingRightWrong ? 'ANSWER' : ''"
  186. :NpcNewWordMp3="NpcNewWordMp3"
  187. :attrib="data.unified_attrib"
  188. @handleWav="handleWav"
  189. @changePinyin="changePinyins"
  190. @changeEN="changeENs"
  191. @exitFullscreen="exitFullscreen"
  192. @changeIsFull="changeIsFull"
  193. />
  194. </div>
  195. </div>
  196. <template v-if="data.new_word_list.new_word_list.length > 0">
  197. <NewWordPreview :new-data="data.new_word_list" />
  198. </template>
  199. <template v-if="data.other_word_list.new_word_list.length > 0">
  200. <NewWordPreview :new-data="data.other_word_list" />
  201. </template>
  202. <template v-if="data.notes_list.option.length > 0">
  203. <NotesPreview :notes-data="data.notes_list" />
  204. </template>
  205. </div>
  206. </div>
  207. </template>
  208. <script>
  209. import { getArticleData } from '@/views/book/courseware/data/dialogueArticle';
  210. import PreviewMixin from '../common/PreviewMixin';
  211. import PhraseModel from './PhraseModelChs.vue';
  212. import NormalModelChs from './NormalModelChs.vue';
  213. import Practice from './Practicechs.vue'; // 语音练习模式
  214. import WordModel from './WordModelChs.vue'; // 语音练习模式
  215. import Voicefullscreen from '../article/Voicefullscreen.vue';
  216. import { getToken } from '@/utils/auth';
  217. import { analysSubmit, GetFileURLMap } from '@/api/app';
  218. import NewWordPreview from '../new_word/NewWordPreview.vue';
  219. import NotesPreview from '../notes/NotesPreview.vue';
  220. export default {
  221. name: 'DialogueArticlePreview',
  222. components: {
  223. NormalModelChs,
  224. Practice,
  225. WordModel,
  226. PhraseModel,
  227. Voicefullscreen,
  228. NewWordPreview,
  229. NotesPreview,
  230. },
  231. mixins: [PreviewMixin],
  232. inject: ['bookInfo'],
  233. data() {
  234. return {
  235. data: getArticleData(),
  236. showPreview: true, // 全文预览
  237. showPhrases: false, // 显示单词和短语
  238. showPractice: false, // 语音练习
  239. showWord: false, // 取词
  240. titleFontsize: 20, // 标题字号初始值
  241. wordFontsize: 16, // 文章内容字号初始值
  242. bodyLeft: 0,
  243. bodyWidth: 0,
  244. noFont: ['~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '/'],
  245. config: {
  246. isShowEN: false,
  247. isHasEN: false,
  248. isShowPY: false,
  249. isHasPY: false,
  250. },
  251. userAnswer: {
  252. normalModel: {
  253. recordList: [],
  254. },
  255. writeModel: {}, // 生词/取词模式
  256. practiceModel: {}, // 练习模式
  257. wordModel: {
  258. recordList: [],
  259. },
  260. },
  261. tokenData: getToken(),
  262. mathNum: Math.random().toString(36).substr(2),
  263. isFull: false,
  264. resObj: null,
  265. chsFhList: [',', '。', '”', ':', '》', '?', '!', ';', '、'],
  266. highWords: null,
  267. highWordsArr: [],
  268. highIndex: 0,
  269. newWordList: [],
  270. NNPEAnnotationList: [],
  271. NNPENewWordList: [],
  272. NpcNewWordMp3: [],
  273. colLength: 1,
  274. multilingualTextList: {},
  275. };
  276. },
  277. computed: {},
  278. watch: {
  279. showLang: {
  280. handler(val) {
  281. if (val) {
  282. this.data.multilingual.forEach((item) => {
  283. let trans_arr = item.translation.split('\n');
  284. this.data.detail.forEach((items) => {
  285. let items_trans_arr = [];
  286. if (!items.hasOwn('multilingualTextList')) {
  287. this.$set(items, 'multilingualTextList', {});
  288. }
  289. if (items.para) {
  290. items_trans_arr = trans_arr.splice(0, items.sentences.length);
  291. }
  292. this.$set(items.multilingualTextList, item.type, items_trans_arr);
  293. });
  294. });
  295. }
  296. },
  297. deep: true,
  298. immediate: true,
  299. },
  300. 'data.detail.length': {
  301. handler(val) {
  302. if (val) {
  303. this.handleData();
  304. let _this = this;
  305. // if (!this.isJudgingRightWrong) {
  306. // let userAnswer = JSON.parse(JSON.stringify(_this.userAnswer));
  307. // _this.$set(this.data, 'Bookanswer', userAnswer);
  308. // }
  309. _this.$nextTick(() => {
  310. _this.bodyLeft = _this.$refs.ArticleViewbody.getBoundingClientRect().left;
  311. });
  312. for (let i = 0; i < this.data.detail.length; i++) {
  313. let enStr = this.data.detail[i].sentencesEn ? this.data.detail[i].sentencesEn.join('') : '';
  314. if (enStr) {
  315. this.config.isShowEN = false;
  316. this.config.isHasEN = true;
  317. }
  318. let pinyin = this.handleObj(this.data.detail[i].wordsList);
  319. if (pinyin && this.isEnable(this.data.property.view_pinyin)) {
  320. this.config.isShowPY = true;
  321. this.config.isHasPY = true;
  322. }
  323. if (enStr && pinyin) {
  324. break;
  325. }
  326. }
  327. }
  328. },
  329. deep: true,
  330. immediate: true,
  331. },
  332. },
  333. created() {},
  334. methods: {
  335. changeConfig(obj) {
  336. this.config[obj] = !this.config[obj];
  337. },
  338. changeIsFull() {
  339. this.isFull = false;
  340. },
  341. // 拼音的显示和隐藏
  342. changePinyins() {
  343. if (this.config.isHasPY) {
  344. this.changeConfig('isShowPY');
  345. }
  346. },
  347. // 英文的显示和隐藏
  348. changeENs() {
  349. if (this.config.isHasEN) {
  350. this.changeConfig('isShowEN');
  351. }
  352. },
  353. // 处理字体大小
  354. handleFontsize(symbol) {
  355. if (symbol == '+') {
  356. if (this.wordFontsize < 24) {
  357. this.titleFontsize += 2;
  358. this.wordFontsize += 2;
  359. }
  360. } else if (symbol == '-') {
  361. if (this.wordFontsize > 12) {
  362. this.titleFontsize -= 2;
  363. this.wordFontsize -= 2;
  364. }
  365. }
  366. },
  367. // 切换开关
  368. handleSwitchChange(obj1, obj2, obj3) {
  369. this[obj1] = false;
  370. this[obj2] = false;
  371. this[obj3] = !this[obj3];
  372. this.showPreview = false;
  373. },
  374. handleObj(list) {
  375. let pinyin = '';
  376. list.forEach((item) => {
  377. item.forEach((items) => {
  378. if (items.pinyin) pinyin += items.pinyin;
  379. });
  380. });
  381. return pinyin;
  382. },
  383. submit() {
  384. let loading = this.$loading({
  385. lock: true,
  386. text: 'Loading',
  387. spinner: 'el-icon-loading',
  388. background: 'rgba(0, 0, 0, 0.7)',
  389. });
  390. analysSubmit({
  391. app_user_id: '',
  392. text: this.data.content,
  393. })
  394. .then((res) => {
  395. window.open(`${window.location.origin}/GCLS-TC/#/textanalysis/Result?id=${res.record.id}&type=文本分析`);
  396. loading.close();
  397. })
  398. .catch((res) => {
  399. loading.close();
  400. });
  401. },
  402. // 语音全屏
  403. fullScreen() {
  404. this.pauseAudio();
  405. this.pauseVideo();
  406. this.isFull = true;
  407. this.goFullscreen();
  408. },
  409. pauseAudio() {
  410. let audio = document.getElementsByTagName('audio');
  411. if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && audio.forEach) {
  412. audio.forEach((item) => {
  413. item.pause();
  414. });
  415. }
  416. },
  417. pauseVideo() {
  418. let video = document.getElementsByTagName('video');
  419. if (video && video.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && video.forEach) {
  420. video.forEach((item) => {
  421. item.pause();
  422. });
  423. }
  424. },
  425. goFullscreen() {
  426. let id = `screen-${this.mathNum}`;
  427. let element = document.getElementById(id);
  428. if (element.requestFullscreen) {
  429. element.requestFullscreen();
  430. } else if (element.msRequestFullscreen) {
  431. element.msRequestFullscreen();
  432. } else if (element.mozRequestFullScreen) {
  433. element.mozRequestFullScreen();
  434. } else if (element.webkitRequestFullscreen) {
  435. element.webkitRequestFullscreen();
  436. }
  437. },
  438. exitFullscreen() {
  439. this.isFull = false;
  440. if (document.exitFullscreen) {
  441. document.exitFullscreen();
  442. } else if (document.msExitFullscreen) {
  443. document.msExitFullscreen();
  444. } else if (document.mozCancelFullScreen) {
  445. document.mozCancelFullScreen();
  446. } else if (document.webkitExitFullscreen) {
  447. document.webkitExitFullscreen();
  448. }
  449. },
  450. handleData() {
  451. if (this.data.new_word_list) {
  452. this.$set(this.data.new_word_list, 'unified_attrib', this.data.unified_attrib);
  453. }
  454. if (this.data.other_word_list) {
  455. this.$set(this.data.other_word_list, 'unified_attrib', this.data.unified_attrib);
  456. }
  457. if (this.data.notes_list) {
  458. this.$set(this.data.notes_list, 'unified_attrib', this.data.unified_attrib);
  459. }
  460. if (this.showLang) {
  461. this.data.multilingual.forEach((item) => {
  462. let trans_arr = item.translation.split('\n');
  463. this.data.detail.forEach((items) => {
  464. let items_trans_arr = [];
  465. if (!items.hasOwn('multilingualTextList')) {
  466. this.$set(items, 'multilingualTextList', {});
  467. }
  468. if (items.para) {
  469. items_trans_arr = trans_arr.splice(0, items.sentences.length);
  470. }
  471. this.$set(items.multilingualTextList, item.type, items_trans_arr);
  472. });
  473. });
  474. }
  475. let userAnswer = JSON.parse(JSON.stringify(this.userAnswer));
  476. this.$set(this.data, 'Bookanswer', userAnswer);
  477. if (this.data.mp3_list && this.data.mp3_list.length > 0) {
  478. GetFileURLMap({ file_id_list: [this.data.mp3_list[0].file_id] }).then(({ url_map }) => {
  479. this.data.mp3_list[0].url = url_map[this.data.mp3_list[0].file_id];
  480. });
  481. }
  482. this.NNPENewWordList = (
  483. this.data.new_word_list_other_component_input ? this.data.new_word_list_other_component_input : []
  484. )
  485. .concat(this.data.new_word_list.new_word_list)
  486. .concat(this.data.other_word_list.new_word_list);
  487. this.NNPEAnnotationList = this.data.notes_list.option;
  488. let resArr = [];
  489. let sentArrTotal = [];
  490. let timeArr = [];
  491. let curQue = JSON.parse(JSON.stringify(this.data));
  492. let wordTimeList = curQue.wordTime;
  493. let dhaspinyin = false; // 每段是否有拼音
  494. let dhaspinyinArr = [];
  495. curQue.detail.forEach((dItem, dIndex) => {
  496. dhaspinyin = false;
  497. dItem.wordsList.forEach((sItem, sIndex) => {
  498. let sentArr = [];
  499. let sentence = dItem.sentences[sIndex];
  500. sItem.forEach((wItem, wIndex) => {
  501. let startIndex = wIndex == 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
  502. let endIndex = wIndex == 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
  503. // this.judgePad(sItem, wItem, wIndex);
  504. this.mergeWordSymbol(wItem);
  505. let words = '';
  506. if (this.newWordList.length > 0) {
  507. if (!this.highWords) {
  508. this.findLightWord(wItem, wIndex, sentence, sItem);
  509. words = this.highWords ? this.highWords.words : '';
  510. } else if (wIndex > this.highWords.endIndex - 1) {
  511. this.highWords = null;
  512. this.findLightWord(wItem, wIndex, sentence, sItem);
  513. words = this.highWords ? this.highWords.words : '';
  514. } else {
  515. words = this.highWords ? this.highWords.words : '';
  516. }
  517. }
  518. let obj = {
  519. paraIndex: dIndex, // 段落索引
  520. sentIndex: sIndex, // 在段落中句子索引
  521. wordIndex: wIndex, // 单词的索引
  522. pinyin: wItem.pinyin,
  523. chs: wItem.chs,
  524. padding: true,
  525. className: wItem.className,
  526. isShow: wItem.isShow,
  527. startIndex,
  528. endIndex,
  529. leg: wItem.chs.length,
  530. timeList: [],
  531. words,
  532. config: {
  533. fontFamily: wItem.fontFamily,
  534. },
  535. };
  536. sentArr.push(obj);
  537. if (wItem.pinyin) dhaspinyin = true;
  538. });
  539. let objs = {
  540. sentArr,
  541. enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
  542. };
  543. sentArrTotal.push(sentArr);
  544. resArr.push(objs);
  545. });
  546. timeArr.push(dItem.timeList);
  547. if (this.isEnable(curQue.property.view_pinyin)) {
  548. dhaspinyinArr.push(dhaspinyin);
  549. }
  550. });
  551. if (wordTimeList && wordTimeList.length > 0) {
  552. this.mergeWordTime(sentArrTotal, wordTimeList);
  553. }
  554. let timeList = [];
  555. timeArr.forEach((item) => {
  556. item.forEach((aItem) => {
  557. if (timeList.indexOf(aItem) < 0) {
  558. timeList.push(aItem);
  559. }
  560. });
  561. });
  562. this.resObj = {
  563. sentList: resArr,
  564. timeList,
  565. dhaspinyinArr,
  566. };
  567. },
  568. mergeWordTime(resArr, wordTimeList) {
  569. resArr.forEach((item, index) => {
  570. let wordsResultList = wordTimeList[index].wordsResultList;
  571. item.forEach((wItem) => {
  572. let startIndex = wItem.startIndex;
  573. let endIndex = wItem.endIndex;
  574. wItem.timeList = wordsResultList.slice(startIndex, endIndex);
  575. });
  576. });
  577. },
  578. findLightWord(wItem, startIndex, sentence, sItem) {
  579. let endIndex = 0;
  580. let words = '';
  581. this.newWordList.forEach((item) => {
  582. if (item.length == 1) {
  583. if (item == wItem.chs && !wItem.banLight) {
  584. words = wItem.chs;
  585. endIndex = startIndex + 1;
  586. }
  587. } else if (item[0] == wItem.chs && sentence.indexOf(item) > -1) {
  588. let index = null;
  589. let chsStr = '';
  590. for (let i = startIndex; i < sItem.length + 1; i++) {
  591. index = i;
  592. if (chsStr.length == item.length) {
  593. break;
  594. } else {
  595. chsStr += sItem[i] ? sItem[i].chs : '';
  596. }
  597. }
  598. if (chsStr == item && !wItem.banLight) {
  599. words = item;
  600. endIndex = index;
  601. }
  602. } else if (wItem.new_word && wItem.new_word == item && !wItem.banLight) {
  603. words = item;
  604. endIndex = startIndex + 1;
  605. }
  606. });
  607. if (words) {
  608. this.highWords = { words, endIndex };
  609. } else {
  610. this.highWords = null;
  611. }
  612. },
  613. // 词和标点合一起
  614. mergeWordSymbol(wItem) {
  615. if (this.chsFhList.indexOf(wItem.chs) > -1) {
  616. wItem.isShow = false;
  617. } else {
  618. wItem.isShow = true;
  619. }
  620. },
  621. handleWav(list, tmIndex) {
  622. tmIndex = tmIndex || 0;
  623. this.data.Bookanswer.practiceModel[tmIndex] = {
  624. recordList: [],
  625. };
  626. this.$set(this.data.Bookanswer.practiceModel[tmIndex], 'recordList', list);
  627. },
  628. handleNewword() {
  629. let NewWordList = [];
  630. this.NNPENewWordList.forEach((wItem) => {
  631. // item.forEach((wItem) => {
  632. if (wItem.new_word) {
  633. NewWordList.push(wItem.new_word);
  634. } else if (wItem.detail && wItem.detail.sentence) {
  635. NewWordList.push(wItem.detail.sentence);
  636. }
  637. // });
  638. });
  639. this.newWordList = JSON.parse(JSON.stringify(NewWordList));
  640. },
  641. },
  642. };
  643. </script>
  644. <style lang="scss" scoped>
  645. @use '@/styles/mixin.scss' as *;
  646. .article-preview {
  647. @include preview-base;
  648. .main {
  649. display: grid;
  650. row-gap: 24px;
  651. align-items: center;
  652. }
  653. .NPC-ArticleView {
  654. width: 100%;
  655. .ArticleView-full {
  656. position: absolute;
  657. top: 0;
  658. left: 0;
  659. z-index: 1;
  660. font-size: 16px;
  661. font-weight: bold;
  662. line-height: 24px;
  663. color: #000;
  664. cursor: pointer;
  665. // background: url('@/assets/full-screen-red.png') left center no-repeat;
  666. // background-size: 20px 20px;
  667. }
  668. .ArticleView-header {
  669. position: relative;
  670. display: flex;
  671. align-items: center;
  672. justify-content: space-between;
  673. height: 24px;
  674. margin-bottom: 16px;
  675. .left {
  676. display: flex;
  677. align-items: center;
  678. justify-content: center;
  679. // padding-left: 24px;
  680. font-size: 16px;
  681. font-weight: bold;
  682. line-height: 24px;
  683. cursor: pointer;
  684. // background: url('@/assets/wbfx-icon.png') left center no-repeat;
  685. // background-size: 20px;
  686. img {
  687. width: 20px;
  688. height: 20px;
  689. margin-right: 4px;
  690. }
  691. }
  692. .right {
  693. display: flex;
  694. gap: 24px;
  695. a {
  696. display: flex;
  697. gap: 4px;
  698. align-items: center;
  699. color: rgba(0, 0, 0, 65%);
  700. cursor: pointer;
  701. }
  702. }
  703. .setting-fontsize {
  704. display: flex;
  705. margin-left: 24px;
  706. a {
  707. box-sizing: border-box;
  708. display: block;
  709. width: 24px;
  710. height: 24px;
  711. border: 1px solid rgba(0, 0, 0, 10%);
  712. border-radius: 4px;
  713. }
  714. img {
  715. width: 100%;
  716. }
  717. > img {
  718. width: 24px;
  719. margin: 0 8px;
  720. }
  721. }
  722. }
  723. .ArticleView-body {
  724. box-sizing: border-box;
  725. background: #fff;
  726. border: 1px solid rgba(0, 0, 0, 10%);
  727. border-radius: 8px;
  728. .aduioLine-box {
  729. width: 100%;
  730. border-bottom: 1px solid rgba(0, 0, 0, 10%);
  731. &-bottom {
  732. border-top: 1px solid rgba(0, 0, 0, 10%);
  733. border-bottom: none;
  734. }
  735. }
  736. }
  737. }
  738. }
  739. </style>
  740. <style lang="scss">
  741. .NPC-ArticleView {
  742. .ArticleView-header {
  743. .el-switch {
  744. margin-left: 24px;
  745. }
  746. .el-switch__core {
  747. width: 44px !important;
  748. height: 24px;
  749. border-radius: 20px;
  750. }
  751. .el-switch__core::after {
  752. top: 3px;
  753. left: 3px;
  754. }
  755. .el-switch.is-checked .el-switch__core::after {
  756. left: 100%;
  757. margin-left: -19px;
  758. }
  759. .el-switch__label {
  760. color: #000;
  761. }
  762. .el-switch__label.is-active {
  763. color: rgba($color: #000, $alpha: 30%);
  764. }
  765. .el-switch__label--left {
  766. margin-right: 8px;
  767. }
  768. }
  769. .pinyin-16 {
  770. cursor: pointer;
  771. // background: url('@/assets/icon/pinyin-16-normal-red.png') no-repeat left top;
  772. // background-size: 100% 100%;
  773. // &.disabled {
  774. // background: url('@/assets/icon/pinyin-16-disable-Black.png') no-repeat left top;
  775. // background-size: 100% 100%;
  776. // }
  777. }
  778. .EN-16 {
  779. cursor: pointer;
  780. // background: url('@/assets/icon/EN-16-normal-red.png') no-repeat left top;
  781. // background-size: 100% 100%;
  782. // &.disabled {
  783. // background: url('@/assets/icon/EN-16-disable-Black.png') no-repeat left top;
  784. // background-size: 100% 100%;
  785. // }
  786. }
  787. }
  788. .ArticleView-body {
  789. .aduioLine-box {
  790. width: 100%;
  791. border-bottom: 1px solid rgba(0, 0, 0, 10%);
  792. &-bottom {
  793. border-top: 1px solid rgba(0, 0, 0, 10%);
  794. border-bottom: none;
  795. }
  796. }
  797. }
  798. </style>