BookEep.vue 28 KB

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