Preview.vue 31 KB

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