Preview.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  1. <!-- -->
  2. <template>
  3. <div
  4. class="NPC-Big-Book-preview adult-book-preview-sty"
  5. :class="['NPC-Big-Book-preview-' + themeColor]"
  6. v-if="cur"
  7. >
  8. <div class="NNPE-title">
  9. <!-- 页眉 -->
  10. <div class="NNPE-title-left">
  11. <div
  12. v-for="(item, index) in cur.detailList"
  13. :key="index"
  14. class="NNPE-title-item"
  15. >
  16. <template
  17. v-if="
  18. item.detail &&
  19. item.detail.wordsList &&
  20. item.detail.wordsList.length == 0
  21. "
  22. >
  23. <p
  24. v-if="item.detail.sentence"
  25. :class="[
  26. 'content-con',
  27. /^[\u4e00-\u9fa5]/.test(item.detail.sentence) ? 'hasCn' : '',
  28. ]"
  29. v-html="item.detail.sentence"
  30. ></p>
  31. </template>
  32. <template v-else>
  33. <div class="con-box" v-if="item.detail && item.detail.resArr">
  34. <div
  35. v-for="(itemCon, indexCon) in item.detail.resArr"
  36. v-show="itemCon.isShow"
  37. :key="indexCon"
  38. :class="['con-item', indexCon === 0 ? 'con-item-0' : '']"
  39. >
  40. <template
  41. v-if="
  42. item.detail &&
  43. item.detail.wordsList &&
  44. item.detail.wordsList[indexCon + 1] &&
  45. item.detail.wordsList[indexCon + 1].chs &&
  46. chsFhList.indexOf(item.detail.wordsList[indexCon + 1].chs) >
  47. -1
  48. "
  49. >
  50. <div class="synthesis-box">
  51. <div>
  52. <span
  53. class="pinyin"
  54. :class="[
  55. noFont.indexOf(itemCon.pinyin) > -1 ? 'noFont' : '',
  56. ]"
  57. >{{ itemCon.pinyin }}</span
  58. >
  59. <span class="hanzi content-con">{{ itemCon.chs }}</span>
  60. </div>
  61. <div
  62. style="text-align: left"
  63. v-if="item.detail.wordsList[indexCon + 1]"
  64. >
  65. <span
  66. class="pinyin"
  67. :class="[
  68. noFont.indexOf(
  69. item.detail.wordsList[indexCon + 1].pinyin
  70. ) > -1
  71. ? 'noFont'
  72. : '',
  73. ]"
  74. >{{ item.detail.wordsList[indexCon + 1].pinyin }}</span
  75. >
  76. <span class="hanzi content-con">{{
  77. item.detail.wordsList[indexCon + 1].chs
  78. }}</span>
  79. </div>
  80. </div>
  81. </template>
  82. <template v-else>
  83. <span
  84. class="pinyin"
  85. :class="[
  86. noFont.indexOf(itemCon.pinyin) > -1 ? 'noFont' : '',
  87. ]"
  88. >{{ itemCon.pinyin }}</span
  89. >
  90. <span class="hanzi content-con">{{ itemCon.chs }}</span>
  91. </template>
  92. </div>
  93. </div>
  94. </template>
  95. <p class="NNPE-title-item-en" v-html="item.en"></p>
  96. </div>
  97. </div>
  98. <div class="NNPE-operate" v-if="isShowTitle">
  99. <a class="btn-prev" @click="handleNNPEprev" />
  100. <a class="btn-next" @click="handleNNPEnext" />
  101. </div>
  102. </div>
  103. <div
  104. v-if="
  105. cur.classTopic && cur.classTopic.length > 0 && cur.classTopic[0].con
  106. "
  107. class="classTopic-box"
  108. >
  109. <span
  110. v-for="(item, index) in cur.classTopic"
  111. :key="index"
  112. :class="item.font"
  113. >
  114. {{ item.con }}
  115. </span>
  116. </div>
  117. <div v-if="cur" class="NNPE-Book-content-inner">
  118. <div v-for="(item, index) in cur.cur_fn_data" :key="index">
  119. <div
  120. class="title-box"
  121. v-if="item.number || item.z_title || item.f_title"
  122. >
  123. <b v-if="item.number">{{ item.number }}</b>
  124. <div class="title-box-right" :class="[item.is_textIndex?'title-box-right-index':'']">
  125. <h2 v-if="item.z_title" v-html="item.z_title"></h2>
  126. <h3
  127. v-if="item.f_title"
  128. v-html="item.f_title"
  129. :style="{ marginTop: item.z_title ? '8px' : '0' }"
  130. ></h3>
  131. </div>
  132. </div>
  133. <div
  134. :class="['NNPE-tableList', item.is_bg ? 'NNPE-tableList-hasBg' : '']"
  135. >
  136. <div
  137. v-for="(items, indexs) in item.table_list"
  138. :key="indexs"
  139. class="NNPE-tableList-tr"
  140. :class="[
  141. indexs === item.table_list.length - 1
  142. ? 'NNPE-tableList-tr-last'
  143. : '',
  144. ]"
  145. >
  146. <div
  147. v-for="(itemss, indexss) in items"
  148. :key="indexss"
  149. :class="[
  150. 'NNPE-tableList-item',
  151. items.length == 1
  152. ? 'NNPE-tableList-item-noMargin'
  153. : 'NNPE-tableList-item' + items.length,
  154. ]"
  155. >
  156. <template v-if="itemss.data">
  157. <template v-if="itemss.type == 'ligature_chs'">
  158. <Ligature :cur-que="itemss.data" :theme-color="themeColor" />
  159. </template>
  160. <template v-if="itemss.data.type == 'image'">
  161. <Picture
  162. :cur-que="itemss.data"
  163. :child-type="itemss.type"
  164. :theme-color="themeColor"
  165. v-if="refresh"
  166. />
  167. </template>
  168. <template v-if="itemss.type == 'record_chs'">
  169. <Record :cur-que="itemss.data" :theme-color="themeColor" />
  170. </template>
  171. <template v-if="itemss.type == 'phrase_chs'">
  172. <WordPhrase
  173. :cur-que="itemss.data"
  174. :theme-color="themeColor"
  175. v-if="refresh"
  176. />
  177. </template>
  178. <template v-if="itemss.type == 'NewWord_chs'">
  179. <WordPhrase
  180. :cur-que="itemss.data"
  181. :theme-color="themeColor"
  182. :currentTreeID="currentTreeID"
  183. :indexs="indexs"
  184. :indexss="indexss"
  185. v-if="refresh"
  186. />
  187. </template>
  188. <template v-if="itemss.type == 'annotation_chs'">
  189. <WordPhrase
  190. :cur-que="itemss.data"
  191. :theme-color="themeColor"
  192. v-if="refresh"
  193. />
  194. </template>
  195. <template v-if="itemss.type == 'notes_chs'">
  196. <Notes
  197. :cur-que="itemss.data"
  198. :theme-color="themeColor"
  199. v-if="refresh"
  200. />
  201. </template>
  202. <template v-if="itemss.type == 'article_chs'">
  203. <ArticleTemChs
  204. :cur-que="itemss.data"
  205. :n-n-p-e-new-word-list="NNPENewWordList"
  206. :n-n-p-e-new-phrase-list="NNPENewPhraseList"
  207. :n-n-p-e-annotation-list="NNPEAnnotationList"
  208. :theme-color="themeColor"
  209. :currentTreeID="currentTreeID"
  210. v-if="refresh"
  211. />
  212. </template>
  213. <template v-if="itemss.type == 'sentence_segword_chs'">
  214. <SentenceSegWordViewChs
  215. :cur-que="itemss.data"
  216. :theme-color="themeColor"
  217. v-if="refresh"
  218. />
  219. </template>
  220. <template v-if="itemss.type == 'dialogue_article_chs'">
  221. <DialogueArticleViewChs
  222. :cur-que="itemss.data"
  223. :n-n-p-e-new-word-list="NNPENewWordList"
  224. :n-n-p-e-new-phrase-list="NNPENewPhraseList"
  225. :n-n-p-e-annotation-list="NNPEAnnotationList"
  226. :color-box="colorBox"
  227. :theme-color="themeColor"
  228. :currentTreeID="currentTreeID"
  229. v-if="refresh"
  230. />
  231. </template>
  232. <template v-if="itemss.type == 'dialogue_answer_chs'">
  233. <DialogueAnswerViewChs
  234. :cur-que="itemss.data"
  235. :color-box="colorBox"
  236. :theme-color="themeColor"
  237. v-if="refresh"
  238. />
  239. </template>
  240. <template v-if="itemss.type == 'input_record_chs'">
  241. <InputHasRecord
  242. :cur-que="itemss.data"
  243. :theme-color="themeColor"
  244. v-if="refresh"
  245. />
  246. </template>
  247. <template v-if="itemss.type == 'recordHZ_inputPY_chs'">
  248. <TextInputRecord
  249. :cur-que="itemss.data"
  250. :theme-color="themeColor"
  251. v-if="refresh"
  252. />
  253. </template>
  254. <template
  255. v-if="
  256. itemss.type == 'inputItem_chs' ||
  257. itemss.type == 'sentence_input_chs' ||
  258. itemss.type == 'sentence_judge_chs' ||
  259. itemss.type == 'sentence_record_chs' ||
  260. itemss.type == 'sentence_input_record_chs'
  261. "
  262. >
  263. <SentenceInput
  264. :cur-que="itemss.data"
  265. :theme-color="themeColor"
  266. v-if="refresh"
  267. />
  268. </template>
  269. <template v-if="itemss.type == 'NumberCombination_chs'">
  270. <NumberSelectHasRecord
  271. :cur-que="itemss.data"
  272. :theme-color="themeColor"
  273. v-if="refresh"
  274. />
  275. </template>
  276. <template v-if="itemss.type === 'voice_matrix'">
  277. <voice-matrix
  278. :cur-que="itemss.data"
  279. :theme-color="themeColor"
  280. v-if="refresh"
  281. />
  282. </template>
  283. <template v-if="itemss.type == 'toneSelect_chs'">
  284. <SelectTone
  285. :cur-que="itemss.data"
  286. :theme-color="themeColor"
  287. v-if="refresh"
  288. />
  289. </template>
  290. <template v-if="itemss.type == 'sudoku_chs'">
  291. <Soduko
  292. :cur-que="itemss.data"
  293. :theme-color="themeColor"
  294. v-if="refresh"
  295. />
  296. </template>
  297. <template v-if="itemss.type == 'single_chs'">
  298. <Single
  299. :cur-que="itemss.data"
  300. :theme-color="themeColor"
  301. v-if="refresh"
  302. />
  303. </template>
  304. <template v-if="itemss.type == 'text_problem_chs'">
  305. <TextProblem
  306. :cur-que="itemss.data"
  307. :theme-color="themeColor"
  308. v-if="refresh"
  309. />
  310. </template>
  311. <template v-if="itemss.type == 'newWord_preview_chs'">
  312. <NewWordShow
  313. :cur-que="itemss.data"
  314. :theme-color="themeColor"
  315. :indexStr="index + '_' + indexs + '_' + indexss"
  316. v-if="refresh"
  317. />
  318. </template>
  319. <template
  320. v-if="itemss.type == 'listen_record_single_syllable_chs'"
  321. >
  322. <SelectYinjie
  323. :cur-que="itemss.data"
  324. :theme-color="themeColor"
  325. v-if="refresh"
  326. />
  327. </template>
  328. <template v-if="itemss.type == 'sentence_listen_read_chs'">
  329. <SentenceListenRead
  330. :cur-que="itemss.data"
  331. :theme-color="themeColor"
  332. v-if="refresh"
  333. />
  334. </template>
  335. <template v-if="itemss.type == 'sort_chs'">
  336. <SentenceSortQP
  337. :cur-que="itemss.data"
  338. :theme-color="themeColor"
  339. v-if="refresh"
  340. />
  341. </template>
  342. <template v-if="itemss.type == 'checkbox_self_assessment_chs'">
  343. <Checkbox
  344. :cur-que="itemss.data"
  345. :theme-color="themeColor"
  346. v-if="refresh"
  347. />
  348. </template>
  349. <template
  350. v-if="
  351. itemss.type == 'record_control_mini' ||
  352. itemss.type == 'record_control_normal' ||
  353. itemss.type == 'record_control_pro' ||
  354. itemss.type == 'record_control_promax'
  355. "
  356. >
  357. <RecordModule
  358. :cur-que="itemss.data"
  359. :theme-color="themeColor"
  360. v-if="refresh"
  361. />
  362. </template>
  363. <template
  364. v-if="
  365. itemss.type == 'upload_control_chs' ||
  366. itemss.type == 'upload_control_preview_chs'
  367. "
  368. >
  369. <UploadControlView
  370. :cur-que="itemss.data"
  371. :type="itemss.type"
  372. :theme-color="themeColor"
  373. v-if="refresh"
  374. />
  375. </template>
  376. <template v-if="itemss.type == 'CourseStart_chs'">
  377. <CourseStart
  378. :cur-que="itemss.data"
  379. :handle-n-n-p-enext="handleNNPEnext"
  380. :theme-color="themeColor"
  381. v-if="refresh"
  382. />
  383. </template>
  384. <template v-if="itemss.type == 'tinydemo_chs'">
  385. <Tinydemo
  386. :cur-que="itemss.data"
  387. :theme-color="themeColor"
  388. v-if="refresh"
  389. />
  390. </template>
  391. <template v-if="itemss.type == 'video_chs'">
  392. <VideoControl
  393. :cur-que="itemss.data"
  394. :type="itemss.type"
  395. :theme-color="themeColor"
  396. :indexStr="
  397. index + '_' + indexs + '_' + indexss + '_' + currentTreeID
  398. "
  399. v-if="refresh"
  400. />
  401. </template>
  402. <template v-if="itemss.type == 'table_chs'">
  403. <TableView
  404. :cur-que="itemss.data"
  405. :type="itemss.type"
  406. :theme-color="themeColor"
  407. v-if="refresh"
  408. />
  409. </template>
  410. <template v-if="itemss.type == 'upload_pdf_chs'">
  411. <PdfView
  412. :cur-que="itemss.data"
  413. :type="itemss.type"
  414. :theme-color="themeColor"
  415. v-if="refresh"
  416. />
  417. </template>
  418. </template>
  419. </div>
  420. </div>
  421. </div>
  422. </div>
  423. </div>
  424. </div>
  425. </template>
  426. <script>
  427. import Picture from "./preview/Picture.vue"; // 图片模板
  428. import Record from "./preview/Record.vue"; // 音频播放
  429. import Soundrecord from "./preview/Soundrecord.vue"; // 录音模板
  430. import ArticleTemChs from "./preview/ArticleViewChs/index.vue"; // 文章模板
  431. import DialogueArticleViewChs from "./preview/DialogueArticleViewChs/index.vue"; // 文章模板
  432. import SentenceSegWordViewChs from "./preview/SentenceSegWordViewChs.vue"; // 句子分词
  433. import WordPhrase from "./preview/WordPhrase.vue"; // 生词短语
  434. import Notes from "./preview/Notes.vue"; // 注释
  435. import Ligature from "./preview/Ligature.vue";
  436. import InputHasRecord from "./preview/InputHasRecord.vue"; // 输入加录音
  437. import TextInputRecord from "./preview/TextInputRecord.vue"; // 文本+输入+录音
  438. import SentenceInput from "./preview/SentenceInput.vue"; // 输入选项
  439. import NumberSelectHasRecord from "./preview/NumberSelectHasRecord.vue"; // 数字组合
  440. import SelectTone from "./preview/SelectTone.vue"; // 选择声调
  441. import Soduko from "./preview/Soduko.vue"; // 数独
  442. import Single from "./preview/Single.vue"; // 单选
  443. import TextProblem from "./preview/TextProblem.vue"; // 课文上方的问题
  444. import NewWordShow from "./preview/NewWordShow.vue"; // 生字展示
  445. import SelectYinjie from "./preview/SelectYinjie.vue"; // 选择音节
  446. import SentenceListenRead from "./preview/SentenceListenRead.vue"; // 听并朗读
  447. import SentenceSortQP from "./preview/SentenceSortQP.vue"; // 句子拖拽排序
  448. import Checkbox from "./preview/CheckBoxModule.vue"; // 问卷调查-多选题
  449. import VoiceMatrix from "./preview/VoiceMatrix.vue"; // 语音矩阵
  450. import RecordModule from "./preview/RecordModule.vue"; // 录音组件
  451. import UploadControlView from "./preview/UploadControlView.vue"; // 预览控件
  452. import DialogueAnswerViewChs from "./preview/DialogueArticleViewChs/DialogueAnswerViewChs.vue"; // 文章模板
  453. import CourseStart from "./preview/CourseStart.vue"; // 封面
  454. import Tinydemo from "./preview/TinyModule.vue"; // 富文本
  455. import VideoControl from "./preview/VideoControl.vue"; // 视频控件
  456. import TableView from "./preview/TableView.vue"; // 视频控件
  457. import PdfView from "./preview/PdfView.vue"; // 视频控件
  458. export default {
  459. name: "Preview",
  460. components: {
  461. Picture,
  462. Record,
  463. Soundrecord,
  464. ArticleTemChs,
  465. DialogueArticleViewChs,
  466. SentenceSegWordViewChs,
  467. WordPhrase,
  468. Notes,
  469. Ligature,
  470. InputHasRecord,
  471. TextInputRecord,
  472. SentenceInput,
  473. NumberSelectHasRecord,
  474. SelectTone,
  475. Soduko,
  476. Single,
  477. TextProblem,
  478. NewWordShow,
  479. SelectYinjie,
  480. SentenceListenRead,
  481. SentenceSortQP,
  482. Checkbox,
  483. VoiceMatrix,
  484. RecordModule,
  485. UploadControlView,
  486. DialogueAnswerViewChs,
  487. CourseStart,
  488. Tinydemo,
  489. VideoControl,
  490. TableView,
  491. PdfView,
  492. },
  493. props: [
  494. "context",
  495. "fatherName",
  496. "currentTreeID",
  497. "FatherTreeData",
  498. "changeId",
  499. "themeColor",
  500. "isShowTitle",
  501. ],
  502. data() {
  503. return {
  504. contextData: null,
  505. queIndex: -1, // 题目的索引
  506. cur: null, // 当前的题目
  507. watchIndex: -1, // 监听的值
  508. queList: [],
  509. queTotal: 0, // 题目总数
  510. NNPENewWordList: [], // 存放文章的生词
  511. NNPENewPhraseList: [], // 存放文章的短语
  512. NNPEAnnotationList: [], // 存放文章注释
  513. height: "", // 总体的高度
  514. colorBox: [
  515. {
  516. touxiang: "#72B51D",
  517. bg: "#E9F0DF",
  518. },
  519. {
  520. touxiang: "#DE4444",
  521. bg: "rgba(222, 68, 68, 0.1)",
  522. },
  523. {
  524. touxiang: "#A7A7A7",
  525. bg: "#ffffff",
  526. },
  527. {
  528. touxiang: "#4D91F6",
  529. bg: "#F1F7FF",
  530. },
  531. {
  532. touxiang: "#FF8A00",
  533. bg: "rgba(255, 138, 0, 0.1)",
  534. },
  535. ],
  536. chsFhList: [",", "。", "“", ":", "》", "《", "?", "!", ";"],
  537. noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"], // 对应不要拼音字体
  538. idArr: [], //当前的pid
  539. oldCurrentTreeID: "",
  540. refresh: true,
  541. };
  542. },
  543. computed: {},
  544. watch: {
  545. context: {
  546. handler(val, oldVal) {
  547. const _this = this;
  548. _this.refresh = false;
  549. if (val) {
  550. _this.initContextData();
  551. if (_this.FatherTreeData) {
  552. _this.idArr = [];
  553. _this.FatherTreeData.forEach((item, itemIndex) => {
  554. this.seekCurrentTree(item);
  555. });
  556. }
  557. _this.handleTitleData();
  558. _this.$nextTick(() => {
  559. // 重新渲染组件
  560. _this.refresh = true;
  561. });
  562. }
  563. },
  564. // 深度观察监听
  565. deep: true,
  566. },
  567. },
  568. // 生命周期 - 创建完成(可以访问当前this实例)
  569. created() {},
  570. // 生命周期 - 挂载完成(可以访问DOM元素)
  571. mounted() {
  572. const _this = this;
  573. if (_this.context) {
  574. _this.initContextData();
  575. _this.handleTitleData();
  576. }
  577. if (_this.FatherTreeData) {
  578. _this.idArr = [];
  579. _this.FatherTreeData.forEach((item, itemIndex) => {
  580. this.seekCurrentTree(item);
  581. });
  582. }
  583. },
  584. beforeCreate() {}, // 生命周期 - 创建之前
  585. beforeMount() {}, // 生命周期 - 挂载之前
  586. beforeUpdate() {}, // 生命周期 - 更新之前
  587. updated() {}, // 生命周期 - 更新之后
  588. beforeDestroy() {}, // 生命周期 - 销毁之前
  589. destroyed() {}, // 生命周期 - 销毁完成
  590. activated() {},
  591. // 方法集合
  592. methods: {
  593. // 处理数据
  594. handleTitleData() {
  595. let _this = this;
  596. let curQue = JSON.parse(JSON.stringify(this.cur));
  597. curQue.detailList.forEach((dItem, dIndex) => {
  598. let paraArr = [];
  599. if (dItem.detail) {
  600. dItem.detail.wordsList.forEach((sItem, sIndex) => {
  601. let obj = {
  602. pinyin: sItem.pinyin,
  603. chs: sItem.chs,
  604. isShow: true,
  605. };
  606. paraArr.push(obj);
  607. });
  608. this.$set(_this.cur.detailList[dIndex].detail, "resArr", paraArr);
  609. }
  610. });
  611. },
  612. initContextData() {
  613. const _this = this;
  614. _this.contextData = JSON.parse(JSON.stringify(_this.context));
  615. _this.queIndex = 0;
  616. _this.NNPENewWordList = [];
  617. _this.NNPENewPhraseList = [];
  618. _this.NNPEAnnotationList =[]
  619. _this.watchIndex = _this.queIndex + new Date().getTime();
  620. if (_this.contextData) {
  621. // const list = _this.contextData;
  622. // if (list && list.length > 0) {
  623. // _this.queList = list;
  624. // _this.cur = list[_this.queIndex];
  625. _this.queTotal = 1;
  626. // _this.cur.cur_fn_data.forEach((item) => {
  627. // item.table_list.forEach((items) => {
  628. // items.forEach((itemss) => {
  629. // if (itemss.data && itemss.data.type == "NewWord_chs") {
  630. // _this.NNPENewWordList = _this.NNPENewWordList.concat(
  631. // itemss.data.option
  632. // );
  633. // } else if (itemss.data && itemss.data.type == "notes_chs") {
  634. // _this.NNPEAnnotationList = _this.NNPEAnnotationList.concat(
  635. // itemss.data.option
  636. // );
  637. // }
  638. // });
  639. // });
  640. // });
  641. // }
  642. _this.cur = _this.contextData;
  643. _this.cur.cur_fn_data.forEach((item) => {
  644. item.table_list.forEach((items) => {
  645. items.forEach((itemss) => {
  646. if (itemss.data && itemss.data.type == "NewWord_chs") {
  647. _this.NNPENewWordList = _this.NNPENewWordList.concat(
  648. itemss.data.option
  649. );
  650. } else if (itemss.data && itemss.data.type == "notes_chs") {
  651. _this.NNPEAnnotationList = _this.NNPEAnnotationList.concat(
  652. itemss.data.option
  653. );
  654. }
  655. });
  656. });
  657. });
  658. }
  659. this.$forceUpdate();
  660. },
  661. // 上一页
  662. handleNNPEprev() {
  663. let _this = this;
  664. _this.puaseAudio();
  665. if (_this.queIndex == 0) {
  666. this.idArr.forEach((item, i) => {
  667. if (item == _this.currentTreeID) {
  668. if (i == 0) {
  669. this.$message({
  670. message: "已经是第一题",
  671. type: "success",
  672. });
  673. } else {
  674. _this.changeId(this.idArr[i - 1]);
  675. }
  676. }
  677. });
  678. } else {
  679. _this.queIndex -= 1;
  680. _this.watchIndex = _this.queIndex + new Date().getTime();
  681. _this.cur = _this.queList[_this.queIndex];
  682. }
  683. },
  684. // 递归寻找相同的目录并保存目录的pid
  685. seekCurrentTree(item) {
  686. if (item.is_courseware == "true") {
  687. this.idArr.push(item.id);
  688. }
  689. if (item.children) {
  690. item.children.forEach((it, index) => {
  691. if (it.is_courseware == "true") {
  692. this.idArr.push(it.id);
  693. }
  694. if (it.children) {
  695. this.seekCurrentTree(it);
  696. }
  697. });
  698. }
  699. },
  700. puaseAudio() {
  701. let audio = document.getElementsByTagName("audio");
  702. audio.forEach((item) => {
  703. item.pause();
  704. });
  705. let video = document.getElementsByTagName("video");
  706. video.forEach((item) => {
  707. item.pause();
  708. });
  709. },
  710. // 下一页
  711. handleNNPEnext() {
  712. const _this = this;
  713. _this.puaseAudio();
  714. if (_this.queIndex == _this.queTotal - 1) {
  715. this.idArr.forEach((item, i) => {
  716. if (item == _this.currentTreeID) {
  717. if (i == this.idArr.length - 1) {
  718. this.$message({
  719. message: "已经是最后一题",
  720. type: "success",
  721. });
  722. } else {
  723. _this.changeId(this.idArr[i + 1]);
  724. }
  725. }
  726. });
  727. } else {
  728. _this.queIndex += 1;
  729. _this.watchIndex = _this.queIndex + new Date().getTime();
  730. _this.cur = _this.queList[_this.queIndex];
  731. }
  732. },
  733. }, // 如果页面有keep-alive缓存功能,这个函数会触发
  734. };
  735. </script>
  736. <style lang='scss' scoped>
  737. //@import url(); 引入公共css类
  738. .NPC-Big-Book-preview {
  739. width: 860px;
  740. margin: 0 auto;
  741. position: relative;
  742. padding-bottom: 120px;
  743. .NNPE-title {
  744. background: #e35454;
  745. border-radius: 0px 0px 16px 16px;
  746. padding: 7px 24px;
  747. position: relative;
  748. height: 64px;
  749. display: flex;
  750. align-items: center;
  751. h1 {
  752. color: #ffffff;
  753. font-weight: bold;
  754. font-size: 16px;
  755. line-height: 150%;
  756. margin: 0;
  757. }
  758. .NNPE-title-left {
  759. display: flex;
  760. color: #ffffff;
  761. font-size: 18px;
  762. line-height: 18px;
  763. align-items: center;
  764. .NNPE-title-item {
  765. margin-right: 12px;
  766. }
  767. .content-con {
  768. margin: 4px 0;
  769. font-family: "robot";
  770. &.hasCn,
  771. &.hanzi {
  772. font-family: "FZJCGFKTK";
  773. }
  774. }
  775. .content-en {
  776. font-weight: normal;
  777. line-height: 18px;
  778. font-family: "robot";
  779. }
  780. .NNPE-title-item-en {
  781. font-weight: normal;
  782. line-height: 12px;
  783. font-family: "robot";
  784. font-size: 12px;
  785. margin: 0;
  786. }
  787. .con-box {
  788. display: flex;
  789. flex-flow: wrap;
  790. justify-content: center;
  791. .con-item {
  792. text-align: center;
  793. padding: 0 1px;
  794. }
  795. span {
  796. display: block;
  797. }
  798. .pinyin {
  799. font-family: "GB-PINYINOK-B";
  800. font-size: 12px;
  801. line-height: 12px;
  802. height: 12px;
  803. &.noFont {
  804. font-family: initial;
  805. }
  806. }
  807. .synthesis-box {
  808. display: flex;
  809. }
  810. }
  811. }
  812. .NNPE-operate {
  813. position: absolute;
  814. top: 10px;
  815. right: 20px;
  816. a {
  817. background: #e35454 url("../../assets/newImage/common/btn-pre.png")
  818. center no-repeat;
  819. background-size: 24px;
  820. border-radius: 4px;
  821. width: 44px;
  822. height: 44px;
  823. display: inline-block;
  824. margin: 0 4px;
  825. &.btn-next {
  826. background: #e35454 url("../../assets/newImage/common/btn-next.png")
  827. center no-repeat;
  828. background-size: 24px;
  829. }
  830. &:hover {
  831. background-color: #f76565;
  832. }
  833. &:active {
  834. background-color: #d24444;
  835. }
  836. }
  837. }
  838. }
  839. .classTopic-box {
  840. background: #e35454;
  841. border-radius: 8px;
  842. width: 780px;
  843. margin: 24px auto 0 auto;
  844. text-align: center;
  845. padding: 8px 24px;
  846. span {
  847. font-size: 16px;
  848. line-height: 150%;
  849. color: #ffffff;
  850. padding: 0 1px;
  851. &.cn {
  852. font-family: "FZJCGFKTK";
  853. }
  854. &.en {
  855. font-family: "robot";
  856. }
  857. &.pinyin {
  858. font-family: "GB-PINYINOK-B";
  859. }
  860. }
  861. }
  862. .NNPE-Book-content-inner {
  863. padding: 0 40px;
  864. > div {
  865. padding-top: 32px;
  866. .title-box {
  867. display: flex;
  868. margin-bottom: 24px;
  869. b {
  870. min-width: 39px;
  871. height: 24px;
  872. background: #e35454;
  873. border-radius: 8px;
  874. color: #ffffff;
  875. font-family: "robot";
  876. display: inline-block;
  877. text-align: center;
  878. font-size: 16px;
  879. line-height: 150%;
  880. margin-right: 12px;
  881. padding: 0 4px;
  882. }
  883. h2 {
  884. color: #e35454;
  885. font-size: 16px;
  886. line-height: 150%;
  887. font-weight: bold;
  888. margin: 0;
  889. }
  890. h3 {
  891. color: #000000;
  892. font-size: 16px;
  893. line-height: 150%;
  894. font-weight: normal;
  895. margin: 0;
  896. white-space: pre-wrap;
  897. word-break: break-word;
  898. }
  899. .title-box-right-index{
  900. padding-left: 51px;
  901. }
  902. }
  903. }
  904. .NNPE-tableList {
  905. background: #fff;
  906. border-radius: 8px;
  907. // padding: 12px 8px;
  908. &.NNPE-tableList-hasBg {
  909. background: #f7f7f7;
  910. border: 1px solid rgba(0, 0, 0, 0.1);
  911. box-sizing: border-box;
  912. border-radius: 8px;
  913. }
  914. .NNPE-tableList-tr {
  915. display: flex;
  916. justify-content: space-between;
  917. // flex-flow: wrap;
  918. .NNPE-tableList-item {
  919. width: 100%;
  920. // margin: 12px 16px;
  921. // padding: 16px;
  922. // background: #FFFFFF;
  923. // border-radius: 4px;
  924. display: flex;
  925. flex-flow: wrap;
  926. justify-content: center;
  927. &.NNPE-tableList-item-noMargin {
  928. margin: 0;
  929. }
  930. &.NNPE-tableList-item2 {
  931. width: 378px;
  932. }
  933. &.NNPE-tableList-item3 {
  934. width: 244px;
  935. }
  936. }
  937. }
  938. }
  939. }
  940. }
  941. .NPC-Big-Book-preview-green {
  942. .NNPE-title {
  943. background: #24b99e;
  944. .NNPE-operate {
  945. a {
  946. background: #24b99e url("../../assets/newImage/common/btn-pre.png")
  947. center no-repeat;
  948. background-size: 24px;
  949. &.btn-next {
  950. background: #24b99e url("../../assets/newImage/common/btn-next.png")
  951. center no-repeat;
  952. background-size: 24px;
  953. }
  954. &:hover {
  955. background-color: #3dd4b8;
  956. }
  957. &:active {
  958. background-color: #1fa189;
  959. }
  960. }
  961. }
  962. }
  963. .classTopic-box {
  964. background: #24b99e;
  965. }
  966. .NNPE-Book-content-inner {
  967. > div {
  968. .title-box {
  969. b {
  970. background: #24b99e;
  971. }
  972. h2 {
  973. color: #24b99e;
  974. }
  975. }
  976. }
  977. }
  978. }
  979. .NPC-Big-Book-preview-brown {
  980. .NNPE-title {
  981. background: #bd8865;
  982. .NNPE-operate {
  983. a {
  984. background: #bd8865 url("../../assets/newImage/common/btn-pre.png")
  985. center no-repeat;
  986. background-size: 24px;
  987. &.btn-next {
  988. background: #bd8865 url("../../assets/newImage/common/btn-next.png")
  989. center no-repeat;
  990. background-size: 24px;
  991. }
  992. &:hover {
  993. background-color: #d6a687;
  994. }
  995. &:active {
  996. background-color: #a37557;
  997. }
  998. }
  999. }
  1000. }
  1001. .classTopic-box {
  1002. background: #bd8865;
  1003. }
  1004. .NNPE-Book-content-inner {
  1005. > div {
  1006. .title-box {
  1007. b {
  1008. background: #bd8865;
  1009. }
  1010. h2 {
  1011. color: #bd8865;
  1012. }
  1013. }
  1014. }
  1015. }
  1016. }
  1017. </style>