BookEep.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. <template>
  2. <div class="common-preview" :class="{ 'is-mobile': isMobile }">
  3. <div class="audit-content">
  4. <div ref="previewMain" class="main-container">
  5. <main :class="['preview-main', 'no-audit']" :style="computedCommonPreviewStyle">
  6. <div
  7. v-if="!isMobile"
  8. class="preview-left"
  9. :style="{ backgroundColor: background.background?.is_global ? '' : '#fff' }"
  10. ></div>
  11. <CoursewarePreview
  12. ref="courseware"
  13. :is-show-group="false"
  14. :group-show-all="true"
  15. :group-row-list="groupRowList"
  16. :data="data"
  17. :courseware-id="curSelectId"
  18. :component-list="cList"
  19. :background="background"
  20. :can-remark="false"
  21. :show-remark="false"
  22. :component-remark-obj="{}"
  23. :project="project"
  24. :is-mobile="isMobile"
  25. @editNote="handEditNote"
  26. @saveCollect="saveCollect"
  27. @getTranslate="getTranslate"
  28. />
  29. <div
  30. v-if="!isMobile"
  31. class="preview-right"
  32. :style="{ backgroundColor: background.background?.is_global ? '' : '#fff' }"
  33. ></div>
  34. </main>
  35. </div>
  36. </div>
  37. <ExplanatoryNoteDialog
  38. ref="explanatoryNote"
  39. :open.sync="editDialogOpen"
  40. :init-data="oldRichData"
  41. :title-text="dialogTitleText"
  42. :modal="false"
  43. @confirm="dialogSave"
  44. @cancel="dialogCancel"
  45. />
  46. <TranslateDialog
  47. :open.sync="showTranslate"
  48. :modal="false"
  49. :init-text="translateText"
  50. :book-id="id"
  51. title-text="翻译 (机器翻译)"
  52. />
  53. </div>
  54. </template>
  55. <script>
  56. import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview.vue';
  57. import ExplanatoryNoteDialog from '@/components/ExplanatoryNoteDialog.vue';
  58. import TranslateDialog from '@/components/TranslateDialog.vue';
  59. import { isTrue } from '@/utils/validate';
  60. import { buildCoursewareStyle } from '@/views/book/courseware/preview/common/utils/coursewareStyle';
  61. import { updateBaseURL } from '@/utils/http';
  62. import {
  63. GetMyNoteList,
  64. AddMyCollect,
  65. GetMyCollectList,
  66. DeleteMyNote,
  67. UpdateMyNote,
  68. AddMyNote,
  69. AddCoursewareFeedback,
  70. DeleteCoursewareFeedback,
  71. GetCoursewareFeedbackList,
  72. } from '@/api/book';
  73. import { ensureExtendedFonts } from '@/common/data';
  74. const defaultBc = {
  75. background_image_url: '',
  76. background_position: {
  77. left: 0,
  78. top: 0,
  79. },
  80. background: {},
  81. };
  82. export default {
  83. name: 'BookEep',
  84. components: {
  85. CoursewarePreview,
  86. ExplanatoryNoteDialog,
  87. TranslateDialog,
  88. },
  89. provide() {
  90. return {
  91. getLang: () => this.lang,
  92. getChinese: () => this.chinese,
  93. getShowPinYin: () => this.showPinYin,
  94. getLangList: () => this.langList,
  95. convertText: this.convertText,
  96. getTitleList: () => this.title_list,
  97. getPermissionControl: () => this.permissionControl,
  98. };
  99. },
  100. props: {
  101. id: {
  102. type: String,
  103. default: '',
  104. },
  105. // 组件内容
  106. content: {
  107. type: String,
  108. default: '',
  109. },
  110. // 内容分组行列表
  111. contentGroupRowList: {
  112. type: String,
  113. default: '',
  114. },
  115. // 组件列表
  116. componentList: {
  117. type: Array,
  118. default: () => [],
  119. },
  120. // 教材背景
  121. bookBackground: {
  122. type: String,
  123. default: '',
  124. },
  125. permissControl: {
  126. type: Object,
  127. default: () => ({}),
  128. },
  129. // 外部传入组件用户答案,JSON 格式字符串
  130. componentUserAnswer: {
  131. type: String,
  132. default: '',
  133. },
  134. },
  135. data() {
  136. const isMobile = /android|iphone|ipad|ipod/i.test(navigator.userAgent || navigator.vendor || window.opera);
  137. return {
  138. background: this.bookBackground.length > 0 ? JSON.parse(this.bookBackground) : defaultBc,
  139. groupRowList: this.contentGroupRowList.length > 0 ? JSON.parse(this.contentGroupRowList) : [],
  140. data: this.content.length > 0 ? JSON.parse(this.content) : { row_list: [] },
  141. cList: this.handleComponentList(),
  142. curSelectId: this.id,
  143. isTrue,
  144. project: {
  145. editor: '', // 作者
  146. cover_image_file_id: null, // 封面图片ID
  147. cover_image_file_url: '', // 封面图片URL
  148. },
  149. title_list: [],
  150. node_list: [],
  151. permissionControl: {
  152. can_answer: true, // 可作答
  153. can_judge_correct: false, // 可判断对错(客观题)
  154. can_show_answer: false, // 可查看答案
  155. can_correct: false, // 可批改
  156. can_check_correct: false, // 可查看批改
  157. },
  158. popoverShow: false,
  159. is_can_edit: 'false', // 是否可以编辑
  160. allCollectList: [],
  161. newSelectedInfo: {}, // 新的选中信息
  162. allNoteList: [],
  163. oldRichData: {},
  164. editDialogOpen: false,
  165. dialogType: 0,
  166. lang: 'ZH',
  167. chinese: 'zh-Hans',
  168. showPinYin: 'false',
  169. langList: [],
  170. showTranslate: false,
  171. translateText: '',
  172. selectedInfo: null,
  173. allFeedbackList: [],
  174. drawerType: 1,
  175. isMobile,
  176. };
  177. },
  178. computed: {
  179. computedCommonPreviewStyle() {
  180. return buildCoursewareStyle(this.background, 'commonPreview');
  181. },
  182. dialogTitleText() {
  183. if (this.dialogType === 2) return '反馈';
  184. return '笔记';
  185. },
  186. },
  187. watch: {
  188. componentList: {
  189. handler(newVal) {
  190. if (newVal && newVal.length > 0) {
  191. this.cList = this.handleComponentList();
  192. this.applyComponentUserAnswer();
  193. }
  194. },
  195. deep: true,
  196. },
  197. bookBackground: {
  198. handler(newVal) {
  199. if (newVal && newVal.length > 0) {
  200. this.background = JSON.parse(newVal);
  201. } else {
  202. this.background = defaultBc;
  203. }
  204. },
  205. },
  206. content: {
  207. handler(newVal) {
  208. if (newVal && newVal.length > 0) {
  209. this.data = JSON.parse(newVal);
  210. }
  211. },
  212. },
  213. contentGroupRowList: {
  214. handler(newVal) {
  215. if (newVal && newVal.length > 0) {
  216. this.groupRowList = JSON.parse(newVal);
  217. }
  218. },
  219. },
  220. id: {
  221. handler(newVal) {
  222. if (newVal && newVal.length > 0) {
  223. this.curSelectId = newVal;
  224. }
  225. },
  226. },
  227. permissControl: {
  228. handler(newVal) {
  229. if (newVal && Object.keys(newVal).length > 0) {
  230. this.permissionControl = newVal;
  231. }
  232. },
  233. deep: true,
  234. immediate: true,
  235. },
  236. componentUserAnswer: {
  237. handler() {
  238. this.applyComponentUserAnswer();
  239. },
  240. deep: true,
  241. immediate: true,
  242. },
  243. },
  244. created() {
  245. const origin = window.location.origin;
  246. if (origin && origin.indexOf('localhost') === -1) {
  247. updateBaseURL(`${origin}/`);
  248. }
  249. },
  250. mounted() {
  251. this.applyComponentUserAnswer();
  252. // 自动注册扩展字体(惰性加载,与主应用共享 _extendedFontsLoaded 标记,仅首次请求)
  253. ensureExtendedFonts();
  254. },
  255. methods: {
  256. backTop() {
  257. this.$refs.previewMain.scrollTo({
  258. top: 0,
  259. left: 0,
  260. behavior: 'smooth',
  261. });
  262. },
  263. convertText(text) {
  264. return text;
  265. },
  266. handleComponentList() {
  267. const processHtmlString = this.processHtmlString;
  268. const cList = this.componentList || [];
  269. cList.forEach((x) => {
  270. if (x.component_type === 'audio') {
  271. let _c = JSON.parse(x.content);
  272. let p = _c.property || {};
  273. if (!p.file_name_display_mode) p.file_name_display_mode = 'true';
  274. if (p.view_method === 'independent' && !p.style_mode) {
  275. p.style_mode = 'middle';
  276. }
  277. if (!p.style_mode) p.style_mode = 'big';
  278. if (p.view_method === 'icon') {
  279. p.file_name_display_mode = 'false';
  280. p.view_method = 'independent';
  281. p.style_mode = 'small';
  282. }
  283. x.content = JSON.stringify(_c);
  284. } else if (x.component_type === 'richtext') {
  285. if (!processHtmlString) return;
  286. let _c = JSON.parse(x.content);
  287. let p = _c.property || {};
  288. let lev = Number(p.title_style_level);
  289. if (p.is_title !== 'true' || lev < 1 || !_c.content) return;
  290. let style = this.title_list.find((y) => y.level === lev) || {};
  291. if (style && style.style) {
  292. style = JSON.parse(style.style);
  293. let c_text = _c.content;
  294. const parser = new DOMParser();
  295. const doc = parser.parseFromString(c_text, 'text/html');
  296. const body = doc.body;
  297. const pElements = body.querySelectorAll('p');
  298. processHtmlString(pElements, style);
  299. _c.content = body.innerHTML;
  300. x.content = JSON.stringify(_c);
  301. }
  302. }
  303. });
  304. return cList;
  305. },
  306. /**
  307. * 获取所有组件的用户答案,供 UI 包使用者通过 ref 调用
  308. * @returns {Object} 以组件 id 为键的答案映射
  309. */
  310. getAllComponentUserAnswer() {
  311. const previewList = this.$refs?.courseware?.$refs?.preview || [];
  312. const answerMap = {};
  313. previewList.forEach((item) => {
  314. const id = item?.$el?.dataset?.id;
  315. if (!id || typeof item.getAnswer !== 'function') return;
  316. answerMap[id] = item.getAnswer();
  317. });
  318. const obj = {
  319. duration: 0,
  320. count_not_done: 0,
  321. count_right: 0,
  322. count_error: 0,
  323. content: JSON.stringify(answerMap),
  324. };
  325. return JSON.stringify(obj);
  326. },
  327. /**
  328. * 将外部传入的用户答案回填到组件
  329. */
  330. applyComponentUserAnswer() {
  331. if (!this.componentUserAnswer || this.componentUserAnswer.length === 0) return;
  332. this.$nextTick(() => {
  333. const previewList = this.$refs?.courseware?.$refs?.preview || [];
  334. if (!previewList.length) return;
  335. const answerMap = JSON.parse(this.componentUserAnswer || '{}');
  336. if (!answerMap || Object.keys(answerMap).length === 0) return;
  337. previewList.forEach((item) => {
  338. const id = item?.$el?.dataset?.id;
  339. if (!id || typeof item.showAnswer !== 'function') return;
  340. if (!Object.hasOwn(answerMap, id)) return;
  341. item.showAnswer(true, true, answerMap[id], true);
  342. });
  343. });
  344. },
  345. processHtmlString(pElements, styleConfig, isClear = false) {
  346. const _pElements = pElements || [];
  347. _pElements.forEach((pElement) => {
  348. if (pElement.innerHTML !== '<br data-mce-bogus="1">') {
  349. pElement.innerHTML = pElement.innerText;
  350. }
  351. if (isClear) {
  352. pElement.removeAttribute('style');
  353. pElement.removeAttribute('data-mce-style');
  354. } else {
  355. const style = pElement.style;
  356. if (styleConfig.font) style.fontFamily = styleConfig.font;
  357. if (styleConfig.font_size) style.fontSize = styleConfig.font_size;
  358. if (styleConfig.text_color) style.color = styleConfig.text_color;
  359. style.fontWeight = styleConfig.bold === 'true' ? 'bold' : 'normal';
  360. style.fontStyle = styleConfig.italic === 'true' ? 'italic' : 'normal';
  361. if (styleConfig.indent || styleConfig.indent === 0) style.marginLeft = `${styleConfig.indent}px`;
  362. }
  363. });
  364. },
  365. /**
  366. * 获取收藏列表
  367. * @param {Object} params - 参数对象
  368. * @param {number} params.type - 收藏类型(可选)
  369. */
  370. async getCollect(params) {
  371. if (params && params.type) this.drawerType = Number(params.type);
  372. this.allCollectList = [];
  373. await GetMyCollectList({ courseware_id: this.curSelectId }).then((res) => {
  374. if (res.status === 1) {
  375. res.collect_list.forEach((x) => {
  376. if (x.collect_desc) {
  377. let n = JSON.parse(x.collect_desc);
  378. let obj = {
  379. coursewareId: x.courseware_id,
  380. id: x.id,
  381. blockId: n.blockId,
  382. startIndex: n.startIndex,
  383. endIndex: n.endIndex,
  384. text: n.text,
  385. };
  386. this.allCollectList.push(obj);
  387. }
  388. });
  389. }
  390. });
  391. },
  392. /**
  393. * 保存收藏
  394. * @param {Object} collect - 收藏信息对象
  395. * @param {string} collect.coursewareId - 课件 ID
  396. * @param {string} collect.blockId - 区块 ID
  397. * @param {number} collect.startIndex - 起始索引
  398. * @param {number} collect.endIndex - 结束索引
  399. * @param {string} collect.text - 收藏文本
  400. */
  401. async saveCollect(collect) {
  402. if (this.allCollectList.length === 0) {
  403. await this.getCollect();
  404. }
  405. let old = this.allCollectList.find(
  406. (x) =>
  407. x.coursewareId === collect.coursewareId &&
  408. x.blockId === collect.blockId &&
  409. x.startIndex === collect.startIndex &&
  410. x.endIndex === collect.endIndex,
  411. );
  412. if (old) {
  413. this.$message({
  414. dangerouslyUseHTMLString: true,
  415. message: "<i class='el-icon-check' />已收藏",
  416. });
  417. return;
  418. }
  419. this.newSelectedInfo = collect;
  420. let collectInfo = {
  421. blockId: this.newSelectedInfo.blockId,
  422. startIndex: this.newSelectedInfo.startIndex,
  423. endIndex: this.newSelectedInfo.endIndex,
  424. text: this.newSelectedInfo.text,
  425. };
  426. let reqData = {
  427. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  428. component_id: 'WHOLE',
  429. collect_desc: JSON.stringify(collectInfo), // 位置描述
  430. };
  431. AddMyCollect(reqData)
  432. .then(() => {
  433. this.getCollect();
  434. })
  435. .then(() => {
  436. this.$message({
  437. dangerouslyUseHTMLString: true,
  438. message: "<i class='el-icon-check' />已收藏",
  439. });
  440. });
  441. },
  442. /**
  443. * 获取笔记列表
  444. * @param {Object} params - 参数对象
  445. */
  446. async getNote(params) {
  447. if (params && params.type) this.drawerType = Number(params.type);
  448. this.allNoteList = [];
  449. await GetMyNoteList({ courseware_id: this.curSelectId }).then((res) => {
  450. if (res.status === 1) {
  451. res.note_list.forEach((x) => {
  452. if (x.note_desc) {
  453. let n = JSON.parse(x.note_desc);
  454. let obj = {
  455. coursewareId: x.courseware_id,
  456. id: x.id,
  457. blockId: n.blockId,
  458. startIndex: n.startIndex,
  459. endIndex: n.endIndex,
  460. text: n.text,
  461. note: this.addImageMaxWidth(n.note),
  462. };
  463. this.allNoteList.push(obj);
  464. }
  465. });
  466. }
  467. });
  468. },
  469. async handEditNote(note) {
  470. this.oldRichData = {};
  471. if (this.allNoteList.length === 0) {
  472. await this.getNote();
  473. }
  474. let old = this.allNoteList.find(
  475. (x) =>
  476. x.coursewareId === note.coursewareId &&
  477. x.blockId === note.blockId &&
  478. x.startIndex === note.startIndex &&
  479. x.endIndex === note.endIndex,
  480. );
  481. if (old) {
  482. this.oldRichData = old;
  483. this.oldRichData.dataStr = old.note;
  484. }
  485. this.newSelectedInfo = note;
  486. this.editDialogOpen = true;
  487. this.dialogType = 1;
  488. },
  489. /**
  490. * 获取翻译
  491. * @param {Object} info - 翻译信息对象
  492. * @param {string} info.text - 需要翻译的文本
  493. */
  494. async getTranslate(info) {
  495. this.showTranslate = true;
  496. this.translateText = info.text;
  497. },
  498. dialogSave(obj) {
  499. if (this.dialogType === 1) return this.saveNote(obj);
  500. if (this.dialogType === 2) return this.saveFeedback(obj);
  501. },
  502. dialogCancel(id) {
  503. if (this.dialogType === 1) return this.delNote(id);
  504. if (this.dialogType === 2) return this.delFeedback(id);
  505. },
  506. /**
  507. * 保存笔记
  508. * @param {Object} note - 笔记信息对象
  509. * @param {string} note.dataStr - 笔记内容
  510. */
  511. saveNote(note) {
  512. let noteInfo = {
  513. blockId: this.newSelectedInfo.blockId,
  514. startIndex: this.newSelectedInfo.startIndex,
  515. endIndex: this.newSelectedInfo.endIndex,
  516. note: note.dataStr,
  517. text: this.newSelectedInfo.text,
  518. };
  519. let reqData = {
  520. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  521. component_id: 'WHOLE',
  522. note_desc: JSON.stringify(noteInfo), // 位置描述
  523. };
  524. if (note.id) {
  525. if (!noteInfo.note) {
  526. this.delNote(note.id);
  527. return;
  528. }
  529. let upDate = {
  530. id: note.id,
  531. note_desc: reqData.note_desc,
  532. };
  533. UpdateMyNote(upDate).then(() => {
  534. this.getNote();
  535. });
  536. } else {
  537. AddMyNote(reqData).then(() => {
  538. this.getNote();
  539. });
  540. }
  541. this.editDialogOpen = false;
  542. this.newSelectedInfo = null;
  543. this.selectedInfo = null;
  544. },
  545. delNote(id) {
  546. const noteId = id || (this.oldRichData && this.oldRichData.id);
  547. if (!noteId) return;
  548. DeleteMyNote({ id: noteId }).then(() => {
  549. this.allNoteList = this.allNoteList.filter((x) => x.id !== noteId);
  550. });
  551. },
  552. saveFeedback(feedBack) {
  553. if (feedBack.id) {
  554. this.delFeedback(feedBack.id);
  555. }
  556. if (feedBack.dataStr) {
  557. let feedBackInfo = {
  558. blockId: this.newSelectedInfo.blockId,
  559. startIndex: this.newSelectedInfo.startIndex,
  560. endIndex: this.newSelectedInfo.endIndex,
  561. feedBack: feedBack.dataStr,
  562. text: this.newSelectedInfo.text,
  563. };
  564. let reqData = {
  565. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  566. component_id: 'WHOLE',
  567. content: JSON.stringify(feedBackInfo),
  568. content_select: this.newSelectedInfo.text,
  569. };
  570. AddCoursewareFeedback(reqData).then(() => {
  571. this.getFeedback();
  572. });
  573. }
  574. this.editDialogOpen = false;
  575. this.newSelectedInfo = null;
  576. this.selectedInfo = null;
  577. },
  578. delFeedback(id) {
  579. const feedBackId = id || (this.oldRichData && this.oldRichData.id);
  580. if (!feedBackId) return;
  581. DeleteCoursewareFeedback({ id: feedBackId })
  582. .then(() => {
  583. this.allFeedbackList = this.allFeedbackList.filter((x) => x.id !== feedBackId);
  584. })
  585. .catch(() => {});
  586. },
  587. /**
  588. * 为HTML内容中的图片添加最大宽度限制
  589. * @param {string} html - HTML字符串
  590. * @returns {string} - 处理后的HTML字符串
  591. */
  592. addImageMaxWidth(html) {
  593. if (!html) return html;
  594. const regex = /<img([^>]*)>/gi;
  595. return html.replace(regex, (match, attributes) => {
  596. if (attributes.includes('style=')) {
  597. return match.replace(/style=["']([^"']*)["']/i, (styleMatch, styleValue) => {
  598. if (styleValue.includes('max-width')) {
  599. return styleMatch;
  600. }
  601. return `style="${styleValue}; max-width: 200px;"`;
  602. });
  603. }
  604. return `<img${attributes} style="max-width: 200px;">`;
  605. });
  606. },
  607. async getFeedback(params) {
  608. if (params && params.type) this.drawerType = Number(params.type);
  609. this.allFeedbackList = [];
  610. await GetCoursewareFeedbackList({ courseware_id: this.curSelectId }).then((res) => {
  611. if (res.status === 1 && res.feedback_list) {
  612. res.feedback_list.forEach((x) => {
  613. if (x.content) {
  614. let n = JSON.parse(x.content);
  615. let obj = {
  616. coursewareId: x.courseware_id,
  617. id: x.id,
  618. blockId: n.blockId,
  619. startIndex: n.startIndex,
  620. endIndex: n.endIndex,
  621. text: n.text,
  622. feedBack: this.addImageMaxWidth(n.feedBack),
  623. };
  624. this.allFeedbackList.push(obj);
  625. }
  626. });
  627. }
  628. });
  629. },
  630. },
  631. };
  632. </script>
  633. <style lang="scss" scoped>
  634. @use '@/styles/mixin.scss' as *;
  635. $total-width: $courseware-width + $courseware-left-margin + $courseware-right-margin;
  636. .common-preview {
  637. min-width: calc($total-width);
  638. // 移动端适配
  639. &.is-mobile {
  640. min-width: 100%;
  641. .main-container {
  642. min-width: 100%;
  643. }
  644. .audit-content {
  645. min-width: 100%;
  646. }
  647. main.preview-main {
  648. width: 100%;
  649. min-width: 100%;
  650. max-width: 100%;
  651. }
  652. }
  653. .main-container {
  654. position: relative;
  655. flex: 1;
  656. min-width: 1110px;
  657. padding: 15px;
  658. overflow: auto;
  659. background-color: #ececec;
  660. .catalogue-bar {
  661. position: absolute;
  662. top: 15px;
  663. left: 0;
  664. display: flex;
  665. align-items: center;
  666. justify-content: center;
  667. width: 54px;
  668. height: 54px;
  669. margin: -9px 6px 0 240px;
  670. cursor: pointer;
  671. background-color: #fff;
  672. border-radius: 2px;
  673. box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 40%);
  674. }
  675. .sidebar-bar {
  676. position: absolute;
  677. top: 0;
  678. right: 240px;
  679. display: flex;
  680. width: 60px;
  681. height: calc(100vh - 166px);
  682. .toolbar {
  683. display: flex;
  684. flex-direction: column;
  685. align-items: center;
  686. width: 60px;
  687. height: 100%;
  688. img {
  689. cursor: pointer;
  690. }
  691. &-special {
  692. display: flex;
  693. flex-direction: column;
  694. row-gap: 16px;
  695. align-items: center;
  696. width: 100%;
  697. margin-bottom: 24px;
  698. background-color: #fff;
  699. img {
  700. width: 36px;
  701. height: 36px;
  702. }
  703. }
  704. }
  705. }
  706. }
  707. .back-top {
  708. position: absolute;
  709. right: 240px;
  710. bottom: 0;
  711. display: flex;
  712. place-content: center center;
  713. align-items: center;
  714. width: 60px;
  715. height: 60px;
  716. cursor: pointer;
  717. background-color: #fff;
  718. }
  719. main.preview-main {
  720. display: flex;
  721. flex: 1;
  722. width: calc($total-width);
  723. min-width: calc($total-width);
  724. max-width: calc($total-width);
  725. min-height: 100%;
  726. margin: 0 auto;
  727. background-color: #fff;
  728. border-radius: 4px;
  729. box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 40%);
  730. .preview-left {
  731. width: $courseware-left-margin;
  732. min-width: $courseware-left-margin;
  733. max-width: $courseware-left-margin;
  734. }
  735. .preview-right {
  736. width: $courseware-right-margin;
  737. min-width: $courseware-right-margin;
  738. max-width: $courseware-right-margin;
  739. }
  740. &.no-audit {
  741. margin: 0 auto;
  742. }
  743. }
  744. .audit-content {
  745. display: flex;
  746. min-width: calc($total-width);
  747. .left-menu {
  748. display: flex;
  749. flex-direction: column;
  750. width: $catalogue-width;
  751. font-family: 'Microsoft YaHei', 'Arial', sans-serif;
  752. background-color: #fff;
  753. .courseware-info {
  754. display: flex;
  755. column-gap: 18px;
  756. width: 100%;
  757. height: 186px;
  758. padding: 6px 6px 24px;
  759. border-bottom: $border;
  760. .cover-image {
  761. display: flex;
  762. align-items: center;
  763. justify-content: center;
  764. width: 111px;
  765. height: 157px;
  766. background-color: rgba(229, 229, 229, 100%);
  767. img {
  768. max-width: 111px;
  769. max-height: 157px;
  770. }
  771. }
  772. .info-content {
  773. display: flex;
  774. flex-direction: column;
  775. justify-content: space-between;
  776. .catalogue-icon {
  777. text-align: right;
  778. .svg-icon {
  779. cursor: pointer;
  780. }
  781. }
  782. .courseware {
  783. width: 159px;
  784. height: 64px;
  785. font-size: 16px;
  786. .name {
  787. font-weight: bold;
  788. }
  789. .editor {
  790. display: -webkit-box;
  791. overflow: hidden;
  792. text-overflow: ellipsis;
  793. word-break: break-word;
  794. white-space: normal;
  795. -webkit-line-clamp: 2; /* 多行省略行数,按需调整 */
  796. -webkit-box-orient: vertical;
  797. }
  798. }
  799. }
  800. }
  801. }
  802. .sidebar {
  803. position: relative;
  804. display: flex;
  805. width: $sidebar-width;
  806. .toolbar {
  807. display: flex;
  808. flex-direction: column;
  809. align-items: center;
  810. width: 60px;
  811. height: 100%;
  812. background-color: rgba(247, 248, 250, 100%);
  813. img {
  814. cursor: pointer;
  815. }
  816. &-special {
  817. display: flex;
  818. flex-direction: column;
  819. row-gap: 16px;
  820. margin-bottom: 24px;
  821. }
  822. &-list {
  823. display: flex;
  824. flex-direction: column;
  825. row-gap: 16px;
  826. align-items: center;
  827. width: 100%;
  828. .sidebar-item {
  829. width: 100%;
  830. text-align: center;
  831. .sidebar-icon {
  832. width: 36px;
  833. height: 36px;
  834. cursor: pointer;
  835. }
  836. &.active {
  837. background-color: #4095e5;
  838. }
  839. }
  840. }
  841. }
  842. .content {
  843. flex: 1;
  844. background-color: #fff;
  845. .resource_box {
  846. height: 100%;
  847. overflow-y: auto;
  848. border: 1px solid #e5e5e5;
  849. h5 {
  850. position: fixed;
  851. z-index: 999;
  852. width: 240px;
  853. padding: 0 5px;
  854. margin: 0;
  855. font-size: 18px;
  856. line-height: 40px;
  857. background: #f2f3f5;
  858. }
  859. .scroll-container {
  860. display: flex;
  861. flex-direction: column;
  862. row-gap: 8px;
  863. margin: 6px;
  864. .list-item {
  865. display: flex;
  866. align-items: center;
  867. cursor: pointer;
  868. border: 1px solid #ccc;
  869. border-radius: 8px;
  870. :deep .el-slider {
  871. .el-slider__runway {
  872. background-color: #eee;
  873. }
  874. }
  875. .el-image {
  876. display: flex;
  877. width: 100%;
  878. min-width: 100%;
  879. height: 90px;
  880. background-color: #ccc;
  881. border-radius: 8px;
  882. }
  883. .video-play {
  884. width: 100%;
  885. min-width: 100%;
  886. }
  887. .text-box {
  888. word-break: break-word;
  889. }
  890. }
  891. }
  892. p {
  893. color: #999;
  894. text-align: center;
  895. }
  896. .card-box li {
  897. padding: 10px;
  898. border-bottom: 1px solid #ccc;
  899. .el-icon-notebook-2 {
  900. display: block;
  901. margin-bottom: 4px;
  902. font-size: 12px;
  903. color: grey;
  904. }
  905. }
  906. }
  907. }
  908. .back-top {
  909. position: absolute;
  910. bottom: 0;
  911. left: 0;
  912. display: flex;
  913. place-content: center center;
  914. align-items: center;
  915. width: 60px;
  916. height: 60px;
  917. cursor: pointer;
  918. }
  919. }
  920. }
  921. }
  922. :deep .scroll-container .audio-wrapper {
  923. width: 100% !important;
  924. .audio-middle {
  925. width: 100% !important;
  926. padding: 6px 8px !important;
  927. border: none;
  928. border-radius: 8px;
  929. .audio-name {
  930. text-align: left;
  931. }
  932. .slider-area {
  933. column-gap: 8px !important;
  934. }
  935. :deep .remark-dialog {
  936. .el-dialog__body {
  937. padding: 5px 20px;
  938. }
  939. }
  940. :deep .audit-dialog {
  941. .el-dialog__body {
  942. height: calc(100vh - 260px);
  943. padding: 5px 20px;
  944. }
  945. .mind-map-container .mind-map {
  946. height: calc(100vh - 310px);
  947. }
  948. }
  949. }
  950. }
  951. .mt10 {
  952. margin: 10px 0 0 !important;
  953. background-color: #eee;
  954. }
  955. .courseware-tree {
  956. display: flex;
  957. flex: 1;
  958. flex-direction: column;
  959. row-gap: 8px;
  960. max-height: calc(100vh - 200px);
  961. overflow: auto;
  962. .menu-item {
  963. display: flex;
  964. align-items: center;
  965. &:not(.courseware) {
  966. font-weight: bold;
  967. }
  968. &.courseware {
  969. &:hover {
  970. .name {
  971. background-color: #f3f3f3;
  972. }
  973. }
  974. }
  975. .svg-icon {
  976. margin-left: 4px;
  977. &.my-edit-task {
  978. color: $right-color;
  979. }
  980. }
  981. .name {
  982. flex: 1;
  983. padding: 4px 8px 4px 4px;
  984. border-radius: 4px;
  985. }
  986. &.active {
  987. .name {
  988. font-weight: bold;
  989. color: #4095e5;
  990. }
  991. }
  992. }
  993. }
  994. </style>
  995. <style lang="scss">
  996. .tox-tinymce-aux {
  997. z-index: 9999 !important;
  998. }
  999. </style>