BookEep.vue 28 KB

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