Preview.vue 36 KB

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