CommonPreview.vue 72 KB

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