Preview.vue 36 KB

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