CommonPreview.vue 73 KB

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