Preview.vue 30 KB

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