CommonPreview.vue 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443
  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. <template v-if="type === 'edit_preview'">
  12. <i class="el-icon-setting" style="cursor: pointer" @click="openSimulateAnswerPermissionControl()"></i>
  13. <span class="link" @click="createCoursewarePreviewURL()">生成课件预览链接</span>
  14. </template>
  15. <div class="group">
  16. <el-checkbox v-model="isJudgeCorrect">判断对错</el-checkbox>
  17. </div>
  18. <div v-if="isShowGroup">
  19. <span class="link" @click="isShowGroup = false">取消显示分组</span>
  20. <span
  21. class="link"
  22. @click="
  23. groupShowAll = false;
  24. isShowGroup = false;
  25. "
  26. >完成选择</span
  27. >
  28. </div>
  29. <span
  30. v-else
  31. class="link"
  32. @click="
  33. isShowGroup = true;
  34. groupShowAll = true;
  35. "
  36. >显示分组</span
  37. >
  38. <span v-if="false" class="link">
  39. <el-checkbox v-model="showPinYin" true-label="true" false-label="false">拼音</el-checkbox>
  40. </span>
  41. <div class="operator">
  42. <slot name="operator" :courseware="courseware_info" :project-id="projectId"></slot>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="audit-content">
  47. <!-- 左侧菜单栏 -->
  48. <aside v-if="navigationShow" class="left-menu">
  49. <div class="courseware-info">
  50. <div class="cover-image">
  51. <img v-if="project.cover_image_file_url.length > 0" :src="project.cover_image_file_url" alt="cover-image" />
  52. </div>
  53. <div class="info-content">
  54. <div class="catalogue-icon" @click="toggleNavigationShow">
  55. <SvgIcon icon-class="catalogue" size="54" />
  56. </div>
  57. <div class="courseware">
  58. <div class="name nowrap-ellipsis" :title="courseware_info.book_name">
  59. {{ courseware_info.book_name }}
  60. </div>
  61. <div class="editor" :title="project.editor">
  62. {{ project.editor }}
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <!-- 教材章节树 -->
  68. <div class="courseware-tree">
  69. <div
  70. v-for="{
  71. id: nodeId,
  72. name,
  73. status,
  74. status_name,
  75. deep,
  76. is_leaf_chapter,
  77. is_my_edit_task,
  78. is_show_submit_audit_button,
  79. } in node_list"
  80. :key="nodeId"
  81. :class="['menu-item', { active: curSelectId === nodeId }, { courseware: isTrue(is_leaf_chapter) }]"
  82. :style="computedNameStyle(deep, isTrue(is_leaf_chapter))"
  83. @click="selectChapterNode(nodeId, isTrue(is_leaf_chapter))"
  84. >
  85. <span
  86. class="name nowrap-ellipsis"
  87. :title="name"
  88. :style="{ color: computedNameColor(status, is_leaf_chapter, is_my_edit_task, nodeId) }"
  89. >
  90. {{ name }}
  91. </span>
  92. <span v-if="['audit', 'edit_preview'].includes(type)" class="status">{{ status_name }}</span>
  93. <template v-if="!isTrue(is_leaf_chapter) && isTrue(is_show_submit_audit_button)">
  94. <span class="link" @click="submitChapterAllCoursewareToAuditFlow(nodeId)">提交审核</span>
  95. </template>
  96. </div>
  97. </div>
  98. </aside>
  99. <div
  100. ref="previewMain"
  101. class="main-container"
  102. :style="{
  103. paddingLeft: !isFullScreen && navigationShow ? '15px' : '315px',
  104. paddingRight: !isFullScreen && sidebarShow ? '15px' : '315px',
  105. }"
  106. >
  107. <!-- 左侧菜单栏 - 收缩 -->
  108. <div v-if="!navigationShow && !isFullScreen" class="catalogue-bar" @click="toggleNavigationShow">
  109. <SvgIcon icon-class="catalogue" size="54" />
  110. </div>
  111. <main :class="['preview-main', { 'no-audit': !isShowAudit }]">
  112. <div class="preview-left"></div>
  113. <!-- <div
  114. id="selectable-area-preview"
  115. @mousedown="startSelection"
  116. @mousemove="updateSelection"
  117. @mouseup="endSelection"
  118. @mouseleave="endSelection"
  119. > -->
  120. <CoursewarePreview
  121. v-if="courseware_info.book_name"
  122. ref="courserware"
  123. :is-show-group="isShowGroup"
  124. :group-show-all="groupShowAll"
  125. :group-row-list="content_group_row_list"
  126. :data="data"
  127. :courseware-id="curSelectId"
  128. :component-list="component_list"
  129. :background="background"
  130. :can-remark="isTrue(courseware_info.is_my_audit_task) && isTrue(courseware_info.is_can_add_audit_remark)"
  131. :show-remark="isShowAudit"
  132. :component-remark-obj="remark_list_obj"
  133. :project="project"
  134. :type="type"
  135. @computeScroll="computeScroll"
  136. @addRemark="addRemark"
  137. @editNote="handEditNote"
  138. @saveCollect="saveCollect"
  139. @getTranslate="getTranslate"
  140. @editFeedback="handEditFeedback"
  141. @selectedComponent="$emit('selectedComponent', $event)"
  142. />
  143. <!-- <div
  144. v-if="isSelecting"
  145. :style="{
  146. position: 'absolute',
  147. top: `${menuPosition.startY}px`,
  148. left: `${menuPosition.startX}px`,
  149. width: `${menuPosition.endX - menuPosition.startX}px`,
  150. height: `${menuPosition.endY - menuPosition.startY}px`,
  151. border: '2px solid #165DFF',
  152. }"
  153. ></div>
  154. </div> -->
  155. <div class="preview-right"></div>
  156. </main>
  157. <!-- 右侧菜单栏 - 收缩 -->
  158. <aside v-if="!sidebarShow && !isFullScreen" class="sidebar-bar">
  159. <aside class="toolbar">
  160. <div class="toolbar-special">
  161. <img :src="require('@/assets/icon/sidebar-fullscreen.png')" alt="全屏" @click="fullScreen" />
  162. <img :src="require('@/assets/icon/sidebar-toolkit.png')" alt="工具箱" />
  163. <img :src="require(`@/assets/icon/arrow-down.png`)" alt="伸缩" @click="toggleSidebarShow" />
  164. </div>
  165. </aside>
  166. </aside>
  167. </div>
  168. <div v-if="!sidebarShow" class="back-top" @click="backTop">
  169. <img :src="require(`@/assets/icon/back-top.png`)" alt="返回顶部" />
  170. </div>
  171. <!-- 右侧工具栏 -->
  172. <aside v-if="sidebarShow" ref="sidebarMenu" class="sidebar">
  173. <aside class="toolbar">
  174. <div class="toolbar-special">
  175. <img :src="require('@/assets/icon/sidebar-fullscreen.png')" alt="全屏" @click="fullScreen" />
  176. <img :src="require('@/assets/icon/sidebar-toolkit.png')" alt="工具箱" />
  177. </div>
  178. <div v-if="sidebarShow" class="toolbar-list">
  179. <div
  180. v-for="{ icon, title, handle, param, children } in sidebarIconList"
  181. :key="icon"
  182. :class="['sidebar-item', { active: curToolbarIcon === icon }]"
  183. :title="title"
  184. @click="handleSidebarClick(handle, param, icon, children)"
  185. >
  186. <div
  187. class="sidebar-icon icon-mask"
  188. :style="{
  189. backgroundColor: curToolbarIcon === icon ? '#fff' : '#1E2129',
  190. maskImage: `url(${require(`@/assets/icon/sidebar-${icon}.svg`)})`,
  191. }"
  192. ></div>
  193. </div>
  194. </div>
  195. <div class="adjustable" @click="toggleSidebarShow">
  196. <img :src="require(`@/assets/icon/arrow-up.png`)" alt="伸缩" />
  197. </div>
  198. </aside>
  199. <div class="content">
  200. <div v-if="curToolbarIcon === 'search'" class="resource_box">
  201. <h5>{{ drawerTitle }}</h5>
  202. <div style="height: 40px"></div>
  203. <el-row :gutter="10" style="margin: 5px">
  204. <el-col :span="16">
  205. <el-input v-model="searchContent" placeholder="请输入文本内容" clearable />
  206. </el-col>
  207. <el-col :span="4">
  208. <el-button type="primary" @click="querySearchList"> 查询 </el-button>
  209. </el-col>
  210. </el-row>
  211. <div>
  212. <el-table :data="searchList" :show-header="false">
  213. <!-- <el-table-column prop="courseware_name" label="课件" />
  214. <el-table-column prop="component_type" label="组件" /> -->
  215. <el-table-column>
  216. <template #default="{ row }">
  217. {{ row.courseware_name + ' / ' + row.component_type_name }}
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="" width="50">
  221. <template #default="{ row }">
  222. <el-link type="primary" @click="handleLocation(row, 0)">定位</el-link>
  223. </template>
  224. </el-table-column>
  225. </el-table>
  226. </div>
  227. </div>
  228. <!-- <div v-if="curToolbarIcon === 'totalResources'" class="resource_box"></div> -->
  229. <div v-if="['image', 'audio', 'video', 'text'].includes(twoCurToolbarIcon)" class="resource_box">
  230. <div class="source-toolbar-list">
  231. <div
  232. v-for="{ icon, title, handle, param } in twoSidebarList"
  233. :key="icon"
  234. :class="['sidebar-item', { active: twoCurToolbarIcon === icon }]"
  235. :title="title"
  236. @click="handleSidebarClick(handle, param, icon, '', 2)"
  237. >
  238. <div
  239. class="sidebar-icon icon-mask"
  240. :style="{
  241. backgroundColor: twoCurToolbarIcon === icon ? '#fff' : '#1E2129',
  242. maskImage: `url(${require(`@/assets/icon/sidebar-${icon}.svg`)})`,
  243. }"
  244. ></div>
  245. </div>
  246. </div>
  247. <div style="height: 40px"></div>
  248. <div style="margin: 5px">
  249. <span>全部显示 </span>
  250. <el-switch v-model="multimediaIsAllShow" :active-value="true" :inactive-value="false" />
  251. </div>
  252. <el-collapse v-model="activeBookChapterId" accordion @change="multimediaHandleChange">
  253. <el-collapse-item
  254. v-for="chapter in bookChapterList"
  255. :key="chapter.id"
  256. :name="chapter.id"
  257. :title="chapter.name"
  258. >
  259. <!-- 加载状态 -->
  260. <div v-if="multimediaLoadingStates" class="loading-text">加载中...</div>
  261. <!-- 加载完成显示数据 -->
  262. <div v-else-if="chapter.data">
  263. <ul
  264. :class="parseInt(drawerType) == 5 ? 'scroll-container file-list' : 'scroll-container'"
  265. infinite-scroll-disabled="disabled"
  266. :infinite-scroll-immediate="false"
  267. >
  268. <li v-for="(item, index) in chapter.data" :key="`${chapter.id}-${index}`" class="list-item">
  269. <template v-if="parseInt(drawerType) === 0">
  270. <el-image v-if="shouldMediaShowItem(chapter, item)" :src="item.file_url" fit="contain" />
  271. </template>
  272. <template v-else-if="parseInt(drawerType) === 1">
  273. <AudioPlay
  274. v-if="shouldMediaShowItem(chapter, item)"
  275. view-size="middle"
  276. :file-id="item.file_id"
  277. :file-name="item.file_name.slice(0, item.file_name.lastIndexOf('.'))"
  278. :show-slider="true"
  279. :audio-index="index"
  280. />
  281. </template>
  282. <template v-else-if="parseInt(drawerType) === 2">
  283. <VideoPlay
  284. v-if="shouldMediaShowItem(chapter, item)"
  285. view-size="small"
  286. :file-id="item.file_id"
  287. :video-index="index"
  288. />
  289. </template>
  290. <template v-else-if="parseInt(drawerType) === 3"> </template>
  291. <template v-else-if="parseInt(drawerType) === 4"> </template>
  292. <template v-else-if="parseInt(drawerType) === 5">
  293. <div class="file-name">
  294. <el-link>
  295. <span @click="openFile(item)">
  296. <SvgIcon icon-class="file" size="24" />
  297. <p>
  298. <span>{{ item.file_name }}</span>
  299. </p>
  300. </span>
  301. </el-link>
  302. </div>
  303. </template>
  304. <!-- 资源底部的操作 -->
  305. <div class="file-handle-info">
  306. <span v-if="![1, 5].includes(parseInt(drawerType))" class="word">{{ item.file_name }}</span>
  307. <div class="mark">
  308. <el-checkbox
  309. v-model="item.is_hided"
  310. :disabled="!item.is_can_edit"
  311. size="small"
  312. @change="handleMediaShowChange(item)"
  313. >
  314. 隐藏
  315. </el-checkbox>
  316. <el-link type="primary" class="el-icon-place linkLocation" @click="handleLocation(item, 0)" />
  317. </div>
  318. </div>
  319. </li>
  320. </ul>
  321. </div>
  322. <!-- 加载失败或未加载 -->
  323. <div v-else class="error-text">没有资源</div>
  324. </el-collapse-item>
  325. </el-collapse>
  326. </div>
  327. <div v-if="curToolbarIcon === 'collect'" class="resource_box">
  328. <h5>{{ drawerTitle }}</h5>
  329. <div style="height: 40px"></div>
  330. <ul v-if="allCottectList.length > 0" class="card-box">
  331. <li v-for="item in allCottectList" :key="item.id">
  332. <span class="el-icon-notebook-2"> 原文</span>
  333. <span>{{ item.text }}</span>
  334. <div>
  335. <el-button type="text" class="el-icon-delete" @click="handDelCollect(item.id)"> 删除</el-button>
  336. <el-divider direction="vertical" />
  337. <el-button type="text" class="el-icon-place" @click="handleLocation(item, 12)"> 定位</el-button>
  338. </div>
  339. </li>
  340. </ul>
  341. </div>
  342. <div v-if="curToolbarIcon === 'note'" class="resource_box">
  343. <h5>{{ drawerTitle }}</h5>
  344. <div style="height: 40px"></div>
  345. <ul v-if="allNoteList.length > 0" class="card-box">
  346. <li v-for="item in allNoteList" :key="item.id">
  347. <span class="el-icon-notebook-2"> 原文</span>
  348. <span>{{ item.text }}</span>
  349. <el-divider class="mt10" />
  350. <span v-html="item.note"></span>
  351. <div>
  352. <el-button type="text" class="el-icon-edit" @click="handEditNote(item)"> 编辑</el-button>
  353. <el-divider direction="vertical" />
  354. <el-button type="text" class="el-icon-delete" @click="handDelNote(item.id)"> 删除</el-button>
  355. <el-divider direction="vertical" />
  356. <el-button type="text" class="el-icon-place" @click="handleLocation(item, 11)"> 定位</el-button>
  357. </div>
  358. </li>
  359. </ul>
  360. </div>
  361. <div v-if="curToolbarIcon === 'translate'" class="resource_box">
  362. <h5>{{ drawerTitle }}</h5>
  363. <div style="height: 40px"></div>
  364. <div style="padding: 10px">
  365. <el-select v-model="lang" placeholder="请选择语言" size="mini" class="lang-select">
  366. <el-option v-for="item in langList" :key="item.type" :label="item.name" :value="item.type" />
  367. </el-select>
  368. </div>
  369. </div>
  370. <div v-if="curToolbarIcon === 'feedback'" class="resource_box">
  371. <h5>{{ drawerTitle }}</h5>
  372. <div style="height: 40px"></div>
  373. <ul v-if="allFeedbackList.length > 0" class="card-box">
  374. <li v-for="item in allFeedbackList" :key="item.id">
  375. <span class="el-icon-notebook-2"> 原文</span>
  376. <span>{{ item.text }}</span>
  377. <el-divider class="mt10" />
  378. <span v-html="item.feedBack"></span>
  379. <div>
  380. <el-button type="text" class="el-icon-edit" @click="handEditFeedback(item)"> 编辑</el-button>
  381. <el-divider direction="vertical" />
  382. <el-button type="text" class="el-icon-delete" @click="handDelFeedback(item.id)"> 删除</el-button>
  383. <el-divider direction="vertical" />
  384. <el-button type="text" class="el-icon-place" @click="handleLocation(item, 13)"> 定位</el-button>
  385. </div>
  386. </li>
  387. </ul>
  388. </div>
  389. <template v-if="curToolbarIcon === 'audit'">
  390. <AuditRemark
  391. :remark-list="remark_list"
  392. :is-audit="isShowAudit"
  393. @deleteRemarks="deleteRemarks"
  394. @handleLocationRemarks="handleLocationRemarks"
  395. />
  396. </template>
  397. <!-- 设置 -->
  398. <div v-if="curToolbarIcon === 'setting'" class="setting">
  399. <h5>{{ drawerTitle }}</h5>
  400. <div class="setting-content">
  401. <el-switch
  402. v-model="chinese"
  403. active-value="zh-Hant"
  404. active-text="繁体"
  405. inactive-value="zh-Hans"
  406. inactive-text="简体"
  407. />
  408. </div>
  409. </div>
  410. </div>
  411. <div class="back-top" @click="backTop">
  412. <img :src="require(`@/assets/icon/back-top.png`)" alt="返回顶部" />
  413. </div>
  414. </aside>
  415. </div>
  416. <el-dialog
  417. title="添加课件审核批注"
  418. :visible="visibleRemark"
  419. width="680px"
  420. :close-on-click-modal="false"
  421. class="remark-dialog"
  422. @close="dialogClose('')"
  423. >
  424. <Remark :remark="remark" :project-id="projectId" :courseware-id="select_node ? select_node : id" />
  425. <div slot="footer">
  426. <el-button @click="dialogClose('')">取消</el-button>
  427. <el-button type="primary" :loading="submit_loading" @click="addCoursewareAuditRemark(select_node)">
  428. 确定
  429. </el-button>
  430. </div>
  431. </el-dialog>
  432. <el-dialog title="" :visible="visibleMindMap" width="1100px" class="audit-dialog" @close="dialogClose('MindMap')">
  433. <MindMap
  434. v-if="isChildDataLoad"
  435. ref="mindMapRef"
  436. :project-id="projectId"
  437. :mind-map-json-data="mindMapJsonData"
  438. @child-click="handleNodeClick"
  439. />
  440. </el-dialog>
  441. <el-dialog
  442. title=""
  443. :visible="visibleVisNetwork"
  444. width="1100px"
  445. class="audit-dialog"
  446. :close-on-click-modal="false"
  447. @close="dialogClose('VisNetwork')"
  448. >
  449. <VisNetwork ref="visNetworkRef" :book-id="projectId" @child-click="handleNodeClick" />
  450. </el-dialog>
  451. <ExplanatoryNoteDialog
  452. ref="explanatoryNote"
  453. :open.sync="editDialogOpen"
  454. :init-data="oldRichData"
  455. :title-text="dialogTitleText"
  456. @confirm="dialogSave"
  457. @cancel="dialogCancel"
  458. />
  459. <TranslateDialog :open.sync="showTranslate" :init-text="translateText" :book-id="projectId" title-text="翻译" />
  460. <SimAnswerPermissionControl :visible.sync="visiblePermissionControl" :permission-control.sync="permissionControl" />
  461. <PreviewURL :url="preview_url" :visible.sync="visiblePreviewURL" />
  462. </div>
  463. </template>
  464. <script>
  465. import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview.vue';
  466. import MindMap from '@/components/MindMap.vue';
  467. import VisNetwork from '@/components/VisNetwork.vue';
  468. import VideoPlay from '@/views/book/courseware/preview/components/common/VideoPlay.vue';
  469. import AudioPlay from '@/views/book/courseware/preview/components/common/AudioPlay.vue';
  470. import AuditRemark from '@/components/AuditRemark.vue';
  471. import ExplanatoryNoteDialog from '@/components/ExplanatoryNoteDialog.vue';
  472. import TranslateDialog from '@/components/TranslateDialog.vue';
  473. import SimAnswerPermissionControl from '@/components/SimAnswerPermissionControl.vue';
  474. import PreviewURL from '@/views/project_manage/common/PreviewURL.vue';
  475. import Remark from './Remark.vue';
  476. import {
  477. GetBookCoursewareInfo,
  478. GetProjectBaseInfo,
  479. GetCoursewareAuditRemarkList,
  480. AddCoursewareAuditRemark,
  481. DeleteCoursewareAuditRemarkList,
  482. GetProjectInfo,
  483. } from '@/api/project';
  484. import {
  485. ContentGetCoursewareContent_View,
  486. ChapterGetBookChapterStructExpandList,
  487. GetBookBaseInfo,
  488. MangerGetBookMindMap,
  489. GetBookChapterStructExpandList,
  490. PageQueryBookResourceList,
  491. GetLanguageTypeList,
  492. GetMyNoteList,
  493. DeleteMyNote,
  494. AddMyNote,
  495. UpdateMyNote,
  496. AddMyCollect,
  497. GetMyCollectList,
  498. DeleteMyCollect,
  499. SearchBookContentText,
  500. SetBookResourceHide,
  501. SubmitChapterAllCoursewareToAuditFlow,
  502. AddCoursewareFeedback,
  503. GetCoursewareFeedbackList,
  504. DeleteCoursewareFeedback,
  505. } from '@/api/book';
  506. import { toggleFullScreen } from '@/utils/common';
  507. import * as OpenCC from 'opencc-js';
  508. import { isTrue } from '@/utils/validate';
  509. import { CreateCoursewarePreviewURL } from '@/api/app';
  510. export default {
  511. name: 'CommonPreview',
  512. components: {
  513. CoursewarePreview,
  514. MindMap,
  515. AudioPlay,
  516. VideoPlay,
  517. AuditRemark,
  518. ExplanatoryNoteDialog,
  519. VisNetwork,
  520. SimAnswerPermissionControl,
  521. PreviewURL,
  522. Remark,
  523. TranslateDialog,
  524. },
  525. provide() {
  526. return {
  527. getLang: () => this.lang,
  528. getChinese: () => this.chinese,
  529. getShowPinYin: () => this.showPinYin,
  530. getLangList: () => this.langList,
  531. convertText: this.convertText,
  532. getTitleList: () => this.title_list,
  533. getPermissionControl: () => this.permissionControl,
  534. };
  535. },
  536. inject: ['processHtmlString'],
  537. props: {
  538. projectId: {
  539. type: String,
  540. required: true,
  541. },
  542. id: {
  543. type: String,
  544. default: '',
  545. },
  546. // 是否是审核页面
  547. isAudit: {
  548. type: Boolean,
  549. default: false,
  550. },
  551. isShowAudit: {
  552. type: Boolean,
  553. default: true,
  554. },
  555. isBook: {
  556. type: Boolean,
  557. default: false,
  558. },
  559. type: {
  560. type: String,
  561. default: '',
  562. },
  563. },
  564. data() {
  565. const sidebarIconList = [
  566. { icon: 'search', title: '搜索', handle: 'getSearch', param: { type: '13' } },
  567. { icon: 'mindmap', title: '思维导图', handle: 'openMindMap', param: {} },
  568. { icon: 'knowledge', title: '知识图谱', handle: 'openVisNetwork', param: {} },
  569. {
  570. icon: 'totalResources',
  571. title: '总资源',
  572. handle: '',
  573. param: {},
  574. children: [
  575. { icon: 'audio', title: '音频', handle: 'openDrawer', param: { type: '1' } },
  576. { icon: 'image', title: '图片', handle: 'openDrawer', param: { type: '0' } },
  577. { icon: 'video', title: '视频', handle: 'openDrawer', param: { type: '2' } },
  578. { icon: 'text', title: '文本', handle: 'openDrawer', param: { type: '5' } },
  579. ],
  580. },
  581. { icon: 'collect', title: '收藏', handle: 'getCollect', param: { type: '11' } },
  582. { icon: 'note', title: '笔记', handle: 'getNote', param: { type: '12' } },
  583. { icon: 'translate', title: '多语言', handle: 'openTranslate', param: { type: '21' } },
  584. { icon: 'setting', title: '设置', handle: 'openSetting', param: { type: 6 } },
  585. { icon: 'feedback', title: '用户反馈', handle: 'getFeedback', param: { type: 22 } },
  586. ];
  587. if (this.isShowAudit) {
  588. sidebarIconList.push({ icon: 'audit', title: '审核批注', handle: 'openAudit', param: {} });
  589. }
  590. return {
  591. select_node: this.id,
  592. courseware_info: {
  593. book_name: '',
  594. is_can_start_edit: 'false',
  595. is_can_submit_audit: 'false',
  596. is_can_audit_pass: 'false',
  597. is_can_audit_reject: 'false',
  598. is_can_add_audit_remark: 'false',
  599. is_can_finish_audit: 'false',
  600. is_can_request_shangjia_book: 'false',
  601. is_can_request_rollback_project: 'false',
  602. is_can_shangjia_book: 'false',
  603. is_can_rollback_project: 'false',
  604. },
  605. background: {
  606. background_image_url: '',
  607. background_position: {
  608. left: 0,
  609. top: 0,
  610. },
  611. background: {},
  612. },
  613. node_list: [],
  614. data: { row_list: [] },
  615. component_list: [],
  616. content_group_row_list: [],
  617. remark_list: [],
  618. remark_list_obj: {}, // 存放以组件为对象的批注数组
  619. searchList: [],
  620. searchContent: '',
  621. visibleRemark: false,
  622. remark: {
  623. remark_content: '',
  624. file_id_list: [],
  625. },
  626. submit_loading: false,
  627. isTrue,
  628. menuPosition: {
  629. x: -1,
  630. y: -1,
  631. componentId: 'WHOLE',
  632. startX: null,
  633. startY: null,
  634. endX: null,
  635. endY: null,
  636. },
  637. isSelecting: false,
  638. curToolbarIcon: this.isShowAudit ? 'audit' : '',
  639. sidebarIconList,
  640. twoSidebarList: [],
  641. twoCurToolbarIcon: '',
  642. visibleMindMap: false,
  643. visibleVisNetwork: false,
  644. isChildDataLoad: false,
  645. mindMapJsonData: {}, // 思维导图json数据
  646. drawerType: '', // 抽屉类型
  647. titleMap: {
  648. 0: '图片资源',
  649. 1: '音频资源',
  650. 2: '视频资源',
  651. 5: '文本资源',
  652. 6: '设置',
  653. 11: '收藏列表',
  654. 12: '笔记列表',
  655. 13: '搜索结果',
  656. 21: '多语言',
  657. 22: '用户反馈',
  658. },
  659. page_capacity: 10,
  660. cur_page: 1,
  661. file_list: [],
  662. total_count: 0,
  663. loading: false,
  664. lastLoadTime: 0,
  665. minLoadInterval: 3 * 1000,
  666. isShowGroup: false,
  667. groupShowAll: true,
  668. opencc: OpenCC.Converter({ from: 'cn', to: 'tw' }),
  669. langList: [],
  670. lang: 'ZH',
  671. chinese: 'zh-Hans', // 语言简体中文zh-Hans,繁体中文zh-Hant
  672. showPinYin: 'false',
  673. isJudgeCorrect: false,
  674. isShowAnswer: false,
  675. curSelectId: this.id,
  676. navigationShow: true,
  677. sidebarShow: true,
  678. project: {
  679. editor: '', // 作者
  680. cover_image_file_id: null, // 封面图片ID
  681. cover_image_file_url: '', // 封面图片URL
  682. },
  683. allNoteList: [],
  684. editDialogOpen: false,
  685. showTranslate: false,
  686. translateText: '',
  687. oldRichData: {},
  688. dialogType: 1,
  689. newSelectedInfo: null,
  690. allCottectList: [],
  691. bookChapterList: [],
  692. allFeedbackList: [],
  693. book_id: '',
  694. activeBookChapterId: '',
  695. multimediaLoadingStates: true,
  696. multimediaIsAllShow: false,
  697. isFullScreen: false, // 是否全屏状态
  698. title_list: [],
  699. visiblePermissionControl: false, // 模拟答题权限控制弹窗显示状态
  700. permissionControl: {
  701. can_answer: true, // 可作答
  702. can_judge_correct: false, // 可判断对错(客观题)
  703. can_show_answer: false, // 可查看答案
  704. can_correct: false, // 可批改
  705. can_check_correct: false, // 可查看批改
  706. },
  707. preview_url: '', // 课件预览链接
  708. visiblePreviewURL: false, // 预览链接弹窗显示状态
  709. };
  710. },
  711. computed: {
  712. disabled() {
  713. const result = this.loading || this.noMore;
  714. return result;
  715. },
  716. noMore() {
  717. const result = this.file_list.length >= this.total_count;
  718. return result;
  719. },
  720. drawerTitle() {
  721. return this.titleMap[this.drawerType] || '资源列表';
  722. },
  723. shouldMediaShowItem() {
  724. return (chapter, item) => {
  725. return this.activeBookChapterId === chapter.id && item && item.file_id;
  726. };
  727. },
  728. dialogTitleText() {
  729. if (this.dialogType === 2) return '反馈';
  730. return '笔记';
  731. },
  732. },
  733. watch: {
  734. isJudgeCorrect(newVal) {
  735. if (!newVal) {
  736. this.isShowAnswer = false;
  737. }
  738. this.simulateAnswer(newVal);
  739. },
  740. isShowAnswer() {
  741. this.simulateAnswer();
  742. },
  743. curSelectId() {
  744. if (this.curToolbarIcon === 'note') {
  745. this.getNote();
  746. } else if (this.curToolbarIcon === 'collect') {
  747. this.getCollect();
  748. } else if (this.curToolbarIcon === 'feedback') {
  749. this.getFeedback();
  750. }
  751. },
  752. multimediaIsAllShow() {
  753. // 切换显示全部,需清空所有数据,全部重新加载
  754. this.bookChapterList.forEach((x) => {
  755. this.$set(x, 'data', null);
  756. });
  757. this.multimediaHandleChange();
  758. },
  759. },
  760. created() {
  761. if (this.id) {
  762. this.getBookCoursewareInfo(this.id);
  763. this.getCoursewareComponentContent_View(this.id);
  764. this.getCoursewareAuditRemarkList(this.id);
  765. } else {
  766. this.isBook ? this.getBookBaseInfo() : this.getProjectBaseInfo();
  767. }
  768. this.getBookChapterStructExpandList();
  769. if (!this.isBook) {
  770. this.getProjectInfo();
  771. }
  772. // 监听全屏事件
  773. document.addEventListener('fullscreenchange', () => {
  774. if (document.fullscreenElement) {
  775. this.isFullScreen = true;
  776. } else {
  777. this.isFullScreen = false;
  778. }
  779. });
  780. },
  781. beforeDestroy() {
  782. document.removeEventListener('fullscreenchange', () => {});
  783. },
  784. methods: {
  785. getProjectBaseInfo() {
  786. GetProjectBaseInfo({ id: this.projectId }).then(({ project_info }) => {
  787. this.courseware_info = { ...project_info, book_name: project_info.name };
  788. });
  789. },
  790. getBookBaseInfo() {
  791. GetBookBaseInfo({ id: this.projectId }).then(({ book_info }) => {
  792. this.courseware_info = { ...this.courseware_info, ...book_info, book_name: book_info.name };
  793. this.project = {
  794. editor: book_info.editor,
  795. cover_image_file_id: book_info.cover_image_file_id,
  796. cover_image_file_url: book_info.cover_image_file_url,
  797. };
  798. });
  799. },
  800. getProjectInfo() {
  801. GetProjectInfo({ id: this.projectId }).then(({ project_info }) => {
  802. if (project_info.cover_image_file_url) {
  803. this.project = project_info;
  804. }
  805. });
  806. },
  807. /**
  808. * 更新背景信息
  809. * @param {Object} background - 背景信息对象
  810. */
  811. updateBackground(background) {
  812. this.background = background;
  813. },
  814. /**
  815. * 得到教材课件信息
  816. * @param {string} id - 课件ID
  817. */
  818. getBookCoursewareInfo(id) {
  819. GetBookCoursewareInfo({ id, is_contain_producer: 'true', is_contain_auditor: 'true' }).then(
  820. ({ courseware_info }) => {
  821. this.courseware_info = { ...this.courseware_info, ...courseware_info };
  822. this.getLangList();
  823. },
  824. );
  825. },
  826. /**
  827. * 得到课件内容(展示内容)
  828. * @param {string} id - 课件ID
  829. */
  830. getCoursewareComponentContent_View(id) {
  831. ContentGetCoursewareContent_View({ id }).then(
  832. ({ content, component_list, content_group_row_list, title_list, background }) => {
  833. if (title_list) this.title_list = title_list || [];
  834. if (background) {
  835. this.background = JSON.parse(background);
  836. this.$emit('updateBackground', this.background);
  837. }
  838. if (content) {
  839. const _content = JSON.parse(content);
  840. this.data = _content;
  841. } else {
  842. this.data = { row_list: [] };
  843. }
  844. let processHtmlString = typeof this.processHtmlString === 'function' ? this.processHtmlString : null;
  845. if (component_list) this.component_list = component_list;
  846. this.component_list.forEach((x) => {
  847. if (x.component_type === 'audio') {
  848. let _c = JSON.parse(x.content);
  849. let p = _c.property || {};
  850. if (!p.file_name_display_mode) p.file_name_display_mode = 'true';
  851. if (p.view_method === 'independent' && !p.style_mode) {
  852. p.style_mode = 'middle';
  853. }
  854. if (!p.style_mode) p.style_mode = 'big';
  855. if (p.view_method === 'icon') {
  856. p.file_name_display_mode = 'false';
  857. p.view_method = 'independent';
  858. p.style_mode = 'small';
  859. }
  860. x.content = JSON.stringify(_c);
  861. } else if (x.component_type === 'richtext') {
  862. if (!processHtmlString) return;
  863. let _c = JSON.parse(x.content);
  864. let p = _c.property || {};
  865. let lev = Number(p.title_style_level);
  866. if (p.is_title !== 'true' || lev < 1 || !_c.content) return;
  867. let style = this.title_list.find((y) => y.level === lev) || {};
  868. if (style && style.style) {
  869. style = JSON.parse(style.style);
  870. let c_text = _c.content;
  871. const parser = new DOMParser();
  872. const doc = parser.parseFromString(c_text, 'text/html');
  873. const body = doc.body;
  874. const pElements = body.querySelectorAll('p');
  875. processHtmlString(pElements, style);
  876. _c.content = body.innerHTML;
  877. x.content = JSON.stringify(_c);
  878. }
  879. }
  880. });
  881. if (content_group_row_list) this.content_group_row_list = JSON.parse(content_group_row_list) || [];
  882. },
  883. );
  884. },
  885. getLangList() {
  886. GetLanguageTypeList({ book_id: this.courseware_info.book_id, is_contain_zh: 'true' }).then(
  887. ({ language_type_list }) => {
  888. this.langList = language_type_list;
  889. },
  890. );
  891. },
  892. /**
  893. * 得到教材章节结构展开列表
  894. */
  895. getBookChapterStructExpandList() {
  896. ChapterGetBookChapterStructExpandList({
  897. book_id: this.projectId,
  898. node_deep_mode: 0,
  899. is_contain_producer: 'true',
  900. is_contain_auditor: 'true',
  901. }).then(({ node_list }) => {
  902. this.node_list = node_list;
  903. });
  904. },
  905. /**
  906. * 选择节点
  907. * @param {string} nodeId - 节点ID
  908. */
  909. selectNode(nodeId) {
  910. this.getCoursewareComponentContent_View(nodeId);
  911. this.getBookCoursewareInfo(nodeId);
  912. this.getCoursewareAuditRemarkList(nodeId);
  913. this.select_node = nodeId;
  914. },
  915. // 审核批注列表
  916. getCoursewareAuditRemarkList(id) {
  917. this.remark_list = [];
  918. GetCoursewareAuditRemarkList({
  919. courseware_id: id,
  920. }).then(({ remark_list }) => {
  921. this.remark_list = remark_list;
  922. if (!remark_list) return;
  923. this.remark_list_obj = remark_list.reduce((acc, item) => {
  924. if (!acc[item.component_id]) {
  925. acc[item.component_id] = [];
  926. }
  927. acc[item.component_id].push(item);
  928. return acc;
  929. }, {});
  930. });
  931. },
  932. addRemark(selectNode, x, y, componentId, content_select) {
  933. this.remark = {
  934. remark_content: '',
  935. file_id_list: [],
  936. };
  937. this.visibleRemark = true;
  938. if (selectNode) {
  939. this.menuPosition = {
  940. x,
  941. y,
  942. componentId,
  943. content_select,
  944. };
  945. } else {
  946. this.menuPosition = {
  947. x: -1,
  948. y: -1,
  949. componentId: 'WHOLE',
  950. content_select,
  951. };
  952. }
  953. },
  954. dialogClose(type) {
  955. this[`visible${type}`] = false;
  956. },
  957. // 添加审核批注
  958. addCoursewareAuditRemark(id) {
  959. this.submit_loading = true;
  960. AddCoursewareAuditRemark({
  961. courseware_id: id || this.id,
  962. content: this.remark.remark_content,
  963. component_id: this.menuPosition.componentId,
  964. position_x: this.menuPosition.x,
  965. position_y: this.menuPosition.y,
  966. content_select: this.menuPosition.content_select,
  967. file_id_list: this.remark.file_id_list,
  968. })
  969. .then(() => {
  970. this.submit_loading = false;
  971. this.visibleRemark = false;
  972. this.getCoursewareAuditRemarkList(id || this.id);
  973. })
  974. .catch(() => {
  975. this.submit_loading = false;
  976. });
  977. },
  978. // 删除批注
  979. deleteRemarks(id) {
  980. this.$confirm('确定要删除此条批注吗?', '提示', {
  981. confirmButtonText: '确定',
  982. cancelButtonText: '取消',
  983. type: 'warning',
  984. })
  985. .then(() => {
  986. DeleteCoursewareAuditRemarkList({ id }).then(() => {
  987. this.getCoursewareAuditRemarkList(this.select_node ? this.select_node : this.id);
  988. this.$message.success('删除成功!');
  989. });
  990. })
  991. .catch(() => {});
  992. },
  993. // 定位批注
  994. async handleLocationRemarks(componentId) {
  995. if (componentId) {
  996. let node = await this.$refs.courserware.findChildComponentByKey(componentId);
  997. if (node) {
  998. await this.$nextTick();
  999. this.$refs.previewMain.scrollTo({
  1000. top: node.$el.offsetTop - 50,
  1001. left: node.$el.offsetLeft - 50,
  1002. behavior: 'smooth',
  1003. });
  1004. }
  1005. }
  1006. },
  1007. // 计算previewMain滑动距离
  1008. computeScroll() {
  1009. this.$refs.courserware.handleResult(
  1010. this.$refs.previewMain.scrollTop,
  1011. this.$refs.previewMain.scrollLeft,
  1012. this.select_node,
  1013. );
  1014. },
  1015. /**
  1016. * 处理侧边栏图标点击事件
  1017. * @param {string} handle - 处理函数名
  1018. * @param {any} param - 处理函数参数
  1019. * @param {string} icon - 图标名称
  1020. */
  1021. handleSidebarClick(handle, param, icon, children, barLevel) {
  1022. if (typeof handle === 'string' && handle && typeof this[handle] === 'function') {
  1023. this[handle](param);
  1024. }
  1025. if (barLevel === 2) {
  1026. this.twoCurToolbarIcon = icon;
  1027. } else {
  1028. this.curToolbarIcon = icon;
  1029. this.twoCurToolbarIcon = '';
  1030. }
  1031. if (children && children.length > 0 && Array.isArray(children)) {
  1032. this.twoSidebarList = children;
  1033. this.twoCurToolbarIcon = children[0].icon;
  1034. this.openDrawer(children[0].param);
  1035. }
  1036. },
  1037. openMindMap() {
  1038. MangerGetBookMindMap({ book_id: this.projectId }).then(({ content }) => {
  1039. if (content) {
  1040. this.mindMapJsonData = JSON.parse(content);
  1041. this.isChildDataLoad = true;
  1042. }
  1043. });
  1044. this.visibleMindMap = true;
  1045. },
  1046. async handleNodeClick(data) {
  1047. let [nodeId, componentId] = data.split('#');
  1048. if (nodeId) this.selectNode(nodeId);
  1049. if (componentId) {
  1050. let node = await this.$refs.courserware.findChildComponentByKey(componentId);
  1051. if (node) {
  1052. await this.$nextTick();
  1053. this.$refs.previewMain.scrollTo({
  1054. top: node.$el.offsetTop - 50,
  1055. left: node.$el.offsetLeft - 50,
  1056. behavior: 'smooth',
  1057. });
  1058. }
  1059. }
  1060. this.visibleMindMap = false;
  1061. this.visibleVisNetwork = false;
  1062. },
  1063. /**
  1064. * 打开知识图谱
  1065. */
  1066. async openVisNetwork() {
  1067. this.visibleVisNetwork = true;
  1068. },
  1069. /**
  1070. * 打开选择语言弹窗
  1071. */
  1072. openTranslate(params) {
  1073. if (params && params.type) this.drawerType = Number(params.type);
  1074. },
  1075. openSetting({ type }) {
  1076. this.drawerType = type;
  1077. },
  1078. /**
  1079. * 打开抽屉并初始化加载
  1080. * @param {Object} param - 抽屉参数
  1081. * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频, 3:H5 游戏,4:3D 模型,5:文本)
  1082. */
  1083. openDrawer({ type }) {
  1084. if (this.drawerType === type) {
  1085. this.drawerType = '';
  1086. return;
  1087. }
  1088. this.activeBookChapterId = '';
  1089. this.multimediaIsAllShow = true;
  1090. // 重置所有加载状态
  1091. this.resetLoadState();
  1092. this.drawerType = type;
  1093. this.$nextTick(() => {
  1094. // 确保DOM更新后触发加载
  1095. this.loadBookChapterStructExpandList();
  1096. });
  1097. },
  1098. openAudit() {
  1099. this.drawerType = '';
  1100. },
  1101. resetLoadState() {
  1102. this.cur_page = 1;
  1103. this.file_list = [];
  1104. this.total_count = 0;
  1105. this.loading = false;
  1106. this.lastLoadTime = 0; // 重置时间戳,允许立即加载
  1107. this.loadCount = 0;
  1108. },
  1109. /**
  1110. * 加载章节
  1111. */
  1112. async loadBookChapterStructExpandList() {
  1113. const params = {
  1114. book_id: this.projectId,
  1115. node_deep_mode: 3, // 节点深度模式 0【全部】,1【只查询章节】2【只查询非叶子章节】3【只查询第一层】
  1116. is_contain_root_node: 'false', // 是否包含根节点(把教材作为根节点)
  1117. is_contain_producer: 'false', // 是否包含制作人信息
  1118. is_contain_auditor: 'false', // 是否包含审核人信息
  1119. };
  1120. await GetBookChapterStructExpandList(params).then(({ node_list }) => {
  1121. this.bookChapterList = node_list || [];
  1122. });
  1123. },
  1124. /**
  1125. * 加载章节下的资源
  1126. */
  1127. async loadmultimediaList() {
  1128. const params = {
  1129. page_capacity: this.page_capacity,
  1130. cur_page: this.cur_page,
  1131. book_id: this.projectId,
  1132. book_chapter_node_id: this.activeBookChapterId,
  1133. type: parseInt(this.drawerType),
  1134. scope: this.multimediaIsAllShow ? -1 : 0,
  1135. };
  1136. await PageQueryBookResourceList(params)
  1137. .then(({ total_count, resource_list }) => {
  1138. this.total_count = total_count;
  1139. this.file_list = resource_list || [];
  1140. this.file_list.forEach((x, i) => {
  1141. this.$set(x, 'is_can_edit', x.is_can_edit === 'true');
  1142. this.$set(x, 'is_hided', x.is_hided === 'true');
  1143. });
  1144. })
  1145. .finally(() => {
  1146. this.loading = false;
  1147. });
  1148. },
  1149. /**
  1150. * 点击章节,切换数据
  1151. */
  1152. async multimediaHandleChange(id) {
  1153. const item = this.bookChapterList.find((item) => item.id === this.activeBookChapterId);
  1154. if (item) {
  1155. this.multimediaLoadingStates = true;
  1156. if ((!item.data && !item.error) || !id) {
  1157. await this.loadmultimediaList();
  1158. let tmpList = this.file_list && this.file_list.length > 0 ? [...this.file_list] : null;
  1159. this.$set(item, 'data', tmpList);
  1160. this.multimediaLoadingStates = false;
  1161. } else {
  1162. this.multimediaLoadingStates = false;
  1163. }
  1164. }
  1165. },
  1166. /**
  1167. * 切换资源显示隐藏
  1168. */
  1169. handleMediaShowChange(item) {
  1170. const params = { id: item.id, is_hided: item.is_hided ? 'true' : 'false' };
  1171. SetBookResourceHide(params).then((res) => {
  1172. // 如果不是显示全部资源,则需要重新加载
  1173. if (!this.multimediaIsAllShow) {
  1174. this.multimediaHandleChange();
  1175. }
  1176. });
  1177. },
  1178. isScrollAtBottom(container) {
  1179. if (!container) return false;
  1180. return container.scrollHeight - container.scrollTop <= container.clientHeight + 5;
  1181. },
  1182. async handleFileClick(courseware_id, component_id) {
  1183. if (courseware_id) this.selectNode(courseware_id);
  1184. if (component_id) {
  1185. let node = await this.$refs.courserware.findChildComponentByKey(component_id);
  1186. if (node) {
  1187. await this.$nextTick();
  1188. this.$refs.previewMain.scrollTo({
  1189. top: node.offsetTop - 50,
  1190. left: node.offsetLeft - 50,
  1191. behavior: 'smooth',
  1192. });
  1193. }
  1194. }
  1195. },
  1196. /**
  1197. * 文本转换
  1198. * @param {string} text - 要转换的文本
  1199. * @returns {string} - 转换后的文本
  1200. */
  1201. convertText(text) {
  1202. if (this.chinese === 'zh-Hant' && this.opencc) {
  1203. try {
  1204. if (/<[a-z][\s\S]*>/i.test(text)) {
  1205. return this.convertHtmlPreserveAttributes(text);
  1206. }
  1207. } catch (e) {
  1208. return text;
  1209. }
  1210. return this.opencc(text);
  1211. }
  1212. return text;
  1213. },
  1214. /**
  1215. * 使用OpenCC解析HTML并仅转换文本节点,保留属性(包括内联样式/font-family)保持不变。防止字体名称像“微软雅黑' 正在转换为'微軟雅黑'.
  1216. */
  1217. convertHtmlPreserveAttributes(html) {
  1218. try {
  1219. const parser = new DOMParser();
  1220. const doc = parser.parseFromString(html, 'text/html'); // 解析HTML字符串,返回Document对象
  1221. // 跳过 script 和 style 标签
  1222. const skipTags = new Set(['SCRIPT', 'STYLE']);
  1223. const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT);
  1224. let node = walker.nextNode();
  1225. while (node) {
  1226. const parent = node.parentNode;
  1227. if (parent && !skipTags.has(parent.nodeName)) {
  1228. const v = node.nodeValue;
  1229. if (v && v.trim()) {
  1230. node.nodeValue = this.opencc(v);
  1231. }
  1232. }
  1233. node = walker.nextNode();
  1234. }
  1235. return doc.body.innerHTML;
  1236. } catch (err) {
  1237. try {
  1238. return this.opencc(html);
  1239. } catch (e) {
  1240. return html;
  1241. }
  1242. }
  1243. },
  1244. simulateAnswer(disabled = true) {
  1245. this.$refs.courserware.simulateAnswer(this.isJudgeCorrect, this.isShowAnswer, disabled);
  1246. },
  1247. /**
  1248. * 选择节点
  1249. * @param {string} nodeId - 节点ID
  1250. * @param {boolean} isLeaf - 是否是叶子节点
  1251. */
  1252. selectChapterNode(nodeId, isLeaf) {
  1253. if (!isLeaf) return;
  1254. if (this.curSelectId === nodeId) return;
  1255. this.curSelectId = nodeId;
  1256. this.selectNode(nodeId);
  1257. this.isShowGroup = false;
  1258. this.groupShowAll = true;
  1259. this.$refs.courserware.clearRowCheckList();
  1260. },
  1261. /**
  1262. * 计算章节名称样式
  1263. * @param {number} deep - 节点深度
  1264. * @param {boolean} isLeaf - 是否是叶子节点
  1265. * @returns {Object} - 样式对象
  1266. */
  1267. computedNameStyle(deep, isLeaf) {
  1268. return {
  1269. 'padding-left': `${(deep - 1) * 8}px`,
  1270. cursor: isLeaf ? 'pointer' : 'auto',
  1271. };
  1272. },
  1273. /**
  1274. * 计算章节名称颜色
  1275. * @param {string} status - 章节状态
  1276. * @param {boolean} is_leaf_chapter - 是否是叶子章节
  1277. * @param {string} is_my_edit_task - 是否是我的编辑任务
  1278. * @param {string} nodeId - 节点ID
  1279. * @returns {string} - 颜色值
  1280. */
  1281. computedNameColor(status, is_leaf_chapter, is_my_edit_task, nodeId) {
  1282. if (!isTrue(is_leaf_chapter)) {
  1283. return '';
  1284. }
  1285. // 如果当前节点不可编辑,显示默认色
  1286. if (is_my_edit_task === 'false') {
  1287. return '';
  1288. }
  1289. // 当前选中节点,显示高亮蓝色
  1290. if (this.curSelectId === nodeId) {
  1291. return '#4095e5';
  1292. }
  1293. // 审核通过显示绿色,其他显示默认蓝色
  1294. let color = '#74b9ff';
  1295. if (status === 2) {
  1296. color = '#27ae60';
  1297. return color;
  1298. }
  1299. return color;
  1300. },
  1301. /**
  1302. * 切换左侧导航栏显示与隐藏
  1303. */
  1304. toggleNavigationShow() {
  1305. this.navigationShow = !this.navigationShow;
  1306. },
  1307. /**
  1308. * 切换右侧工具栏显示与隐藏
  1309. */
  1310. toggleSidebarShow() {
  1311. this.sidebarShow = !this.sidebarShow;
  1312. },
  1313. backTop() {
  1314. this.$refs.previewMain.scrollTo({
  1315. top: 0,
  1316. left: 0,
  1317. behavior: 'smooth',
  1318. });
  1319. },
  1320. /**
  1321. * 定位到对应位置
  1322. * @param {Object} item - 位置对象
  1323. * @param {number} type - 定位类型(11: 笔记定位, 12: 收藏定位, 13:反馈定位 0: 资源定位)
  1324. */
  1325. handleLocation(item, type) {
  1326. if (type === 0) {
  1327. let did = `${item.courseware_id}#${item.component_id}`;
  1328. this.handleNodeClick(did);
  1329. this.curSelectId = item.courseware_id;
  1330. return;
  1331. }
  1332. if (this.$refs.courserware && this.$refs.courserware.handleLocation) {
  1333. item.type = type;
  1334. this.$refs.courserware.handleLocation(item);
  1335. }
  1336. },
  1337. openFile(file) {
  1338. if (file && file.file_url) {
  1339. window.open(file.file_url);
  1340. }
  1341. },
  1342. dialogSave(obj) {
  1343. if (this.dialogType === 1) return this.saveNote(obj);
  1344. if (this.dialogType === 2) return this.saveFeedback(obj);
  1345. },
  1346. dialogCancel(id) {
  1347. if (this.dialogType === 1) return this.delNote(id);
  1348. if (this.dialogType === 2) return this.delFeedback(id);
  1349. },
  1350. /**
  1351. * 获取笔记列表
  1352. * @param {Object} params - 参数对象
  1353. */
  1354. async getNote(params) {
  1355. if (params && params.type) this.drawerType = Number(params.type);
  1356. this.allNoteList = [];
  1357. await GetMyNoteList({ courseware_id: this.curSelectId }).then((res) => {
  1358. if (res.status === 1) {
  1359. res.note_list.forEach((x) => {
  1360. if (x.note_desc) {
  1361. let n = JSON.parse(x.note_desc);
  1362. let obj = {
  1363. coursewareId: x.courseware_id,
  1364. id: x.id,
  1365. blockId: n.blockId,
  1366. startIndex: n.startIndex,
  1367. endIndex: n.endIndex,
  1368. text: n.text,
  1369. note: n.note,
  1370. };
  1371. this.allNoteList.push(obj);
  1372. }
  1373. });
  1374. }
  1375. });
  1376. },
  1377. async handEditNote(note) {
  1378. this.oldRichData = {};
  1379. if (this.allNoteList.length === 0) {
  1380. await this.getNote();
  1381. }
  1382. let old = this.allNoteList.find(
  1383. (x) =>
  1384. x.coursewareId === note.coursewareId &&
  1385. x.blockId === note.blockId &&
  1386. x.startIndex === note.startIndex &&
  1387. x.endIndex === note.endIndex,
  1388. );
  1389. if (old) {
  1390. this.oldRichData = old;
  1391. this.oldRichData.dataStr = old.note;
  1392. }
  1393. this.newSelectedInfo = note;
  1394. this.editDialogOpen = true;
  1395. this.dialogType = 1;
  1396. },
  1397. saveNote(note) {
  1398. let noteInfo = {
  1399. blockId: this.newSelectedInfo.blockId,
  1400. startIndex: this.newSelectedInfo.startIndex,
  1401. endIndex: this.newSelectedInfo.endIndex,
  1402. note: note.dataStr,
  1403. text: this.newSelectedInfo.text,
  1404. };
  1405. let reqData = {
  1406. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  1407. component_id: 'WHOLE',
  1408. note_desc: JSON.stringify(noteInfo), // 位置描述
  1409. };
  1410. if (note.id) {
  1411. if (!noteInfo.note) {
  1412. this.delNote(note.id);
  1413. return;
  1414. }
  1415. let upDate = {
  1416. id: note.id,
  1417. note_desc: reqData.note_desc,
  1418. };
  1419. UpdateMyNote(upDate).then(() => {
  1420. this.getNote();
  1421. });
  1422. } else {
  1423. AddMyNote(reqData).then(() => {
  1424. this.getNote();
  1425. });
  1426. }
  1427. this.editDialogOpen = false;
  1428. this.newSelectedInfo = null;
  1429. this.selectedInfo = null;
  1430. },
  1431. handDelNote(id) {
  1432. this.$confirm('确定要删除此条笔记吗?', '提示', {
  1433. confirmButtonText: '确定',
  1434. cancelButtonText: '取消',
  1435. type: 'warning',
  1436. })
  1437. .then(() => {
  1438. this.delNote(id);
  1439. })
  1440. .catch(() => {});
  1441. },
  1442. delNote(id) {
  1443. const noteId = id || (this.oldRichData && this.oldRichData.id);
  1444. if (!noteId) return;
  1445. DeleteMyNote({ id: noteId }).then(() => {
  1446. this.allNoteList = this.allNoteList.filter((x) => x.id !== noteId);
  1447. });
  1448. },
  1449. async getCollect(params) {
  1450. if (params && params.type) this.drawerType = Number(params.type);
  1451. this.allCottectList = [];
  1452. await GetMyCollectList({ courseware_id: this.curSelectId }).then((res) => {
  1453. if (res.status === 1) {
  1454. res.collect_list.forEach((x) => {
  1455. if (x.collect_desc) {
  1456. let n = JSON.parse(x.collect_desc);
  1457. let obj = {
  1458. coursewareId: x.courseware_id,
  1459. id: x.id,
  1460. blockId: n.blockId,
  1461. startIndex: n.startIndex,
  1462. endIndex: n.endIndex,
  1463. text: n.text,
  1464. };
  1465. this.allCottectList.push(obj);
  1466. }
  1467. });
  1468. }
  1469. });
  1470. },
  1471. async saveCollect(collect) {
  1472. if (this.allCottectList.length === 0) {
  1473. await this.getCollect();
  1474. }
  1475. let old = this.allCottectList.find(
  1476. (x) =>
  1477. x.coursewareId === collect.coursewareId &&
  1478. x.blockId === collect.blockId &&
  1479. x.startIndex === collect.startIndex &&
  1480. x.endIndex === collect.endIndex,
  1481. );
  1482. if (old) {
  1483. this.$message({
  1484. dangerouslyUseHTMLString: true,
  1485. message: "<i class='el-icon-check' />已收藏",
  1486. });
  1487. return;
  1488. }
  1489. this.newSelectedInfo = collect;
  1490. let collectInfo = {
  1491. blockId: this.newSelectedInfo.blockId,
  1492. startIndex: this.newSelectedInfo.startIndex,
  1493. endIndex: this.newSelectedInfo.endIndex,
  1494. text: this.newSelectedInfo.text,
  1495. };
  1496. let reqData = {
  1497. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  1498. component_id: 'WHOLE',
  1499. collect_desc: JSON.stringify(collectInfo), // 位置描述
  1500. };
  1501. AddMyCollect(reqData)
  1502. .then(() => {
  1503. this.getCollect();
  1504. })
  1505. .then(() => {
  1506. this.$message({
  1507. dangerouslyUseHTMLString: true,
  1508. message: "<i class='el-icon-check' />已收藏",
  1509. });
  1510. });
  1511. },
  1512. handDelCollect(id) {
  1513. this.$confirm('确定要删除此条收藏吗?', '提示', {
  1514. confirmButtonText: '确定',
  1515. cancelButtonText: '取消',
  1516. type: 'warning',
  1517. })
  1518. .then(() => {
  1519. DeleteMyCollect({ id }).then(() => {
  1520. this.allCottectList = this.allCottectList.filter((x) => x.id !== id);
  1521. });
  1522. })
  1523. .catch(() => {});
  1524. },
  1525. async getTranslate(info) {
  1526. this.showTranslate = true;
  1527. this.translateText = info.text;
  1528. },
  1529. async getFeedback(params) {
  1530. if (params && params.type) this.drawerType = Number(params.type);
  1531. this.allFeedbackList = [];
  1532. await GetCoursewareFeedbackList({ courseware_id: this.curSelectId }).then((res) => {
  1533. if (res.status === 1 && res.feedback_list) {
  1534. res.feedback_list.forEach((x) => {
  1535. if (x.content) {
  1536. let n = JSON.parse(x.content);
  1537. let obj = {
  1538. coursewareId: x.courseware_id,
  1539. id: x.id,
  1540. blockId: n.blockId,
  1541. startIndex: n.startIndex,
  1542. endIndex: n.endIndex,
  1543. text: n.text,
  1544. feedBack: n.feedBack,
  1545. };
  1546. this.allFeedbackList.push(obj);
  1547. }
  1548. });
  1549. }
  1550. });
  1551. },
  1552. async handEditFeedback(feedBack) {
  1553. this.oldRichData = {};
  1554. if (this.allFeedbackList.length === 0) {
  1555. await this.getFeedback();
  1556. }
  1557. let old = this.allFeedbackList.find(
  1558. (x) =>
  1559. x.coursewareId === feedBack.coursewareId &&
  1560. x.blockId === feedBack.blockId &&
  1561. x.startIndex === feedBack.startIndex &&
  1562. x.endIndex === feedBack.endIndex,
  1563. );
  1564. if (old) {
  1565. this.oldRichData = old;
  1566. this.oldRichData.dataStr = old.feedBack;
  1567. }
  1568. this.newSelectedInfo = feedBack;
  1569. this.editDialogOpen = true;
  1570. this.dialogType = 2;
  1571. },
  1572. saveFeedback(feedBack) {
  1573. if (feedBack.id) {
  1574. this.delFeedback(feedBack.id);
  1575. }
  1576. if (feedBack.dataStr) {
  1577. let feedBackInfo = {
  1578. blockId: this.newSelectedInfo.blockId,
  1579. startIndex: this.newSelectedInfo.startIndex,
  1580. endIndex: this.newSelectedInfo.endIndex,
  1581. feedBack: feedBack.dataStr,
  1582. text: this.newSelectedInfo.text,
  1583. };
  1584. let reqData = {
  1585. courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
  1586. component_id: 'WHOLE',
  1587. content: JSON.stringify(feedBackInfo),
  1588. content_select: this.newSelectedInfo.text,
  1589. };
  1590. AddCoursewareFeedback(reqData).then(() => {
  1591. this.getFeedback();
  1592. });
  1593. }
  1594. this.editDialogOpen = false;
  1595. this.newSelectedInfo = null;
  1596. this.selectedInfo = null;
  1597. },
  1598. handDelFeedback(id) {
  1599. this.$confirm('确定要删除此条反馈吗?', '提示', {
  1600. confirmButtonText: '确定',
  1601. cancelButtonText: '取消',
  1602. type: 'warning',
  1603. })
  1604. .then(() => {
  1605. this.delFeedback(id);
  1606. })
  1607. .catch(() => {});
  1608. },
  1609. delFeedback(id) {
  1610. const feedBackId = id || (this.oldRichData && this.oldRichData.id);
  1611. if (!feedBackId) return;
  1612. DeleteCoursewareFeedback({ id: feedBackId })
  1613. .then(() => {
  1614. this.allFeedbackList = this.allFeedbackList.filter((x) => x.id !== feedBackId);
  1615. })
  1616. .catch((err) => {});
  1617. },
  1618. getSearch(params) {
  1619. if (params && params.type) this.drawerType = Number(params.type);
  1620. },
  1621. async querySearchList() {
  1622. this.searchList = [];
  1623. if (!this.searchContent) return;
  1624. await SearchBookContentText({ book_id: this.projectId, text: this.searchContent }).then((res) => {
  1625. if (res.status === 1) {
  1626. this.searchList = res.courseware_component_list;
  1627. }
  1628. });
  1629. },
  1630. fullScreen() {
  1631. toggleFullScreen(this.$refs.previewMain);
  1632. },
  1633. // 打开模拟答题权限控制弹窗
  1634. openSimulateAnswerPermissionControl() {
  1635. this.visiblePermissionControl = true;
  1636. },
  1637. // 创建课件预览链接
  1638. createCoursewarePreviewURL() {
  1639. CreateCoursewarePreviewURL({ courseware_id: this.select_node, valid_day_count: 20 }).then(({ url }) => {
  1640. this.preview_url = url;
  1641. this.visiblePreviewURL = true;
  1642. });
  1643. },
  1644. /**
  1645. * 计算选中分组行的课件信息
  1646. * @returns {object} 选中分组行的课件信息
  1647. */
  1648. computedSelectedGroupCoursewareInfo() {
  1649. return this.$refs.courserware.computedSelectedGroupCoursewareInfo();
  1650. },
  1651. startSelection(event) {
  1652. if (
  1653. this.isTrue(this.courseware_info.is_my_audit_task) &&
  1654. this.isTrue(this.courseware_info.is_can_add_audit_remark)
  1655. ) {
  1656. this.isSelecting = true;
  1657. let clientRect = document.getElementById(`selectable-area-preview`).getBoundingClientRect();
  1658. this.menuPosition.startX = event.clientX - clientRect.left;
  1659. this.menuPosition.startY = event.clientY - clientRect.top;
  1660. }
  1661. },
  1662. updateSelection(event) {
  1663. if (!this.isSelecting) return;
  1664. let clientRect = document.getElementById(`selectable-area-preview`).getBoundingClientRect();
  1665. this.menuPosition.endX = event.clientX - clientRect.left;
  1666. this.menuPosition.endY = event.clientY - clientRect.top;
  1667. },
  1668. endSelection() {
  1669. if (!this.isSelecting || this.menuPosition.startX === this.menuPosition.endX || !this.menuPosition.endX) return;
  1670. this.isSelecting = false;
  1671. const width = Math.abs(this.menuPosition.endX - this.menuPosition.startX);
  1672. const height = Math.abs(this.menuPosition.endY - this.menuPosition.startY);
  1673. const x =
  1674. this.menuPosition.endX > this.menuPosition.startX
  1675. ? `${this.menuPosition.startX}px`
  1676. : `${this.menuPosition.endX}px`;
  1677. const y =
  1678. this.menuPosition.endY > this.menuPosition.startY
  1679. ? `${this.menuPosition.startY}px`
  1680. : `${this.menuPosition.endY}px`;
  1681. let obj = {
  1682. id: Math.random().toString(36).substring(2, 10),
  1683. width: `${width}px`,
  1684. height: `${height}px`,
  1685. x,
  1686. y,
  1687. text: '',
  1688. };
  1689. this.menuPosition.startX = null;
  1690. this.menuPosition.endX = null;
  1691. this.menuPosition.startY = null;
  1692. this.menuPosition.endY = null;
  1693. if (width && height && this.isText) {
  1694. this.data.text_list.push(obj);
  1695. this.activeType = 'text';
  1696. this.activeIndex = this.data.text_list.length - 1;
  1697. this.hotspotsActiveIndex = this.data.text_list.length - 1;
  1698. } else if (width && height && !this.isText) {
  1699. this.data.input_list.push(obj);
  1700. this.activeType = 'input';
  1701. this.activeIndex = this.data.input_list.length - 1;
  1702. this.inputActiveIndex = this.data.input_list.length - 1;
  1703. }
  1704. },
  1705. async submitChapterAllCoursewareToAuditFlow(chapter_id) {
  1706. try {
  1707. await this.$confirm('确定要提交审核吗?', '提示', {
  1708. confirmButtonText: '确定',
  1709. cancelButtonText: '取消',
  1710. type: 'warning',
  1711. });
  1712. await SubmitChapterAllCoursewareToAuditFlow({ chapter_id });
  1713. this.getBookChapterStructExpandList();
  1714. this.$message.success('提交成功');
  1715. } catch (e) {
  1716. if (e === 'cancel') {
  1717. this.$message.error('已取消');
  1718. }
  1719. }
  1720. },
  1721. /**
  1722. * 更新组件背景信息
  1723. * @param {Object} param - 参数对象
  1724. * @param {string} param.courseware_id - 课件ID
  1725. * @param {string} param.component_id - 组件ID
  1726. * @param {object} background - 背景信息对象
  1727. */
  1728. updateComponentBackground({ courseware_id, component_id }, background) {
  1729. const component = this.component_list.find(
  1730. (c) => c.courseware_id === courseware_id && c.component_id === component_id,
  1731. );
  1732. if (component) {
  1733. this.$set(component, 'background', background);
  1734. }
  1735. },
  1736. },
  1737. };
  1738. </script>
  1739. <style lang="scss" scoped>
  1740. @use '@/styles/mixin.scss' as *;
  1741. $total-width: $courseware-width + $courseware-left-margin + $courseware-right-margin;
  1742. .common-preview {
  1743. &__header {
  1744. position: sticky;
  1745. top: 56px;
  1746. left: 0;
  1747. z-index: 9;
  1748. display: flex;
  1749. align-items: center;
  1750. height: 40px;
  1751. padding: 6px 4px;
  1752. margin-bottom: 5px;
  1753. background-color: #fff;
  1754. border-top: $border;
  1755. border-bottom: $border;
  1756. > .menu-container {
  1757. display: flex;
  1758. justify-content: space-between;
  1759. width: 360px;
  1760. padding: 4px 8px;
  1761. border-right: $border;
  1762. }
  1763. > .courseware {
  1764. display: flex;
  1765. flex-grow: 1;
  1766. column-gap: 16px;
  1767. align-items: center;
  1768. justify-content: space-between;
  1769. height: 40px;
  1770. .name-path {
  1771. min-width: 200px;
  1772. height: 40px;
  1773. padding: 4px 8px;
  1774. font-size: 14px;
  1775. line-height: 32px;
  1776. border-right: $border;
  1777. }
  1778. .lang-select {
  1779. :deep .el-input {
  1780. width: 100px;
  1781. }
  1782. :deep .el-input__inner {
  1783. height: 24px;
  1784. line-height: 24px;
  1785. background-color: #fff;
  1786. }
  1787. :deep .el-input__icon {
  1788. line-height: 24px;
  1789. }
  1790. }
  1791. .flow-nodename {
  1792. flex: 1;
  1793. }
  1794. .group {
  1795. display: flex;
  1796. align-items: center;
  1797. }
  1798. .operator {
  1799. display: flex;
  1800. column-gap: 8px;
  1801. align-items: center;
  1802. .link {
  1803. + .link {
  1804. margin-left: 0;
  1805. &::before {
  1806. margin-right: 8px;
  1807. color: #999;
  1808. content: '|';
  1809. }
  1810. }
  1811. }
  1812. }
  1813. }
  1814. }
  1815. .main-container {
  1816. position: relative;
  1817. flex: 1;
  1818. min-width: 1110px;
  1819. padding: 15px 0;
  1820. overflow: auto;
  1821. background-color: #ececec;
  1822. .catalogue-bar {
  1823. position: absolute;
  1824. top: 15px;
  1825. left: 0;
  1826. display: flex;
  1827. align-items: center;
  1828. justify-content: center;
  1829. width: 54px;
  1830. height: 54px;
  1831. margin: -9px 6px 0 240px;
  1832. cursor: pointer;
  1833. background-color: #fff;
  1834. border-radius: 2px;
  1835. box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 40%);
  1836. }
  1837. .sidebar-bar {
  1838. position: absolute;
  1839. top: 0;
  1840. right: 240px;
  1841. display: flex;
  1842. width: 60px;
  1843. height: calc(100vh - 166px);
  1844. .toolbar {
  1845. display: flex;
  1846. flex-direction: column;
  1847. align-items: center;
  1848. width: 60px;
  1849. height: 100%;
  1850. img {
  1851. cursor: pointer;
  1852. }
  1853. &-special {
  1854. display: flex;
  1855. flex-direction: column;
  1856. row-gap: 16px;
  1857. align-items: center;
  1858. width: 100%;
  1859. margin-bottom: 24px;
  1860. background-color: #fff;
  1861. img {
  1862. width: 36px;
  1863. height: 36px;
  1864. }
  1865. }
  1866. }
  1867. }
  1868. }
  1869. .back-top {
  1870. position: absolute;
  1871. right: 240px;
  1872. bottom: 0;
  1873. display: flex;
  1874. place-content: center center;
  1875. align-items: center;
  1876. width: 60px;
  1877. height: 60px;
  1878. cursor: pointer;
  1879. background-color: #fff;
  1880. }
  1881. main.preview-main {
  1882. display: flex;
  1883. flex: 1;
  1884. width: calc($total-width);
  1885. min-width: calc($total-width);
  1886. max-width: calc($total-width);
  1887. min-height: 100%;
  1888. margin: 0 auto;
  1889. background-color: #fff;
  1890. border-radius: 4px;
  1891. box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 40%);
  1892. .preview-left {
  1893. width: $courseware-left-margin;
  1894. min-width: $courseware-left-margin;
  1895. max-width: $courseware-left-margin;
  1896. background-color: $courseware-bgColor;
  1897. }
  1898. .preview-right {
  1899. width: $courseware-right-margin;
  1900. min-width: $courseware-right-margin;
  1901. max-width: $courseware-right-margin;
  1902. background-color: $courseware-bgColor;
  1903. }
  1904. &.no-audit {
  1905. margin: 0 auto;
  1906. }
  1907. }
  1908. .audit-content {
  1909. display: flex;
  1910. min-width: 1810px;
  1911. height: calc(100vh - 166px);
  1912. .left-menu {
  1913. display: flex;
  1914. flex-direction: column;
  1915. width: $catalogue-width;
  1916. font-family: 'Microsoft YaHei', 'Arial', sans-serif;
  1917. background-color: #fff;
  1918. .courseware-info {
  1919. display: flex;
  1920. column-gap: 18px;
  1921. width: 100%;
  1922. height: 186px;
  1923. padding: 6px 6px 24px;
  1924. border-bottom: $border;
  1925. .cover-image {
  1926. display: flex;
  1927. align-items: center;
  1928. justify-content: center;
  1929. width: 111px;
  1930. height: 157px;
  1931. background-color: rgba(229, 229, 229, 100%);
  1932. img {
  1933. max-width: 111px;
  1934. max-height: 157px;
  1935. }
  1936. }
  1937. .info-content {
  1938. display: flex;
  1939. flex-direction: column;
  1940. justify-content: space-between;
  1941. .catalogue-icon {
  1942. text-align: right;
  1943. .svg-icon {
  1944. cursor: pointer;
  1945. }
  1946. }
  1947. .courseware {
  1948. width: 159px;
  1949. height: 64px;
  1950. font-size: 16px;
  1951. .name {
  1952. font-weight: bold;
  1953. }
  1954. .editor {
  1955. display: -webkit-box;
  1956. overflow: hidden;
  1957. text-overflow: ellipsis;
  1958. word-break: break-word;
  1959. white-space: normal;
  1960. -webkit-line-clamp: 2;
  1961. /* 多行省略行数,按需调整 */
  1962. -webkit-box-orient: vertical;
  1963. }
  1964. }
  1965. }
  1966. }
  1967. .courseware-tree {
  1968. display: flex;
  1969. flex: 1;
  1970. flex-direction: column;
  1971. row-gap: 8px;
  1972. padding: 12px;
  1973. margin-top: 12px;
  1974. overflow: auto;
  1975. .menu-item {
  1976. display: flex;
  1977. align-items: center;
  1978. &:not(.courseware) {
  1979. font-weight: bold;
  1980. }
  1981. &.courseware {
  1982. &:hover {
  1983. .name,
  1984. .status {
  1985. background-color: #f3f3f3;
  1986. }
  1987. }
  1988. }
  1989. .svg-icon {
  1990. margin-left: 4px;
  1991. &.my-edit-task {
  1992. color: $right-color;
  1993. }
  1994. }
  1995. .name {
  1996. flex: 1;
  1997. padding: 4px 8px 4px 4px;
  1998. border-radius: 4px;
  1999. }
  2000. .status {
  2001. height: 32px;
  2002. padding: 4px 8px 4px 4px;
  2003. font-size: 12px;
  2004. line-height: 24px;
  2005. color: #f00004;
  2006. border-radius: 4px;
  2007. border-top-left-radius: 0;
  2008. border-bottom-left-radius: 0;
  2009. }
  2010. &.active {
  2011. .name {
  2012. font-weight: bold;
  2013. color: #4095e5;
  2014. }
  2015. }
  2016. }
  2017. }
  2018. }
  2019. .sidebar {
  2020. position: relative;
  2021. display: flex;
  2022. width: $sidebar-width;
  2023. .toolbar {
  2024. display: flex;
  2025. flex-direction: column;
  2026. align-items: center;
  2027. width: 60px;
  2028. height: 100%;
  2029. background-color: rgba(247, 248, 250, 100%);
  2030. img {
  2031. cursor: pointer;
  2032. }
  2033. &-special {
  2034. display: flex;
  2035. flex-direction: column;
  2036. row-gap: 16px;
  2037. margin-bottom: 24px;
  2038. }
  2039. &-list {
  2040. display: flex;
  2041. flex-direction: column;
  2042. row-gap: 16px;
  2043. align-items: center;
  2044. width: 100%;
  2045. .sidebar-item {
  2046. width: 100%;
  2047. text-align: center;
  2048. .sidebar-icon {
  2049. width: 36px;
  2050. height: 36px;
  2051. cursor: pointer;
  2052. }
  2053. &.active {
  2054. background-color: #4095e5;
  2055. }
  2056. }
  2057. }
  2058. }
  2059. .content {
  2060. flex: 1;
  2061. background-color: #fff;
  2062. .resource_box {
  2063. height: 100%;
  2064. overflow-y: auto;
  2065. border: 1px solid #e5e5e5;
  2066. .source-toolbar-list {
  2067. position: fixed;
  2068. z-index: 999;
  2069. display: flex;
  2070. width: 240px;
  2071. background: #f2f3f5;
  2072. .sidebar-item {
  2073. width: 100%;
  2074. padding-top: 5px;
  2075. text-align: center;
  2076. border-right: 1px solid #ccc;
  2077. .sidebar-icon {
  2078. width: 26px;
  2079. height: 26px;
  2080. cursor: pointer;
  2081. }
  2082. &.active {
  2083. background-color: #4095e5;
  2084. }
  2085. }
  2086. }
  2087. h5 {
  2088. position: fixed;
  2089. z-index: 999;
  2090. width: 240px;
  2091. padding: 0 5px;
  2092. margin: 0;
  2093. font-size: 18px;
  2094. line-height: 40px;
  2095. background: #f2f3f5;
  2096. }
  2097. .scroll-container {
  2098. display: flex;
  2099. flex-direction: column;
  2100. row-gap: 8px;
  2101. margin: 6px;
  2102. .list-item {
  2103. align-items: center;
  2104. border: 1px solid #ccc;
  2105. border-radius: 8px;
  2106. :deep .el-slider {
  2107. .el-slider__runway {
  2108. background-color: #eee;
  2109. }
  2110. }
  2111. .el-image {
  2112. display: flex;
  2113. width: 100%;
  2114. min-width: 100%;
  2115. height: 90px;
  2116. background-color: #ccc;
  2117. border-radius: 8px;
  2118. }
  2119. .video-play {
  2120. width: 100%;
  2121. min-width: 100%;
  2122. }
  2123. .text-box {
  2124. word-break: break-word;
  2125. }
  2126. }
  2127. }
  2128. p {
  2129. max-width: 140px;
  2130. color: #999;
  2131. text-align: center;
  2132. word-break: break-all;
  2133. }
  2134. .card-box li {
  2135. padding: 10px;
  2136. border-bottom: 1px solid #ccc;
  2137. .el-icon-notebook-2 {
  2138. display: block;
  2139. margin-bottom: 4px;
  2140. font-size: 12px;
  2141. color: grey;
  2142. }
  2143. }
  2144. .file-handle-info {
  2145. margin: 0 5px;
  2146. .mark {
  2147. display: flex;
  2148. align-items: center;
  2149. justify-content: space-between;
  2150. padding: 3px;
  2151. .linkLocation {
  2152. cursor: pointer;
  2153. }
  2154. }
  2155. .word {
  2156. flex: 1;
  2157. word-break: break-all;
  2158. }
  2159. }
  2160. ::v-deep .el-collapse-item__header {
  2161. margin-left: 5px;
  2162. }
  2163. ::v-deep .el-collapse-item__content {
  2164. padding-bottom: 5px;
  2165. }
  2166. .loading-text {
  2167. padding: 5px;
  2168. color: #999;
  2169. text-align: center;
  2170. }
  2171. .error-text {
  2172. padding: 5px;
  2173. color: #999;
  2174. text-align: center;
  2175. }
  2176. }
  2177. .setting {
  2178. h5 {
  2179. padding: 0 5px;
  2180. margin: 0;
  2181. font-size: 18px;
  2182. line-height: 40px;
  2183. background: #f2f3f5;
  2184. }
  2185. &-content {
  2186. padding: 10px;
  2187. }
  2188. }
  2189. }
  2190. .back-top {
  2191. position: absolute;
  2192. bottom: 0;
  2193. left: 0;
  2194. display: flex;
  2195. place-content: center center;
  2196. align-items: center;
  2197. width: 60px;
  2198. height: 60px;
  2199. cursor: pointer;
  2200. }
  2201. }
  2202. }
  2203. }
  2204. :deep .scroll-container .audio-wrapper {
  2205. width: 100% !important;
  2206. .audio-middle {
  2207. width: 100% !important;
  2208. padding: 6px 8px !important;
  2209. margin-left: 0;
  2210. border: none;
  2211. border-radius: 8px;
  2212. .audio-name {
  2213. text-align: left;
  2214. }
  2215. .slider-area {
  2216. column-gap: 8px !important;
  2217. }
  2218. :deep .remark-dialog {
  2219. .el-dialog__body {
  2220. padding: 5px 20px;
  2221. }
  2222. }
  2223. :deep .audit-dialog {
  2224. .el-dialog__body {
  2225. height: calc(100vh - 260px);
  2226. padding: 5px 20px;
  2227. }
  2228. .mind-map-container .mind-map {
  2229. height: calc(100vh - 310px);
  2230. }
  2231. }
  2232. }
  2233. }
  2234. .mt10 {
  2235. margin: 10px 0 0 !important;
  2236. background-color: #eee;
  2237. }
  2238. .file-list {
  2239. display: flex;
  2240. flex-direction: column;
  2241. row-gap: 5px;
  2242. li {
  2243. align-items: center;
  2244. .file-name {
  2245. display: flex;
  2246. column-gap: 14px;
  2247. align-items: center;
  2248. justify-content: space-between;
  2249. max-width: 500px;
  2250. padding: 8px 12px;
  2251. font-size: 14px;
  2252. color: #1d2129;
  2253. background-color: #f7f8fa;
  2254. border-radius: 8px;
  2255. p {
  2256. margin: 0;
  2257. }
  2258. span,
  2259. div {
  2260. display: flex;
  2261. align-items: center;
  2262. }
  2263. }
  2264. .svg-icon {
  2265. cursor: pointer;
  2266. }
  2267. }
  2268. }
  2269. </style>
  2270. <style lang="scss">
  2271. .tox-tinymce-aux {
  2272. z-index: 9999 !important;
  2273. }
  2274. </style>