Preview.vue 35 KB

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