index.vue 26 KB

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