index.vue 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963
  1. <template>
  2. <div class="common-preview">
  3. <div class="common-preview__header">
  4. <div class="menu-container">
  5. {{ courseware_info.book_name }}
  6. </div>
  7. <div class="courseware">
  8. <span class="name-path">{{ courseware_info.name_path }}</span>
  9. <span class="flow-nodename">{{ courseware_info.cur_audit_flow_node_name }}</span>
  10. <slot name="middle" :courseware="courseware_info"></slot>
  11. <div class="group">
  12. <el-checkbox v-model="isShowGroup">显示分组</el-checkbox>
  13. <el-checkbox v-model="groupShowAll">分组显示全部</el-checkbox>
  14. <el-checkbox v-model="isJudgeCorrect">判断对错</el-checkbox>
  15. </div>
  16. <span class="link">
  17. <el-select v-model="lang" placeholder="请选择语言" size="mini" class="lang-select">
  18. <el-option v-for="item in langList" :key="item.type" :label="item.name" :value="item.type" />
  19. </el-select>
  20. </span>
  21. <span class="link">
  22. <el-checkbox v-model="chinese" true-label="zh-Hant" false-label="zh-Hans">繁体</el-checkbox>
  23. </span>
  24. <div class="operator">
  25. <slot name="operator" :courseware="courseware_info"></slot>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="audit-content">
  30. <!-- 左侧菜单栏 -->
  31. <aside v-if="navigationShow" class="left-menu">
  32. <div class="courseware-info">
  33. <div class="cover-image">
  34. <img v-if="project.cover_image_file_url.length > 0" :src="project.cover_image_file_url" alt="cover-image" />
  35. </div>
  36. <div class="info-content">
  37. <div class="catalogue-icon" @click="toggleNavigationShow">
  38. <SvgIcon icon-class="catalogue" size="54" />
  39. </div>
  40. <div class="courseware">
  41. <div class="name nowrap-ellipsis" :title="courseware_info.book_name">
  42. {{ courseware_info.book_name }}
  43. </div>
  44. <div class="editor" :title="project.editor">
  45. {{ project.editor }}
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <!-- 教材章节树 -->
  51. <div class="courseware-tree">
  52. <div
  53. v-for="{ id: nodeId, name, deep, is_leaf_chapter } in node_list"
  54. :key="nodeId"
  55. :class="['menu-item', { active: curSelectId === nodeId }, { courseware: isTrue(is_leaf_chapter) }]"
  56. :style="computedNameStyle(deep, isTrue(is_leaf_chapter))"
  57. @click="selectChapterNode(nodeId, isTrue(is_leaf_chapter))"
  58. >
  59. <span class="name nowrap-ellipsis" :title="name">
  60. {{ name }}
  61. </span>
  62. </div>
  63. </div>
  64. </aside>
  65. <div
  66. ref="previewMain"
  67. class="main-container"
  68. :style="{ paddingLeft: navigationShow ? '15px' : '315px', paddingRight: sidebarShow ? '15px' : '315px' }"
  69. >
  70. <!-- 左侧菜单栏 - 收缩 -->
  71. <div v-if="!navigationShow && !isFullScreen" class="catalogue-bar" @click="toggleNavigationShow">
  72. <SvgIcon icon-class="catalogue" size="54" />
  73. </div>
  74. <main :class="['preview-main']">
  75. <div class="preview-left"></div>
  76. <CoursewarePreview
  77. v-if="courseware_info.book_name"
  78. ref="courserware"
  79. :is-show-group="isShowGroup"
  80. :group-show-all="groupShowAll"
  81. :group-row-list="content_group_row_list"
  82. :data="data"
  83. :courseware-id="curSelectId"
  84. :component-list="component_list"
  85. :background="background"
  86. :can-remark="isTrue(courseware_info.is_my_audit_task) && isTrue(courseware_info.is_can_add_audit_remark)"
  87. :show-remark="false"
  88. :project="project"
  89. :component-remark-obj="remark_list_obj"
  90. @computeScroll="computeScroll"
  91. @editNote="handEditNote"
  92. @saveCollect="saveCollect"
  93. />
  94. <div class="preview-right"></div>
  95. </main>
  96. <!-- 右侧菜单栏 - 收缩 -->
  97. <aside v-if="!sidebarShow && !isFullScreen" class="sidebar-bar">
  98. <aside class="toolbar">
  99. <div class="toolbar-special">
  100. <img :src="require('@/assets/icon/sidebar-fullscreen.png')" alt="全屏" @click="fullScreen" />
  101. <img :src="require('@/assets/icon/sidebar-toolkit.png')" alt="工具箱" />
  102. <img :src="require(`@/assets/icon/arrow-down.png`)" alt="伸缩" @click="toggleSidebarShow" />
  103. </div>
  104. </aside>
  105. </aside>
  106. </div>
  107. <div v-if="!sidebarShow" class="back-top" @click="backTop">
  108. <img :src="require(`@/assets/icon/back-top.png`)" alt="返回顶部" />
  109. </div>
  110. <!-- 右侧工具栏 -->
  111. <aside v-if="sidebarShow" ref="sidebarMenu" class="sidebar">
  112. <aside class="toolbar">
  113. <div class="toolbar-special">
  114. <img :src="require('@/assets/icon/sidebar-fullscreen.png')" alt="全屏" @click="fullScreen" />
  115. <img :src="require('@/assets/icon/sidebar-toolkit.png')" alt="工具箱" />
  116. </div>
  117. <div v-if="sidebarShow" class="toolbar-list">
  118. <div
  119. v-for="{ icon, title, handle, param, children } in sidebarIconList"
  120. :key="icon"
  121. :class="['sidebar-item', { active: curToolbarIcon === icon }]"
  122. :title="title"
  123. @click="handleSidebarClick(handle, param, icon, children)"
  124. >
  125. <div
  126. class="sidebar-icon icon-mask"
  127. :style="{
  128. backgroundColor: curToolbarIcon === icon ? '#fff' : '#1E2129',
  129. maskImage: `url(${require(`@/assets/icon/sidebar-${icon}.svg`)})`,
  130. }"
  131. ></div>
  132. </div>
  133. </div>
  134. <div class="adjustable" @click="toggleSidebarShow">
  135. <img :src="require(`@/assets/icon/arrow-up.png`)" alt="伸缩" />
  136. </div>
  137. </aside>
  138. <div class="content">
  139. <div v-if="curToolbarIcon === 'search'" class="resource_box">
  140. <h5>{{ drawerTitle }}</h5>
  141. <div style="height: 40px"></div>
  142. <el-row :gutter="10" style="margin: 5px">
  143. <el-col :span="16">
  144. <el-input v-model="searchContent" placeholder="请输入文本内容" clearable />
  145. </el-col>
  146. <el-col :span="4">
  147. <el-button type="primary" @click="querySearchList"> 查询 </el-button>
  148. </el-col>
  149. </el-row>
  150. <div>
  151. <el-table :data="searchList" :show-header="false">
  152. <!-- <el-table-column prop="courseware_name" label="课件" />
  153. <el-table-column prop="component_type" label="组件" /> -->
  154. <el-table-column>
  155. <template #default="{ row }">
  156. {{ row.courseware_name + ' / ' + row.component_type_name }}
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="" width="50">
  160. <template #default="{ row }">
  161. <el-link type="primary" @click="handleLocation(row, 0)">定位</el-link>
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. </div>
  166. </div>
  167. <!-- <div v-if="curToolbarIcon === 'totalResources'" class="resource_box"></div> -->
  168. <div v-if="['image', 'audio', 'video', 'text'].includes(twoCurToolbarIcon)" class="resource_box">
  169. <div class="source-toolbar-list">
  170. <div
  171. v-for="{ icon, title, handle, param } in twoSidebarList"
  172. :key="icon"
  173. :class="['sidebar-item', { active: twoCurToolbarIcon === icon }]"
  174. :title="title"
  175. @click="handleSidebarClick(handle, param, icon, '', 2)"
  176. >
  177. <div
  178. class="sidebar-icon icon-mask"
  179. :style="{
  180. backgroundColor: twoCurToolbarIcon === icon ? '#fff' : '#1E2129',
  181. maskImage: `url(${require(`@/assets/icon/sidebar-${icon}.svg`)})`,
  182. }"
  183. ></div>
  184. </div>
  185. </div>
  186. <div style="height: 40px"></div>
  187. <el-collapse v-model="activeBookChapterId" accordion @change="multimediaHandleChange">
  188. <el-collapse-item
  189. v-for="chapter in bookChapterList"
  190. :key="chapter.id"
  191. :name="chapter.id"
  192. :title="chapter.name"
  193. >
  194. <!-- 加载状态 -->
  195. <div v-if="multimediaLoadingStates" class="loading-text">加载中...</div>
  196. <!-- 加载完成显示数据 -->
  197. <div v-else-if="chapter.data">
  198. <ul
  199. :class="parseInt(drawerType) == 5 ? 'scroll-container file-list' : 'scroll-container'"
  200. infinite-scroll-disabled="disabled"
  201. :infinite-scroll-immediate="false"
  202. >
  203. <li v-for="(item, index) in chapter.data" :key="`${chapter.id}-${index}`" class="list-item">
  204. <template v-if="parseInt(drawerType) === 0">
  205. <el-image v-if="shouldMediaShowItem(chapter, item)" :src="item.file_url" fit="contain" />
  206. </template>
  207. <template v-else-if="parseInt(drawerType) === 1">
  208. <AudioPlay
  209. v-if="shouldMediaShowItem(chapter, item)"
  210. view-size="middle"
  211. :file-id="item.file_id"
  212. :file-name="item.file_name.slice(0, item.file_name.lastIndexOf('.'))"
  213. :show-slider="true"
  214. :audio-index="index"
  215. />
  216. </template>
  217. <template v-else-if="parseInt(drawerType) === 2">
  218. <VideoPlay
  219. v-if="shouldMediaShowItem(chapter, item)"
  220. view-size="small"
  221. :file-id="item.file_id"
  222. :video-index="index"
  223. />
  224. </template>
  225. <template v-else-if="parseInt(drawerType) === 3"> </template>
  226. <template v-else-if="parseInt(drawerType) === 4"> </template>
  227. <template v-else-if="parseInt(drawerType) === 5">
  228. <div class="file-name">
  229. <span>
  230. <SvgIcon icon-class="file" size="24" />
  231. <p>
  232. <span>{{ item.file_name }}</span>
  233. </p>
  234. </span>
  235. <div>
  236. <SvgIcon
  237. v-show="item.file_id"
  238. icon-class="uploadPreview"
  239. size="24"
  240. @click="viewDialog(item)"
  241. />
  242. <img
  243. style="width: 24px; height: 24px; cursor: pointer"
  244. src="@/assets/download.png"
  245. alt="download"
  246. @click="downLoad(item)"
  247. />
  248. </div>
  249. </div>
  250. </template>
  251. <!-- 资源底部的操作 -->
  252. <div class="file-handle-info">
  253. <span v-if="![1, 5].includes(parseInt(drawerType))" class="word">{{ item.file_name }}</span>
  254. <div class="mark">
  255. <span></span>
  256. <el-link type="primary" class="el-icon-place linkLocation" @click="handleLocation(item, 0)" />
  257. </div>
  258. </div>
  259. </li>
  260. </ul>
  261. </div>
  262. <!-- 加载失败或未加载 -->
  263. <div v-else class="error-text">没有资源</div>
  264. </el-collapse-item>
  265. </el-collapse>
  266. </div>
  267. <div v-if="curToolbarIcon === 'collect'" class="resource_box">
  268. <h5>{{ drawerTitle }}</h5>
  269. <div style="height: 40px"></div>
  270. <ul v-if="allCottectList.length > 0" class="card-box">
  271. <li v-for="item in allCottectList" :key="item.id">
  272. <span class="el-icon-notebook-2"> 原文</span>
  273. <span>{{ item.text }}</span>
  274. <div>
  275. <el-button type="text" class="el-icon-delete" @click="handDelCollect(item.id)"> 删除</el-button>
  276. <el-divider direction="vertical" />
  277. <el-button type="text" class="el-icon-place" @click="handleLocation(item, 12)"> 定位</el-button>
  278. </div>
  279. </li>
  280. </ul>
  281. </div>
  282. <div v-if="curToolbarIcon === 'note'" class="resource_box">
  283. <h5>{{ drawerTitle }}</h5>
  284. <div style="height: 40px"></div>
  285. <ul v-if="allNoteList.length > 0" class="card-box">
  286. <li v-for="item in allNoteList" :key="item.id">
  287. <span class="el-icon-notebook-2"> 原文</span>
  288. <span>{{ item.text }}</span>
  289. <el-divider class="mt10" />
  290. <span v-html="item.note"></span>
  291. <div>
  292. <el-button type="text" class="el-icon-edit" @click="handEditNote(item)"> 编辑</el-button>
  293. <el-divider direction="vertical" />
  294. <el-button type="text" class="el-icon-delete" @click="handDelNote(item.id)"> 删除</el-button>
  295. <el-divider direction="vertical" />
  296. <el-button type="text" class="el-icon-place" @click="handleLocation(item, 1)"> 定位</el-button>
  297. </div>
  298. </li>
  299. </ul>
  300. </div>
  301. <template v-if="curToolbarIcon === 'audit'">
  302. <AuditRemark :remark-list="remark_list" :is-audit="isShowAudit" @deleteRemarks="deleteRemarks" />
  303. </template>
  304. </div>
  305. <div class="back-top" @click="backTop">
  306. <img :src="require(`@/assets/icon/back-top.png`)" alt="返回顶部" />
  307. </div>
  308. </aside>
  309. </div>
  310. <el-dialog title="" :visible="visibleMindMap" width="1100px" class="audit-dialog" @close="dialogClose('MindMap')">
  311. <MindMap
  312. v-if="isChildDataLoad"
  313. ref="mindMapRef"
  314. :project-id="projectId"
  315. :mind-map-json-data="mindMapJsonData"
  316. @child-click="handleNodeClick"
  317. />
  318. </el-dialog>
  319. <el-dialog
  320. title=""
  321. :visible="visibleVisNetwork"
  322. width="1100px"
  323. class="audit-dialog"
  324. :close-on-click-modal="false"
  325. @close="dialogClose('VisNetwork')"
  326. >
  327. <VisNetwork ref="visNetworkRef" :book-id="projectId" @child-click="handleNodeClick" />
  328. </el-dialog>
  329. <ExplanatoryNoteDialog
  330. ref="explanatoryNote"
  331. :open.sync="editDialogOpen"
  332. :init-data="oldRichData"
  333. title-text="笔记"
  334. @confirm="saveNote"
  335. @cancel="delNote"
  336. />
  337. <el-dialog
  338. v-if="fileViewVisible"
  339. :visible.sync="fileViewVisible"
  340. :show-close="true"
  341. :close-on-click-modal="true"
  342. :modal-append-to-body="true"
  343. :append-to-body="true"
  344. :lock-scroll="true"
  345. :width="isMobile ? '100%' : '80%'"
  346. top="0"
  347. >
  348. <iframe v-if="fileViewVisible" :src="newpath" width="100%" :height="iframeHeight" frameborder="0"></iframe>
  349. </el-dialog>
  350. </div>
  351. </template>
  352. <script>
  353. import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview.vue';
  354. import { isTrue } from '@/utils/validate';
  355. import { getConfig, getToken } from '@/utils/auth';
  356. import MindMap from '@/components/MindMap.vue';
  357. import VideoPlay from '@/views/book/courseware/preview/components/common/VideoPlay.vue';
  358. import AudioPlay from '@/views/book/courseware/preview/components/common/AudioPlay.vue';
  359. import ExplanatoryNoteDialog from '@/components/ExplanatoryNoteDialog.vue';
  360. import VisNetwork from '@/components/VisNetwork.vue';
  361. import * as OpenCC from 'opencc-js';
  362. import { GetBookCoursewareInfo, GetCoursewareAuditRemarkList, GetProjectInfo } from '@/api/project';
  363. import {
  364. ContentGetCoursewareContent_View,
  365. ChapterGetBookChapterStructExpandList,
  366. GetBookBaseInfo,
  367. MangerGetBookMindMap,
  368. GetBookChapterStructExpandList,
  369. PageQueryBookResourceList,
  370. GetLanguageTypeList,
  371. GetBookUnifiedAttrib,
  372. GetMyNoteList,
  373. DeleteMyNote,
  374. AddMyNote,
  375. UpdateMyNote,
  376. AddMyCollect,
  377. GetMyCollectList,
  378. DeleteMyCollect,
  379. SearchBookContentText,
  380. } from '@/api/book';
  381. import { getLocalStore } from '@/utils/auth';
  382. import { toggleFullScreen } from '@/utils/common';
  383. export default {
  384. name: 'CommonPreview',
  385. components: {
  386. CoursewarePreview,
  387. MindMap,
  388. VideoPlay,
  389. AudioPlay,
  390. ExplanatoryNoteDialog,
  391. VisNetwork,
  392. },
  393. provide() {
  394. return {
  395. getLang: () => this.lang,
  396. getChinese: () => this.chinese,
  397. getLangList: () => this.langList,
  398. convertText: this.convertText,
  399. getProjectId: () => this.projectId,
  400. getSelectId: () => this.select_node,
  401. getTitleList: () => this.title_list,
  402. getPermissionControl: () => this.permissionControl,
  403. };
  404. },
  405. data() {
  406. const sidebarIconList = [
  407. { icon: 'search', title: '搜索', handle: 'getSearch', param: { type: '13' } },
  408. { icon: 'mindmap', title: '思维导图', handle: 'openMindMap', param: {} },
  409. { icon: 'knowledge', title: '知识图谱', handle: 'openVisNetwork', param: {} },
  410. {
  411. icon: 'totalResources',
  412. title: '总资源',
  413. handle: '',
  414. param: {},
  415. children: [
  416. { icon: 'audio', title: '音频', handle: 'openDrawer', param: { type: '1' } },
  417. { icon: 'image', title: '图片', handle: 'openDrawer', param: { type: '0' } },
  418. { icon: 'video', title: '视频', handle: 'openDrawer', param: { type: '2' } },
  419. { icon: 'text', title: '文本', handle: 'openDrawer', param: { type: '5' } },
  420. ],
  421. },
  422. { icon: 'collect', title: '收藏', handle: 'getCollect', param: { type: '11' } },
  423. { icon: 'note', title: '笔记', handle: 'getNote', param: { type: '12' } },
  424. { icon: 'translate', title: '翻译', handle: '', param: {} },
  425. { icon: 'setting', title: '设置', handle: '', param: {} },
  426. ];
  427. const book_id = getLocalStore('book_id') || '';
  428. return {
  429. projectId: book_id,
  430. select_node: this.id,
  431. file_preview_url: getConfig() ? getConfig().doc_preview_service_address : '',
  432. newpath: '',
  433. fileViewVisible: false,
  434. iframeHeight: `${window.innerHeight - 100}px`,
  435. courseware_info: {
  436. book_name: '',
  437. is_can_start_edit: 'false',
  438. is_can_submit_audit: 'false',
  439. is_can_audit_pass: 'false',
  440. is_can_audit_reject: 'false',
  441. is_can_add_audit_remark: 'false',
  442. is_can_finish_audit: 'false',
  443. is_can_request_shangjia_book: 'false',
  444. is_can_request_rollback_project: 'false',
  445. is_can_shangjia_book: 'false',
  446. is_can_rollback_project: 'false',
  447. },
  448. background: {
  449. background_image_url: '',
  450. background_position: {
  451. left: 0,
  452. top: 0,
  453. },
  454. },
  455. node_list: [],
  456. data: { row_list: [] },
  457. component_list: [],
  458. content_group_row_list: [],
  459. remark_list: [],
  460. remark_list_obj: {}, // 存放以组件为对象的数组
  461. searchList: [],
  462. searchContent: '',
  463. visible: false,
  464. remark_content: '',
  465. submit_loading: false,
  466. isTrue,
  467. menuPosition: {
  468. x: -1,
  469. y: -1,
  470. componentId: 'WHOLE',
  471. },
  472. curToolbarIcon: this.isShowAudit ? 'audit' : '',
  473. sidebarIconList,
  474. twoSidebarList: [],
  475. twoCurToolbarIcon: '',
  476. visibleMindMap: false,
  477. visibleVisNetwork: false,
  478. isChildDataLoad: false,
  479. mindMapJsonData: {}, // 思维导图json数据
  480. drawerType: '', // 抽屉类型
  481. drawerStyle: {
  482. top: '0',
  483. height: '0',
  484. right: '0',
  485. },
  486. page_capacity: 10,
  487. cur_page: 1,
  488. file_list: [],
  489. total_count: 0,
  490. loading: false,
  491. lastLoadTime: 0,
  492. minLoadInterval: 3 * 1000,
  493. isShowGroup: false,
  494. groupShowAll: true,
  495. opencc: OpenCC.Converter({ from: 'cn', to: 'tw' }),
  496. langList: [],
  497. lang: 'ZH',
  498. chinese: 'zh-Hans',
  499. isJudgeCorrect: false,
  500. unified_attrib: {},
  501. curSelectId: this.id,
  502. navigationShow: true,
  503. sidebarShow: true,
  504. project: {
  505. editor: '', // 作者
  506. cover_image_file_id: null, // 封面图片ID
  507. cover_image_file_url: '', // 封面图片URL
  508. },
  509. allNoteList: [],
  510. editDialogOpen: false,
  511. oldRichData: {},
  512. newSelectedInfo: null,
  513. allCottectList: [],
  514. bookChapterList: [],
  515. book_id: '',
  516. activeBookChapterId: '',
  517. multimediaLoadingStates: true,
  518. isFullScreen: false, // 是否全屏状态
  519. title_list: [],
  520. // 模拟答题权限控制
  521. permissionControl: {
  522. can_answer: true, // 可作答
  523. can_judge_correct: true, // 可判断对错(客观题)
  524. can_show_answer: true, // 可查看答案
  525. can_correct: false, // 可批改
  526. can_check_correct: false, // 可查看批改
  527. },
  528. };
  529. },
  530. computed: {
  531. disabled() {
  532. const result = this.loading || this.noMore;
  533. return result;
  534. },
  535. noMore() {
  536. const result = this.file_list.length >= this.total_count;
  537. return result;
  538. },
  539. drawerTitle() {
  540. const titleMap = {
  541. 0: '图片资源',
  542. 1: '音频资源',
  543. 2: '视频资源',
  544. 5: '文本资源',
  545. 11: '收藏列表',
  546. 12: '笔记列表',
  547. 13: '搜索结果',
  548. };
  549. return titleMap[this.drawerType] || '资源列表';
  550. },
  551. shouldMediaShowItem() {
  552. return (chapter, item) => {
  553. return this.activeBookChapterId === chapter.id && item && item.file_id;
  554. };
  555. },
  556. },
  557. watch: {
  558. isJudgeCorrect() {
  559. this.simulateAnswer();
  560. },
  561. curSelectId() {
  562. if (this.curToolbarIcon === 'note') {
  563. this.getNote();
  564. } else if (this.curToolbarIcon === 'collect') {
  565. this.getCollect();
  566. }
  567. },
  568. },
  569. mounted() {
  570. this.calcDrawerPosition();
  571. },
  572. created() {
  573. this.getBookBaseInfo();
  574. this.getBookChapterStructExpandList();
  575. this.getBookUnifiedAttr();
  576. this.getProjectInfo();
  577. // 监听全屏事件
  578. document.addEventListener('fullscreenchange', () => {
  579. if (document.fullscreenElement) {
  580. this.isFullScreen = true;
  581. } else {
  582. this.isFullScreen = false;
  583. }
  584. });
  585. },
  586. beforeDestroy() {
  587. document.removeEventListener('fullscreenchange', () => {});
  588. },
  589. methods: {
  590. selectFirstLeafNode() {
  591. if (!this.node_list || this.node_list.length === 0) return;
  592. let node = this.node_list.find((x) => this.isTrue(x.is_leaf_chapter));
  593. if (!node) return;
  594. this.selectChapterNode(node.id, true);
  595. },
  596. getBookBaseInfo() {
  597. GetBookBaseInfo({ id: this.projectId }).then(({ book_info }) => {
  598. this.courseware_info = { ...this.courseware_info, ...book_info, book_name: book_info.name };
  599. if (book_info.cover_image_file_id) {
  600. this.project.cover_image_file_url = book_info.cover_image_file_url;
  601. }
  602. if (book_info.editor) {
  603. this.project.editor = book_info.editor;
  604. }
  605. if (book_info.cover_image_file_url) {
  606. this.project.cover_image_file_url = book_info.cover_image_file_url;
  607. }
  608. });
  609. },
  610. getProjectInfo() {
  611. GetProjectInfo({ id: this.projectId }).then(({ project_info }) => {
  612. if (project_info.cover_image_file_url) {
  613. this.project = project_info;
  614. }
  615. });
  616. },
  617. /**
  618. * 得到教材课件信息
  619. * @param {string} id - 课件ID
  620. */
  621. getBookCoursewareInfo(id) {
  622. GetBookCoursewareInfo({ id, is_contain_producer: 'true', is_contain_auditor: 'true' }).then(
  623. ({ courseware_info }) => {
  624. this.courseware_info = { ...this.courseware_info, ...courseware_info };
  625. this.getLangList();
  626. }
  627. );
  628. },
  629. /**
  630. * 得到课件内容(展示内容)
  631. * @param {string} id - 课件ID
  632. */
  633. getCoursewareComponentContent_View(id) {
  634. ContentGetCoursewareContent_View({ id }).then(
  635. ({ content, component_list, content_group_row_list, title_list }) => {
  636. if (title_list) this.title_list = title_list || [];
  637. if (content) {
  638. const _content = JSON.parse(content);
  639. this.data = _content;
  640. this.background = {
  641. background_image_url: _content.background_image_url,
  642. background_position: _content.background_position,
  643. };
  644. } else {
  645. this.data = { row_list: [] };
  646. }
  647. if (component_list) this.component_list = component_list;
  648. this.component_list.forEach((x) => {
  649. if (x.component_type === 'audio') {
  650. let _c = JSON.parse(x.content);
  651. let p = _c.property || {};
  652. if (!p.file_name_display_mode) p.file_name_display_mode = 'true';
  653. if (p.view_method === 'independent' && !p.style_mode) {
  654. p.style_mode = 'middle';
  655. }
  656. if (!p.style_mode) p.style_mode = 'big';
  657. if (p.view_method === 'icon') {
  658. p.file_name_display_mode = 'false';
  659. p.view_method = 'independent';
  660. p.style_mode = 'small';
  661. }
  662. x.content = JSON.stringify(_c);
  663. } else if (x.component_type === 'richtext') {
  664. let _c = JSON.parse(x.content);
  665. let p = _c.property || {};
  666. let lev = Number(p.title_style_level);
  667. if (p.is_title !== 'true' || lev < 1 || !_c.content) return;
  668. let style = title_list.find((y) => y.level === lev) || {};
  669. if (style && style.style) {
  670. style = JSON.parse(style.style);
  671. let c_text = _c.content;
  672. const parser = new DOMParser();
  673. const doc = parser.parseFromString(c_text, 'text/html');
  674. const body = doc.body;
  675. const pElements = body.querySelectorAll('p');
  676. this.processHtmlString(pElements, style);
  677. _c.content = body.innerHTML;
  678. x.content = JSON.stringify(_c);
  679. }
  680. }
  681. });
  682. if (content_group_row_list) this.content_group_row_list = JSON.parse(content_group_row_list) || [];
  683. }
  684. );
  685. },
  686. processHtmlString(pElements, styleConfig, isClear) {
  687. pElements.forEach((pElement) => {
  688. if (isClear) {
  689. pElement.removeAttribute('style');
  690. } else {
  691. const style = pElement.style;
  692. if (styleConfig.font) style.fontFamily = styleConfig.font;
  693. if (styleConfig.font_size) style.fontSize = styleConfig.font_size;
  694. if (styleConfig.text_color) style.color = styleConfig.text_color;
  695. style.fontWeight = styleConfig.bold === 'true' ? 'bold' : 'normal';
  696. style.fontStyle = styleConfig.italic === 'true' ? 'italic' : 'normal';
  697. if (styleConfig.indent || styleConfig.indent === 0) style.marginLeft = `${styleConfig.indent}px`;
  698. }
  699. });
  700. },
  701. getLangList() {
  702. GetLanguageTypeList({ book_id: this.courseware_info.book_id, is_contain_zh: 'true' }).then(
  703. ({ language_type_list }) => {
  704. this.langList = language_type_list;
  705. }
  706. );
  707. },
  708. /**
  709. * 得到教材章节结构展开列表
  710. */
  711. getBookChapterStructExpandList() {
  712. ChapterGetBookChapterStructExpandList({
  713. book_id: this.projectId,
  714. node_deep_mode: 0,
  715. is_contain_producer: 'true',
  716. is_contain_auditor: 'true',
  717. }).then(({ node_list }) => {
  718. this.node_list = node_list;
  719. });
  720. },
  721. getBookUnifiedAttr() {
  722. GetBookUnifiedAttrib({ book_id: this.projectId }).then(({ content }) => {
  723. if (content) {
  724. this.unified_attrib = JSON.parse(content);
  725. }
  726. });
  727. },
  728. /**
  729. * 选择节点
  730. * @param {string} nodeId - 节点ID
  731. */
  732. selectNode(nodeId) {
  733. this.getCoursewareComponentContent_View(nodeId);
  734. this.getBookCoursewareInfo(nodeId);
  735. this.getCoursewareAuditRemarkList(nodeId);
  736. this.select_node = nodeId;
  737. },
  738. // 审校批注列表
  739. getCoursewareAuditRemarkList(id) {
  740. this.remark_list = [];
  741. let remarkListObj = {};
  742. GetCoursewareAuditRemarkList({
  743. courseware_id: id,
  744. }).then(({ remark_list }) => {
  745. this.remark_list = remark_list;
  746. if (!remark_list) return;
  747. remarkListObj = remark_list.reduce((acc, item) => {
  748. if (!acc[item.component_id]) {
  749. acc[item.component_id] = [];
  750. }
  751. acc[item.component_id].push(item);
  752. return acc;
  753. }, {});
  754. this.remark_list_obj = remarkListObj;
  755. });
  756. },
  757. dialogClose(type) {
  758. this[`visible${type}`] = false;
  759. },
  760. // 计算previewMain滑动距离
  761. computeScroll() {
  762. this.$refs.courserware.handleResult(
  763. this.$refs.previewMain.scrollTop,
  764. this.$refs.previewMain.scrollLeft,
  765. this.select_node
  766. );
  767. },
  768. /**
  769. * 处理侧边栏图标点击事件
  770. * @param {string} handle - 处理函数名
  771. * @param {any} param - 处理函数参数
  772. * @param {string} icon - 图标名称
  773. */
  774. handleSidebarClick(handle, param, icon, children, barLevel) {
  775. if (typeof handle === 'string' && handle && typeof this[handle] === 'function') {
  776. this[handle](param);
  777. }
  778. if (barLevel === 2) {
  779. this.twoCurToolbarIcon = icon;
  780. } else {
  781. this.curToolbarIcon = icon;
  782. this.twoCurToolbarIcon = '';
  783. }
  784. if (children && children.length > 0 && Array.isArray(children)) {
  785. this.twoSidebarList = children;
  786. this.twoCurToolbarIcon = children[0].icon;
  787. this.openDrawer(children[0].param);
  788. }
  789. },
  790. /**
  791. * 打开知识图谱
  792. */
  793. openMindMap() {
  794. MangerGetBookMindMap({ book_id: this.projectId }).then(({ content }) => {
  795. if (content) {
  796. this.mindMapJsonData = JSON.parse(content);
  797. this.isChildDataLoad = true;
  798. }
  799. });
  800. this.visibleMindMap = true;
  801. },
  802. async handleNodeClick(data) {
  803. let [nodeId, componentId] = data.split('#');
  804. if (nodeId) this.selectNode(nodeId);
  805. if (componentId) {
  806. let node = await this.$refs.courserware.findChildComponentByKey(componentId);
  807. if (node) {
  808. await this.$nextTick();
  809. this.$refs.previewMain.scrollTo({
  810. top: node.$el.offsetTop - 50,
  811. left: node.$el.offsetLeft - 50,
  812. behavior: 'smooth',
  813. });
  814. }
  815. }
  816. this.visibleMindMap = false;
  817. this.visibleVisNetwork = false;
  818. },
  819. async openVisNetwork() {
  820. this.visibleVisNetwork = true;
  821. },
  822. // 计算抽屉滑出位置
  823. calcDrawerPosition() {
  824. const menu = this.$refs.sidebarMenu;
  825. if (menu) {
  826. const rect = menu.getBoundingClientRect();
  827. this.drawerStyle = {
  828. top: `${rect.top}px`,
  829. height: `${rect.height}px`,
  830. left: `${rect.right - 240}px`,
  831. };
  832. }
  833. },
  834. /**
  835. * 打开抽屉并初始化加载
  836. * @param {Object} param - 抽屉参数
  837. * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频, 3:H5 游戏,4:3D 模型,5:文本)
  838. */
  839. openDrawer({ type }) {
  840. if (this.drawerType === type) {
  841. this.drawerType = '';
  842. return;
  843. }
  844. // 重置所有加载状态
  845. this.activeBookChapterId = '';
  846. this.resetLoadState();
  847. this.drawerType = type;
  848. this.$nextTick(() => {
  849. // 确保DOM更新后触发加载
  850. // this.loadMore();
  851. this.loadBookChapterStructExpandList();
  852. });
  853. },
  854. openAudit() {
  855. this.drawerType = '';
  856. },
  857. resetLoadState() {
  858. this.cur_page = 1;
  859. this.file_list = [];
  860. this.total_count = 0;
  861. this.loading = false;
  862. this.lastLoadTime = 0; // 重置时间戳,允许立即加载
  863. this.loadCount = 0;
  864. },
  865. /**
  866. * 加载章节
  867. */
  868. async loadBookChapterStructExpandList() {
  869. const params = {
  870. book_id: this.projectId,
  871. node_deep_mode: 3, // 节点深度模式 0【全部】,1【只查询章节】2【只查询非叶子章节】3【只查询第一层】
  872. is_contain_root_node: 'false', // 是否包含根节点(把教材作为根节点)
  873. is_contain_producer: 'false', // 是否包含制作人信息
  874. is_contain_auditor: 'false', // 是否包含审核人信息
  875. };
  876. await GetBookChapterStructExpandList(params).then(({ node_list }) => {
  877. this.bookChapterList = node_list || [];
  878. });
  879. },
  880. /**
  881. * 加载章节下的资源
  882. */
  883. async loadmultimediaList() {
  884. const params = {
  885. page_capacity: this.page_capacity,
  886. cur_page: this.cur_page,
  887. book_id: this.projectId,
  888. book_chapter_node_id: this.activeBookChapterId,
  889. type: parseInt(this.drawerType),
  890. scope: 0,
  891. };
  892. await PageQueryBookResourceList(params)
  893. .then(({ total_count, resource_list }) => {
  894. this.total_count = total_count;
  895. this.file_list = resource_list || [];
  896. })
  897. .finally(() => {
  898. this.loading = false;
  899. });
  900. },
  901. /**
  902. * 点击章节,切换数据
  903. */
  904. async multimediaHandleChange() {
  905. const item = this.bookChapterList.find((item) => item.id === this.activeBookChapterId);
  906. if (item) {
  907. this.multimediaLoadingStates = true;
  908. if (!item.data && !item.error) {
  909. await this.loadmultimediaList();
  910. let tmpList = this.file_list && this.file_list.length > 0 ? [...this.file_list] : null;
  911. this.$set(item, 'data', tmpList);
  912. this.multimediaLoadingStates = false;
  913. } else {
  914. this.multimediaLoadingStates = false;
  915. }
  916. }
  917. },
  918. // 加载更多数据
  919. async loadMore() {
  920. const now = Date.now();
  921. // 只有当lastLoadTime不为0(不是第一次)且时间间隔太短时才return
  922. if (this.lastLoadTime > 0 && now - this.lastLoadTime < this.minLoadInterval) {
  923. return;
  924. }
  925. if (this.disabled || this.loading) {
  926. if (this.lastLoadTime > 0) {
  927. return;
  928. }
  929. }
  930. this.loading = true;
  931. const params = {
  932. page_capacity: this.page_capacity,
  933. cur_page: this.cur_page,
  934. book_id: this.projectId,
  935. book_chapter_node_id: this.activeBookChapterId,
  936. type: parseInt(this.drawerType),
  937. };
  938. await PageQueryBookResourceList(params)
  939. .then(({ total_count, resource_list }) => {
  940. this.total_count = total_count;
  941. // 记录加载前的滚动高度
  942. const scrollContainer = this.$el.querySelector('.scroll-container');
  943. const isAtBottom = this.isScrollAtBottom(scrollContainer);
  944. this.file_list = this.cur_page === 1 ? resource_list : [...this.file_list, ...resource_list];
  945. if (!resource_list || resource_list.length === 0) {
  946. return;
  947. }
  948. this.cur_page += 1;
  949. // 只有当前已经在底部时才微调滚动位置
  950. if (isAtBottom) {
  951. this.$nextTick(() => {
  952. // 轻微向上滚动,创造滚动空间
  953. scrollContainer.scrollTop -= 5;
  954. });
  955. }
  956. })
  957. .finally(() => {
  958. this.loading = false;
  959. this.lastLoadTime = now;
  960. });
  961. },
  962. isScrollAtBottom(container) {
  963. if (!container) return false;
  964. return container.scrollHeight - container.scrollTop <= container.clientHeight + 5;
  965. },
  966. async handleFileClick(courseware_id, component_id) {
  967. if (courseware_id) this.selectNode(courseware_id);
  968. if (component_id) {
  969. let node = await this.$refs.courserware.findChildComponentByKey(component_id);
  970. if (node) {
  971. await this.$nextTick();
  972. this.$refs.previewMain.scrollTo({
  973. top: node.offsetTop - 50,
  974. left: node.offsetLeft - 50,
  975. behavior: 'smooth',
  976. });
  977. }
  978. }
  979. },
  980. /**
  981. * 文本转换
  982. * @param {string} text - 要转换的文本
  983. * @returns {string} - 转换后的文本
  984. */
  985. convertText(text) {
  986. if (this.chinese === 'zh-Hant' && this.opencc) {
  987. try {
  988. if (/<[a-z][\s\S]*>/i.test(text)) {
  989. return this.convertHtmlPreserveAttributes(text);
  990. }
  991. } catch (e) {
  992. return text;
  993. }
  994. return this.opencc(text);
  995. }
  996. return text;
  997. },
  998. /**
  999. * 使用OpenCC解析HTML并仅转换文本节点,保留属性(包括内联样式/font-family)保持不变。防止字体名称像“微软雅黑' 正在转换为'微軟雅黑'.
  1000. */
  1001. convertHtmlPreserveAttributes(html) {
  1002. try {
  1003. const parser = new DOMParser();
  1004. const doc = parser.parseFromString(html, 'text/html');
  1005. // 跳过这些标记内的转换
  1006. const skipTags = new Set(['SCRIPT', 'STYLE']);
  1007. const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT, null, false);
  1008. let node = walker.nextNode();
  1009. while (node) {
  1010. const parent = node.parentNode;
  1011. if (parent && !skipTags.has(parent.nodeName)) {
  1012. const v = node.nodeValue;
  1013. if (v && v.trim()) {
  1014. node.nodeValue = this.opencc(v);
  1015. }
  1016. }
  1017. node = walker.nextNode();
  1018. }
  1019. return doc.body.innerHTML;
  1020. } catch (err) {
  1021. try {
  1022. return this.opencc(html);
  1023. } catch (e) {
  1024. return html;
  1025. }
  1026. }
  1027. },
  1028. /**
  1029. * 模拟答题
  1030. * @param {boolean} [disabled=true] - 是否禁用
  1031. */
  1032. simulateAnswer(disabled = true) {
  1033. this.$refs.courserware.simulateAnswer(this.isJudgeCorrect, false, disabled);
  1034. },
  1035. /**
  1036. * 选择节点
  1037. * @param {string} nodeId - 节点ID
  1038. * @param {boolean} isLeaf - 是否是叶子节点
  1039. */
  1040. selectChapterNode(nodeId, isLeaf) {
  1041. if (!isLeaf) return;
  1042. if (this.curSelectId === nodeId) return;
  1043. this.curSelectId = nodeId;
  1044. this.selectNode(nodeId);
  1045. },
  1046. /**
  1047. * 计算章节名称样式
  1048. * @param {number} deep - 节点深度
  1049. * @param {boolean} isLeaf - 是否是叶子节点
  1050. * @returns {Object} - 样式对象
  1051. */
  1052. computedNameStyle(deep, isLeaf) {
  1053. return {
  1054. 'padding-left': `${(deep - 1) * 8}px`,
  1055. cursor: isLeaf ? 'pointer' : 'auto',
  1056. };
  1057. },
  1058. /**
  1059. * 切换左侧导航栏显示与隐藏
  1060. */
  1061. toggleNavigationShow() {
  1062. this.navigationShow = !this.navigationShow;
  1063. },
  1064. /**
  1065. * 切换右侧工具栏显示与隐藏
  1066. */
  1067. toggleSidebarShow() {
  1068. this.sidebarShow = !this.sidebarShow;
  1069. },
  1070. backTop() {
  1071. this.$refs.previewMain.scrollTo({
  1072. top: 0,
  1073. left: 0,
  1074. behavior: 'smooth',
  1075. });
  1076. },
  1077. /**
  1078. * 定位到对应位置
  1079. * @param {Object} item - 位置对象
  1080. * @param {number} type - 定位类型(11: 笔记定位, 12: 收藏定位, 0: 资源定位)
  1081. */
  1082. handleLocation(item, type) {
  1083. if (type === 0) {
  1084. let did = `${item.courseware_id}#${item.component_id}`;
  1085. this.handleNodeClick(did);
  1086. this.curSelectId = item.courseware_id;
  1087. return;
  1088. }
  1089. if (this.$refs.courserware && this.$refs.courserware.handleLocation) {
  1090. item.type = type;
  1091. this.$refs.courserware.handleLocation(item);
  1092. }
  1093. },
  1094. downLoad(file) {
  1095. debugger
  1096. let userInfor = getToken();
  1097. let AccessToken = '';
  1098. if (userInfor) {
  1099. AccessToken = userInfor.access_token;
  1100. }
  1101. let FileID = file.file_id;
  1102. let data = {
  1103. AccessToken,
  1104. FileID,
  1105. };
  1106. location.href = `${process.env.VUE_APP_EEP}/FileServer/WebFileDownload?AccessToken=${data.AccessToken}&FileID=${data.FileID}`;
  1107. },
  1108. // 预览
  1109. viewDialog(file) {
  1110. this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(file.file_url)}`;
  1111. this.fileViewVisible = true;
  1112. },
  1113. /**
  1114. * 获取笔记列表
  1115. * @param {Object} params - 参数对象
  1116. */
  1117. async getNote(params) {
  1118. if (params && params.type) this.drawerType = Number(params.type);
  1119. this.allNoteList = [];
  1120. await GetMyNoteList({ courseware_id: this.curSelectId }).then((res) => {
  1121. if (res.status === 1) {
  1122. res.note_list.forEach((x) => {
  1123. if (x.note_desc) {
  1124. let n = JSON.parse(x.note_desc);
  1125. let obj = {
  1126. coursewareId: x.courseware_id,
  1127. id: x.id,
  1128. blockId: n.blockId,
  1129. startIndex: n.startIndex,
  1130. endIndex: n.endIndex,
  1131. text: n.text,
  1132. note: n.note,
  1133. };
  1134. this.allNoteList.push(obj);
  1135. }
  1136. });
  1137. }
  1138. });
  1139. },
  1140. async handEditNote(note) {
  1141. this.oldRichData = {};
  1142. if (this.allNoteList.length === 0) {
  1143. await this.getNote();
  1144. }
  1145. let old = this.allNoteList.find(
  1146. (x) =>
  1147. x.coursewareId === note.coursewareId &&
  1148. x.blockId === note.blockId &&
  1149. x.startIndex === note.startIndex &&
  1150. x.endIndex === note.endIndex
  1151. );
  1152. if (old) {
  1153. this.oldRichData = old;
  1154. }
  1155. this.newSelectedInfo = note;
  1156. this.editDialogOpen = true;
  1157. },
  1158. saveNote(note) {
  1159. let noteInfo = {
  1160. blockId: this.newSelectedInfo.blockId,
  1161. startIndex: this.newSelectedInfo.startIndex,
  1162. endIndex: this.newSelectedInfo.endIndex,
  1163. note: note.note,
  1164. text: this.newSelectedInfo.text,
  1165. };
  1166. let reqData = {
  1167. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  1168. component_id: 'WHOLE',
  1169. note_desc: JSON.stringify(noteInfo), // 位置描述
  1170. };
  1171. if (note.id) {
  1172. if (!noteInfo.note) {
  1173. this.delNote(note.id);
  1174. return;
  1175. }
  1176. let upDate = {
  1177. id: note.id,
  1178. note_desc: reqData.note_desc,
  1179. };
  1180. UpdateMyNote(upDate).then(() => {
  1181. this.getNote();
  1182. });
  1183. } else {
  1184. AddMyNote(reqData).then(() => {
  1185. this.getNote();
  1186. });
  1187. }
  1188. this.editDialogOpen = false;
  1189. this.newSelectedInfo = null;
  1190. this.selectedInfo = null;
  1191. },
  1192. handDelNote(id) {
  1193. this.$confirm('确定要删除此条笔记吗?', '提示', {
  1194. confirmButtonText: '确定',
  1195. cancelButtonText: '取消',
  1196. type: 'warning',
  1197. })
  1198. .then(() => {
  1199. this.delNote(id);
  1200. })
  1201. .catch(() => {});
  1202. },
  1203. delNote(id) {
  1204. const noteId = id || (this.oldRichData && this.oldRichData.id);
  1205. if (!noteId) return;
  1206. DeleteMyNote({ id: noteId }).then(() => {
  1207. this.allNoteList = this.allNoteList.filter((x) => x.id !== noteId);
  1208. });
  1209. },
  1210. async getCollect(params) {
  1211. if (params && params.type) this.drawerType = Number(params.type);
  1212. this.allCottectList = [];
  1213. await GetMyCollectList({ courseware_id: this.curSelectId }).then((res) => {
  1214. if (res.status === 1) {
  1215. res.collect_list.forEach((x) => {
  1216. if (x.collect_desc) {
  1217. let n = JSON.parse(x.collect_desc);
  1218. let obj = {
  1219. coursewareId: x.courseware_id,
  1220. id: x.id,
  1221. blockId: n.blockId,
  1222. startIndex: n.startIndex,
  1223. endIndex: n.endIndex,
  1224. text: n.text,
  1225. };
  1226. this.allCottectList.push(obj);
  1227. }
  1228. });
  1229. }
  1230. });
  1231. },
  1232. async saveCollect(collect) {
  1233. if (this.allCottectList.length === 0) {
  1234. await this.getCollect();
  1235. }
  1236. let old = this.allCottectList.find(
  1237. (x) =>
  1238. x.coursewareId === collect.coursewareId &&
  1239. x.blockId === collect.blockId &&
  1240. x.startIndex === collect.startIndex &&
  1241. x.endIndex === collect.endIndex
  1242. );
  1243. if (old) {
  1244. this.$message({
  1245. dangerouslyUseHTMLString: true,
  1246. message: "<i class='el-icon-check' />已收藏",
  1247. });
  1248. return;
  1249. }
  1250. this.newSelectedInfo = collect;
  1251. let collectInfo = {
  1252. blockId: this.newSelectedInfo.blockId,
  1253. startIndex: this.newSelectedInfo.startIndex,
  1254. endIndex: this.newSelectedInfo.endIndex,
  1255. text: this.newSelectedInfo.text,
  1256. };
  1257. let reqData = {
  1258. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  1259. component_id: 'WHOLE',
  1260. collect_desc: JSON.stringify(collectInfo), // 位置描述
  1261. };
  1262. AddMyCollect(reqData)
  1263. .then(() => {
  1264. this.getCollect();
  1265. })
  1266. .then(() => {
  1267. this.$message({
  1268. dangerouslyUseHTMLString: true,
  1269. message: "<i class='el-icon-check' />已收藏",
  1270. });
  1271. });
  1272. },
  1273. handDelCollect(id) {
  1274. this.$confirm('确定要删除此条收藏吗?', '提示', {
  1275. confirmButtonText: '确定',
  1276. cancelButtonText: '取消',
  1277. type: 'warning',
  1278. })
  1279. .then(() => {
  1280. DeleteMyCollect({ id }).then(() => {
  1281. this.allCottectList = this.allCottectList.filter((x) => x.id !== id);
  1282. });
  1283. })
  1284. .catch(() => {});
  1285. },
  1286. getSearch(params) {
  1287. if (params && params.type) this.drawerType = Number(params.type);
  1288. },
  1289. async querySearchList() {
  1290. this.searchList = [];
  1291. if (!this.searchContent) return;
  1292. await SearchBookContentText({ book_id: this.projectId, text: this.searchContent }).then((res) => {
  1293. if (res.status === 1) {
  1294. this.searchList = res.courseware_component_list;
  1295. }
  1296. });
  1297. },
  1298. fullScreen() {
  1299. toggleFullScreen(this.$refs.previewMain);
  1300. },
  1301. },
  1302. };
  1303. </script>
  1304. <style lang="scss" scoped>
  1305. @use '@/styles/mixin.scss' as *;
  1306. $total-width: $courseware-width + $courseware-left-margin + $courseware-right-margin;
  1307. .common-preview {
  1308. &__header {
  1309. position: sticky;
  1310. top: 0;
  1311. left: 0;
  1312. z-index: 9;
  1313. display: flex;
  1314. align-items: center;
  1315. height: 40px;
  1316. padding: 6px 4px;
  1317. margin-bottom: 5px;
  1318. background-color: #fff;
  1319. border-top: $border;
  1320. border-bottom: $border;
  1321. > .menu-container {
  1322. display: flex;
  1323. justify-content: space-between;
  1324. width: 360px;
  1325. padding: 4px 8px;
  1326. border-right: $border;
  1327. }
  1328. > .courseware {
  1329. display: flex;
  1330. flex-grow: 1;
  1331. column-gap: 16px;
  1332. align-items: center;
  1333. justify-content: space-between;
  1334. height: 40px;
  1335. .name-path {
  1336. min-width: 200px;
  1337. height: 40px;
  1338. padding: 4px 8px;
  1339. font-size: 14px;
  1340. line-height: 32px;
  1341. border-right: $border;
  1342. }
  1343. .lang-select {
  1344. :deep .el-input {
  1345. width: 100px;
  1346. }
  1347. :deep .el-input__inner {
  1348. height: 24px;
  1349. line-height: 24px;
  1350. background-color: #fff;
  1351. }
  1352. :deep .el-input__icon {
  1353. line-height: 24px;
  1354. }
  1355. }
  1356. .flow-nodename {
  1357. flex: 1;
  1358. }
  1359. .group {
  1360. display: flex;
  1361. align-items: center;
  1362. }
  1363. .operator {
  1364. display: flex;
  1365. column-gap: 8px;
  1366. align-items: center;
  1367. .link {
  1368. + .link {
  1369. margin-left: 0;
  1370. &::before {
  1371. margin-right: 8px;
  1372. color: #999;
  1373. content: '|';
  1374. }
  1375. }
  1376. }
  1377. }
  1378. }
  1379. }
  1380. .main-container {
  1381. position: relative;
  1382. flex: 1;
  1383. min-width: 1110px;
  1384. padding: 15px 0;
  1385. overflow: auto;
  1386. background-color: #ececec;
  1387. .catalogue-bar {
  1388. position: absolute;
  1389. top: 15px;
  1390. left: 0;
  1391. display: flex;
  1392. align-items: center;
  1393. justify-content: center;
  1394. width: 54px;
  1395. height: 54px;
  1396. margin: -9px 6px 0 240px;
  1397. cursor: pointer;
  1398. background-color: #fff;
  1399. border-radius: 2px;
  1400. box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 40%);
  1401. }
  1402. .sidebar-bar {
  1403. position: absolute;
  1404. top: 0;
  1405. right: 240px;
  1406. display: flex;
  1407. width: 60px;
  1408. height: calc(100vh - 166px);
  1409. .toolbar {
  1410. display: flex;
  1411. flex-direction: column;
  1412. align-items: center;
  1413. width: 60px;
  1414. height: 100%;
  1415. img {
  1416. cursor: pointer;
  1417. }
  1418. &-special {
  1419. display: flex;
  1420. flex-direction: column;
  1421. row-gap: 16px;
  1422. align-items: center;
  1423. width: 100%;
  1424. margin-bottom: 24px;
  1425. background-color: #fff;
  1426. img {
  1427. width: 36px;
  1428. height: 36px;
  1429. }
  1430. }
  1431. }
  1432. }
  1433. }
  1434. .back-top {
  1435. position: absolute;
  1436. right: 240px;
  1437. bottom: 0;
  1438. display: flex;
  1439. place-content: center center;
  1440. align-items: center;
  1441. width: 60px;
  1442. height: 60px;
  1443. cursor: pointer;
  1444. background-color: #fff;
  1445. }
  1446. main.preview-main {
  1447. display: flex;
  1448. flex: 1;
  1449. width: calc($total-width);
  1450. min-width: calc($total-width);
  1451. max-width: calc($total-width);
  1452. min-height: 100%;
  1453. margin: 0 auto;
  1454. background-color: #fff;
  1455. border-radius: 4px;
  1456. box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 40%);
  1457. .preview-left {
  1458. width: $courseware-left-margin;
  1459. min-width: $courseware-left-margin;
  1460. max-width: $courseware-left-margin;
  1461. background-color: $courseware-bgColor;
  1462. }
  1463. .preview-right {
  1464. width: $courseware-right-margin;
  1465. min-width: $courseware-right-margin;
  1466. max-width: $courseware-right-margin;
  1467. background-color: $courseware-bgColor;
  1468. }
  1469. &.no-audit {
  1470. margin: 0 auto;
  1471. }
  1472. }
  1473. .audit-content {
  1474. display: flex;
  1475. min-width: 1810px;
  1476. height: calc(100vh - 46px);
  1477. .left-menu {
  1478. display: flex;
  1479. flex-direction: column;
  1480. width: $catalogue-width;
  1481. font-family: 'Microsoft YaHei', 'Arial', sans-serif;
  1482. background-color: #fff;
  1483. .courseware-info {
  1484. display: flex;
  1485. column-gap: 18px;
  1486. width: 100%;
  1487. height: 186px;
  1488. padding: 6px 6px 24px;
  1489. border-bottom: $border;
  1490. .cover-image {
  1491. display: flex;
  1492. align-items: center;
  1493. justify-content: center;
  1494. width: 111px;
  1495. height: 157px;
  1496. background-color: rgba(229, 229, 229, 100%);
  1497. img {
  1498. max-width: 111px;
  1499. max-height: 157px;
  1500. }
  1501. }
  1502. .info-content {
  1503. display: flex;
  1504. flex-direction: column;
  1505. justify-content: space-between;
  1506. .catalogue-icon {
  1507. text-align: right;
  1508. .svg-icon {
  1509. cursor: pointer;
  1510. }
  1511. }
  1512. .courseware {
  1513. width: 159px;
  1514. height: 64px;
  1515. font-size: 16px;
  1516. .name {
  1517. font-weight: bold;
  1518. }
  1519. .editor {
  1520. display: -webkit-box;
  1521. overflow: hidden;
  1522. text-overflow: ellipsis;
  1523. word-break: break-word;
  1524. white-space: normal;
  1525. -webkit-line-clamp: 2; /* 多行省略行数,按需调整 */
  1526. -webkit-box-orient: vertical;
  1527. }
  1528. }
  1529. }
  1530. }
  1531. .courseware-tree {
  1532. display: flex;
  1533. flex: 1;
  1534. flex-direction: column;
  1535. row-gap: 8px;
  1536. padding: 12px;
  1537. margin-top: 12px;
  1538. overflow: auto;
  1539. .menu-item {
  1540. display: flex;
  1541. align-items: center;
  1542. &:not(.courseware) {
  1543. font-weight: bold;
  1544. }
  1545. &.courseware {
  1546. &:hover {
  1547. .name {
  1548. background-color: #f3f3f3;
  1549. }
  1550. }
  1551. }
  1552. .svg-icon {
  1553. margin-left: 4px;
  1554. &.my-edit-task {
  1555. color: $right-color;
  1556. }
  1557. }
  1558. .name {
  1559. flex: 1;
  1560. padding: 4px 8px 4px 4px;
  1561. border-radius: 4px;
  1562. }
  1563. &.active {
  1564. .name {
  1565. font-weight: bold;
  1566. color: #4095e5;
  1567. }
  1568. }
  1569. }
  1570. }
  1571. }
  1572. .sidebar {
  1573. position: relative;
  1574. display: flex;
  1575. width: $sidebar-width;
  1576. .toolbar {
  1577. display: flex;
  1578. flex-direction: column;
  1579. align-items: center;
  1580. width: 60px;
  1581. height: 100%;
  1582. background-color: rgba(247, 248, 250, 100%);
  1583. img {
  1584. cursor: pointer;
  1585. }
  1586. &-special {
  1587. display: flex;
  1588. flex-direction: column;
  1589. row-gap: 16px;
  1590. margin-bottom: 24px;
  1591. }
  1592. &-list {
  1593. display: flex;
  1594. flex-direction: column;
  1595. row-gap: 16px;
  1596. align-items: center;
  1597. width: 100%;
  1598. .sidebar-item {
  1599. width: 100%;
  1600. padding-top: 2px;
  1601. text-align: center;
  1602. .sidebar-icon {
  1603. width: 36px;
  1604. height: 36px;
  1605. cursor: pointer;
  1606. }
  1607. &.active {
  1608. background-color: #4095e5;
  1609. }
  1610. }
  1611. }
  1612. }
  1613. .content {
  1614. flex: 1;
  1615. background-color: #fff;
  1616. .resource_box {
  1617. height: 100%;
  1618. overflow-y: auto;
  1619. border: 1px solid #e5e5e5;
  1620. .source-toolbar-list {
  1621. position: fixed;
  1622. z-index: 999;
  1623. display: flex;
  1624. width: 240px;
  1625. background: #f2f3f5;
  1626. .sidebar-item {
  1627. width: 100%;
  1628. padding-top: 5px;
  1629. text-align: center;
  1630. border-right: 1px solid #ccc;
  1631. .sidebar-icon {
  1632. width: 26px;
  1633. height: 26px;
  1634. cursor: pointer;
  1635. }
  1636. &.active {
  1637. background-color: #4095e5;
  1638. }
  1639. }
  1640. }
  1641. h5 {
  1642. position: fixed;
  1643. z-index: 999;
  1644. width: 240px;
  1645. padding: 0 5px;
  1646. margin: 0;
  1647. font-size: 18px;
  1648. line-height: 40px;
  1649. background: #f2f3f5;
  1650. }
  1651. .scroll-container {
  1652. display: flex;
  1653. flex-direction: column;
  1654. row-gap: 8px;
  1655. margin: 6px;
  1656. .list-item {
  1657. // display: flex;
  1658. align-items: center;
  1659. // cursor: pointer;
  1660. border: 1px solid #ccc;
  1661. border-radius: 8px;
  1662. :deep .el-slider {
  1663. .el-slider__runway {
  1664. background-color: #eee;
  1665. }
  1666. }
  1667. .el-image {
  1668. display: flex;
  1669. width: 100%;
  1670. min-width: 100%;
  1671. height: 90px;
  1672. background-color: #ccc;
  1673. border-radius: 8px;
  1674. }
  1675. .video-play {
  1676. width: 100%;
  1677. min-width: 100%;
  1678. }
  1679. .text-box {
  1680. word-break: break-word;
  1681. }
  1682. }
  1683. }
  1684. p {
  1685. color: #999;
  1686. text-align: center;
  1687. }
  1688. .card-box li {
  1689. padding: 10px;
  1690. border-bottom: 1px solid #ccc;
  1691. .el-icon-notebook-2 {
  1692. display: block;
  1693. margin-bottom: 4px;
  1694. font-size: 12px;
  1695. color: grey;
  1696. }
  1697. }
  1698. .file-handle-info {
  1699. margin: 0 5px;
  1700. .mark {
  1701. display: flex;
  1702. align-items: center;
  1703. justify-content: space-between;
  1704. padding: 3px;
  1705. .linkLocation {
  1706. cursor: pointer;
  1707. }
  1708. }
  1709. .word {
  1710. flex: 1;
  1711. word-break: break-all;
  1712. }
  1713. }
  1714. ::v-deep .el-collapse-item__header {
  1715. margin-left: 5px;
  1716. }
  1717. .loading-text {
  1718. padding: 5px;
  1719. color: #999;
  1720. text-align: center;
  1721. }
  1722. .error-text {
  1723. padding: 5px;
  1724. color: #999;
  1725. text-align: center;
  1726. }
  1727. }
  1728. }
  1729. .back-top {
  1730. position: absolute;
  1731. bottom: 0;
  1732. left: 0;
  1733. display: flex;
  1734. place-content: center center;
  1735. align-items: center;
  1736. width: 60px;
  1737. height: 60px;
  1738. cursor: pointer;
  1739. }
  1740. }
  1741. }
  1742. }
  1743. :deep .scroll-container .audio-wrapper {
  1744. width: 100% !important;
  1745. .audio-middle {
  1746. width: 100% !important;
  1747. padding: 6px 8px !important;
  1748. margin-left: 0;
  1749. border: none;
  1750. border-radius: 8px;
  1751. .audio-name {
  1752. text-align: left;
  1753. }
  1754. .slider-area {
  1755. column-gap: 8px !important;
  1756. }
  1757. :deep .remark-dialog {
  1758. .el-dialog__body {
  1759. padding: 5px 20px;
  1760. }
  1761. }
  1762. :deep .audit-dialog {
  1763. .el-dialog__body {
  1764. height: calc(100vh - 260px);
  1765. padding: 5px 20px;
  1766. }
  1767. .mind-map-container .mind-map {
  1768. height: calc(100vh - 310px);
  1769. }
  1770. }
  1771. }
  1772. }
  1773. .mt10 {
  1774. margin: 10px 0 0 !important;
  1775. background-color: #eee;
  1776. }
  1777. .file-list {
  1778. display: flex;
  1779. flex-direction: column;
  1780. row-gap: 5px;
  1781. li {
  1782. align-items: center;
  1783. .file-name {
  1784. display: flex;
  1785. column-gap: 14px;
  1786. align-items: center;
  1787. justify-content: space-between;
  1788. max-width: 500px;
  1789. padding: 8px 12px;
  1790. font-size: 14px;
  1791. color: #1d2129;
  1792. background-color: #f7f8fa;
  1793. border-radius: 8px;
  1794. p {
  1795. margin: 0;
  1796. }
  1797. span,
  1798. div {
  1799. display: flex;
  1800. align-items: center;
  1801. }
  1802. }
  1803. .svg-icon {
  1804. cursor: pointer;
  1805. }
  1806. }
  1807. }
  1808. </style>
  1809. <style lang="scss">
  1810. .tox-tinymce-aux {
  1811. z-index: 9999 !important;
  1812. }
  1813. </style>