index.vue 104 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="素材名称" prop="resourceName">
  5. <el-input
  6. v-model="queryParams.resourceName"
  7. placeholder="请输入素材名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="文件名称" prop="fileName">
  14. <el-input
  15. v-model="queryParams.fileName"
  16. placeholder="请输入素材名称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="分类" prop="typeId">
  23. <el-select
  24. v-model="queryParams.typeId"
  25. clearable
  26. placeholder="请选择或输入分类"
  27. @change="val => changeCateType(val, 1)"
  28. filterable
  29. :filter-method="filterTypeOptions"
  30. @visible-change="handleSelectVisibleChange">
  31. <el-option
  32. v-for="item in filteredRootTypeList"
  33. :key="item.dictValue"
  34. :label="item.dictLabel"
  35. :value="item.dictValue">
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item label="子分类" prop="typeSubId">
  40. <el-select v-model="queryParams.typeSubId" clearable placeholder="请选择子分类">
  41. <el-option
  42. v-for="item in subTypeList"
  43. :key="item.dictValue"
  44. :label="item.dictLabel"
  45. :value="item.dictValue">
  46. </el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  51. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <el-row :gutter="10" class="mb8">
  55. <el-col :span="1.5">
  56. <el-button
  57. type="primary"
  58. icon="el-icon-plus"
  59. size="mini"
  60. @click="handleAdd"
  61. :disabled="hasMinimizableDialog"
  62. v-hasPermi="['course:videoResource:add']"
  63. >新增</el-button>
  64. </el-col>
  65. <el-col :span="1.5">
  66. <el-button
  67. type="primary"
  68. icon="el-icon-plus"
  69. size="mini"
  70. @click="handleBatchAdd"
  71. :disabled="hasMinimizableDialog"
  72. v-hasPermi="['course:videoResource:batchAdd']"
  73. >批量新增</el-button>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-button
  77. type="primary"
  78. icon="el-icon-plus"
  79. size="mini"
  80. :disabled="multiple"
  81. @click="handleBatchUpdate"
  82. v-hasPermi="['course:videoResource:batchUpdateClass']"
  83. >批量修改分类</el-button>
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. type="danger"
  88. icon="el-icon-delete"
  89. size="mini"
  90. :disabled="multiple"
  91. @click="handleDelete"
  92. v-hasPermi="['course:videoResource:remove']"
  93. >删除</el-button>
  94. </el-col>
  95. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  96. </el-row>
  97. <el-table v-loading="loading" :data="resourceList" @selection-change="handleSelectionChange" border>
  98. <el-table-column type="selection" width="55" align="center" />
  99. <el-table-column label="序号" width="55" align="center">
  100. <template slot-scope="scope">
  101. {{ scope.$index + 1 }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="素材名称" align="center" :show-overflow-tooltip="true" prop="resourceName"/>
  105. <el-table-column label="文件名称" align="center" :show-overflow-tooltip="true" prop="fileName"/>
  106. <el-table-column label="排序" align="center" prop="sort" />
  107. <el-table-column label="分类" align="center">
  108. <template slot-scope="scope">
  109. <span v-if="scope.row.typeId">{{ getTypeName(scope.row.typeId) }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="子分类" align="center">
  113. <template slot-scope="scope">
  114. <span v-if="scope.row.typeSubId">{{ getTypeName(scope.row.typeSubId) }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="视频文件" align="center">
  118. <template slot-scope="scope">
  119. <a
  120. @click="handleVideoPreview(scope.row.videoUrl)"
  121. style="background-color: #409EFF; color: white; border: none; border-radius: 4px; padding: 4px 12px; cursor: pointer; font-size: 12px; display: inline-block; text-decoration: none;">
  122. 查看文件
  123. </a>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="CDN" align="center">
  127. <template slot-scope="scope">
  128. <a
  129. @click="copy(scope.row.videoUrl)"
  130. style="color: #409EFF; border: none; border-radius: 4px; padding: 4px 12px; cursor: pointer; font-size: 12px; display: inline-block; text-decoration: none;">
  131. 复制链接
  132. </a>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="关联题目" align="center">
  136. <template slot-scope="scope">
  137. <a
  138. @click="handleViewProject(scope.row, 3)"
  139. :style="scope.row.projectIds ? {
  140. backgroundColor: '#409EFF',
  141. color: 'white',
  142. border: 'none',
  143. borderRadius: '4px',
  144. padding: '4px 12px',
  145. cursor: 'pointer',
  146. fontSize: '12px',
  147. display: 'inline-block',
  148. textDecoration: 'none'
  149. } : {
  150. backgroundColor: 'rgb(154 156 159)',
  151. color: 'white',
  152. border: 'none',
  153. cursor: 'pointer',
  154. borderRadius: '4px',
  155. padding: '4px 12px',
  156. fontSize: '12px',
  157. display: 'inline-block',
  158. textDecoration: 'none'
  159. }">
  160. {{ scope.row.projectIds ? '查看详情' : '未关联题目' }}
  161. </a>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="视频时长" align="center">
  165. <template slot-scope="scope">
  166. <div style="padding: 4px 12px;background: linear-gradient(to right, rgb(196 219 255), #409EFF)">{{ formatDuration(scope.row.duration) }}</div>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="视频展示类型" align="center" prop="displayType" width="110">
  170. <template slot-scope="scope">
  171. {{ scope.row.displayType === 'portrait' ? '竖屏' : '横屏' }}
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  175. <template slot-scope="scope">
  176. <el-button
  177. size="mini"
  178. type="text"
  179. icon="el-icon-edit"
  180. @click="handleUpdate(scope.row)"
  181. :disabled="hasMinimizableDialog"
  182. v-hasPermi="['course:videoResource:edit']"
  183. >修改</el-button>
  184. <el-button
  185. size="mini"
  186. type="text"
  187. icon="el-icon-delete"
  188. @click="handleDelete(scope.row)"
  189. v-hasPermi="['course:videoResource:remove']"
  190. >删除</el-button>
  191. </template>
  192. </el-table-column>
  193. </el-table>
  194. <pagination
  195. v-show="total>0"
  196. :total="total"
  197. :page.sync="queryParams.pageNum"
  198. :limit.sync="queryParams.pageSize"
  199. @pagination="getList"
  200. />
  201. <!-- 添加或修改视频素材库对话框 -->
  202. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :before-close="cancel"
  203. @minimize="hasMinimizableDialog = true" @restore="hasMinimizableDialog = false">
  204. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  205. <el-form-item label="素材名称" prop="resourceName" style="margin-top: 20px">
  206. <el-input v-model="form.resourceName" placeholder="请输入" />
  207. </el-form-item>
  208. <el-form-item label="文件名称" prop="fileName" style="margin-top: 20px;display: none">
  209. <el-input v-model="form.fileName" placeholder="请输入" />
  210. </el-form-item>
  211. <el-form-item label="分类" prop="typeId">
  212. <el-select v-model="form.typeId" placeholder="请选择分类" style="width: 100%" @change="val => changeCateType(val, 2)">
  213. <el-option
  214. v-for="item in rootTypeList"
  215. :key="item.dictValue"
  216. :label="item.dictLabel"
  217. :value="item.dictValue">
  218. </el-option>
  219. </el-select>
  220. </el-form-item>
  221. <el-form-item label="子分类" prop="typeSubId">
  222. <el-select v-model="form.typeSubId" clearable placeholder="请选择子分类" style="width: 100%">
  223. <el-option
  224. v-for="item in subTypeList"
  225. :key="item.dictValue"
  226. :label="item.dictLabel"
  227. :value="item.dictValue">
  228. </el-option>
  229. </el-select>
  230. </el-form-item>
  231. <el-form-item label="排序" prop="sort">
  232. <el-input-number v-model="form.sort" :min="0" label="请输入排序"></el-input-number>
  233. </el-form-item>
  234. <el-form-item label="视频展示类型" prop="displayType">
  235. <el-radio-group v-model="form.displayType">
  236. <el-radio label="landscape">横屏</el-radio>
  237. <el-radio label="portrait">竖屏</el-radio>
  238. </el-radio-group>
  239. </el-form-item>
  240. <el-form-item label="关联题目" prop="projectIds">
  241. <el-select
  242. ref="customSelect"
  243. class="custom-select-class"
  244. v-model="form.projectIds"
  245. multiple
  246. placeholder="请选择关联题目"
  247. @click.native.stop="openProjectDialog(form.projectIds, 0)"
  248. style="width: 100%;">
  249. <el-option
  250. v-for="item in projectShowList"
  251. :key="item.id"
  252. :label="item.title"
  253. :value="item.id">
  254. </el-option>
  255. </el-select>
  256. </el-form-item>
  257. <el-form-item label="上传视频" prop="videoUrl" required>
  258. <el-upload
  259. ref="videoUpload"
  260. action="#"
  261. list-type="picture-card"
  262. :http-request="videoUpload"
  263. :file-list="fileList"
  264. :on-change="handleFileChange"
  265. accept=".mp4">
  266. <i slot="default" class="el-icon-plus"></i>
  267. <div slot="file" slot-scope="{file}">
  268. <div
  269. class="el-upload-list__item-thumbnail"
  270. style="display: flex; justify-content: center; align-items: center; background-color: #f5f7fa; height: 146px;"
  271. >
  272. <i class="el-icon-video-camera" style="font-size: 48px;" />
  273. </div>
  274. <span v-if="file.status === 'success'" class="el-upload-list__item-status-label">
  275. <i class="el-icon-upload-success el-icon--check"></i>
  276. </span>
  277. <span v-if="file.status === 'fail'" class="el-upload-list__item-status-label">
  278. <i class="el-icon-circle-close"></i>
  279. </span>
  280. <span class="el-upload-list__item-actions">
  281. <span
  282. class="el-upload-list__item-preview"
  283. @click="handleVideoPreview(form.videoUrl)"
  284. >
  285. <i class="el-icon-zoom-in"></i>
  286. </span>
  287. <span
  288. class="el-upload-list__item-delete"
  289. @click="handleRemove(file)"
  290. >
  291. <i class="el-icon-delete"></i>
  292. </span>
  293. </span>
  294. <div v-if="file.status === 'uploading'" class="el-upload-list__item-progress">
  295. <div class="dual-upload-progress">
  296. <div class="total-progress">
  297. <el-progress
  298. :percentage="currentUploadProgress.total"
  299. :show-text="true"
  300. :width="52"
  301. :format="() => `${Math.round(currentUploadProgress.total)}%`"
  302. ></el-progress>
  303. </div>
  304. <div class="line-progress-container">
  305. <div class="line-progress-item">
  306. <span class="line-label">线路1:</span>
  307. <el-progress
  308. :percentage="currentUploadProgress.line1"
  309. :show-text="false"
  310. :width="30"
  311. :status="currentUploadProgress.line1Status === 'success' ? 'success' :
  312. currentUploadProgress.line1Status === 'failed' ? 'exception' : ''"
  313. ></el-progress>
  314. <span class="line-status-text">{{ Math.round(currentUploadProgress.line1) }}%</span>
  315. </div>
  316. <div v-if="!isDdgy" class="line-progress-item">
  317. <span class="line-label">线路2:</span>
  318. <el-progress
  319. :percentage="currentUploadProgress.line2"
  320. :show-text="false"
  321. :width="30"
  322. :status="currentUploadProgress.line2Status === 'success' ? 'success' :
  323. currentUploadProgress.line2Status === 'failed' ? 'exception' : ''"
  324. ></el-progress>
  325. <span class="line-status-text">{{ Math.round(currentUploadProgress.line2) }}%</span>
  326. </div>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. </el-upload>
  332. </el-form-item>
  333. <el-form-item label="时长">
  334. <span>{{ formatDuration(form.duration) }}</span>
  335. </el-form-item>
  336. </el-form>
  337. <div slot="footer" class="dialog-footer">
  338. <el-button @click="cancel">取消</el-button>
  339. <el-button type="primary" @click="submitForm" :loading="add" :disabled="isUploading || add">
  340. {{ isUploading ? '上传中...' : '保存' }}
  341. </el-button>
  342. </div>
  343. </el-dialog>
  344. <el-dialog
  345. title="视频预览"
  346. :visible.sync="videoPreviewVisible"
  347. append-to-body
  348. :close-on-click-modal="true"
  349. width="700px"
  350. class="video-preview-dialog"
  351. :modal-append-to-body="false"
  352. :before-close="handleCloseVideoPreview">
  353. <video ref="up-video" id="video" width="100%" height="400px" controls :src="videoPreviewUrl" />
  354. </el-dialog>
  355. <!--批量修改弹框-->
  356. <el-dialog :title="'批量修改'" :visible.sync="batchUpdateVisible" width="700px" append-to-body :before-close="cancel"
  357. @minimize="hasMinimizableDialog = true" @restore="hasMinimizableDialog = false">
  358. <el-form ref="form" :model="batchUpdateForm" :rules="rules" label-width="80px">
  359. <el-form-item label="分类" prop="typeId">
  360. <el-select v-model="batchUpdateForm.typeId" placeholder="请选择分类" style="width: 100%" @change="val => changeCateType(val, 2)">
  361. <el-option
  362. v-for="item in rootTypeList"
  363. :key="item.dictValue"
  364. :label="item.dictLabel"
  365. :value="item.dictValue">
  366. </el-option>
  367. </el-select>
  368. </el-form-item>
  369. <el-form-item label="子分类" prop="typeSubId">
  370. <el-select v-model="batchUpdateForm.typeSubId" clearable placeholder="请选择子分类" style="width: 100%">
  371. <el-option
  372. v-for="item in subTypeList"
  373. :key="item.dictValue"
  374. :label="item.dictLabel"
  375. :value="item.dictValue">
  376. </el-option>
  377. </el-select>
  378. </el-form-item>
  379. </el-form>
  380. <div class="dialog-footer">
  381. <el-button @click="cancelBatch">取 消</el-button>
  382. <el-button type="primary" @click="submitBatchUpdate">保 存</el-button>
  383. </div>
  384. </el-dialog>
  385. <!-- 批量选择视频弹窗 -->
  386. <minimizable-dialog :title="'选择视频'" :visible.sync="batchAddVisible" width="1200px" append-to-body class="batch-dialog"
  387. :close-on-click-modal="false" :before-close="cancelBeforeBatch" @minimize="hasMinimizableDialog = true"
  388. @restore="hasMinimizableDialog = false">
  389. <div class="filter-container">
  390. <el-button type="primary" icon="el-icon-plus" size="small" @click="showUploadPanel">上传视频</el-button>
  391. </div>
  392. <el-table
  393. v-loading="batchLoading"
  394. :data="videoList"
  395. height="350"
  396. border>
  397. <el-table-column label="序号" width="60" align="center">
  398. <template slot-scope="scope">
  399. {{ scope.$index + 1 }}
  400. </template>
  401. </el-table-column>
  402. <el-table-column label="素材名称" align="center" prop="resourceName" min-width="120" />
  403. <el-table-column label="文件名称" align="center" prop="fileName" min-width="120" />
  404. <el-table-column label="分类" align="center" min-width="100">
  405. <template slot-scope="scope">
  406. {{ getTypeName(scope.row.typeId) }}
  407. </template>
  408. </el-table-column>
  409. <el-table-column label="子分类" align="center" min-width="100">
  410. <template slot-scope="scope">
  411. {{ getTypeName(scope.row.typeSubId) }}
  412. </template>
  413. </el-table-column>
  414. <el-table-column label="关联项目" align="center" min-width="100">
  415. <template slot-scope="scope">
  416. <a
  417. @click="handleViewProject(scope.row, 4)"
  418. :style="scope.row.projectIds.length > 0 ? {
  419. backgroundColor: '#409EFF',
  420. color: 'white',
  421. border: 'none',
  422. borderRadius: '4px',
  423. padding: '4px 12px',
  424. cursor: 'pointer',
  425. fontSize: '12px',
  426. display: 'inline-block',
  427. textDecoration: 'none'
  428. } : {
  429. backgroundColor: 'rgb(154 156 159)',
  430. color: 'white',
  431. border: 'none',
  432. cursor: 'pointer',
  433. borderRadius: '4px',
  434. padding: '4px 12px',
  435. fontSize: '12px',
  436. display: 'inline-block',
  437. textDecoration: 'none'
  438. }">
  439. {{ scope.row.projectIds.length > 0 ? '查看详情' : '未关联题目' }}
  440. </a>
  441. </template>
  442. </el-table-column>
  443. <el-table-column label="视频文件" align="center" prop="fileName" min-width="120">
  444. <template slot-scope="scope">
  445. <a
  446. @click="handleVideoPreview(scope.row.videoUrl)"
  447. style="background-color: #409EFF; color: white; border: none; border-radius: 4px; padding: 4px 12px; cursor: pointer; font-size: 12px; display: inline-block; text-decoration: none;">
  448. 查看文件
  449. </a>
  450. </template>
  451. </el-table-column>
  452. <el-table-column label="视频时长" align="center" width="80">
  453. <template slot-scope="scope">
  454. {{ formatDuration(scope.row.duration) }}
  455. </template>
  456. </el-table-column>
  457. <el-table-column label="上传进度" align="center" width="200">
  458. <template slot-scope="scope">
  459. <div class="batch-upload-progress">
  460. <div v-if="scope.row.uploadStatus === 'queued'" class="queue-status">
  461. <el-tag :color="getQueueStatusColor(scope.row.uploadStatus)" size="small">
  462. {{ getUploadStatusText(scope.row.uploadStatus, scope.row.queuePosition) }}
  463. </el-tag>
  464. </div>
  465. <div v-else class="total-progress-row">
  466. <span class="progress-label">总进度:</span>
  467. <el-progress
  468. :percentage="scope.row.progress || 0"
  469. :status="getProgressStatus(scope.row)"
  470. :show-text="true"
  471. :format="() => `${Math.round(scope.row.progress || 0)}%`"
  472. ></el-progress>
  473. </div>
  474. <div v-if="scope.row.uploadDetails && scope.row.uploadStatus !== 'queued'" class="line-progress-rows">
  475. <div class="line-progress-row">
  476. <span class="line-label">线路1:</span>
  477. <el-progress
  478. :percentage="scope.row.uploadDetails.line1 || 0"
  479. :status="scope.row.uploadDetails.line1Status === 'success' ? 'success' :
  480. scope.row.uploadDetails.line1Status === 'failed' ? 'exception' : 'warning'"
  481. :show-text="false"
  482. style="width: 60px;"
  483. ></el-progress>
  484. <span class="line-percentage">{{ Math.round(scope.row.uploadDetails.line1 || 0) }}%</span>
  485. </div>
  486. <div v-if="!isDdgy" class="line-progress-row">
  487. <span class="line-label">线路2:</span>
  488. <el-progress
  489. :percentage="scope.row.uploadDetails.line2 || 0"
  490. :status="scope.row.uploadDetails.line2Status === 'success' ? 'success' :
  491. scope.row.uploadDetails.line2Status === 'failed' ? 'exception' : 'warning'"
  492. :show-text="false"
  493. style="width: 60px;"
  494. ></el-progress>
  495. <span class="line-percentage">{{ Math.round(scope.row.uploadDetails.line2 || 0) }}%</span>
  496. </div>
  497. </div>
  498. </div>
  499. </template>
  500. </el-table-column>
  501. <el-table-column label="操作" align="center" width="150">
  502. <template slot-scope="scope">
  503. <el-button
  504. size="mini"
  505. type="text"
  506. icon="el-icon-edit"
  507. :disabled="scope.row.progress !== 100"
  508. @click="handleEditVideo(scope.row)">
  509. 编辑
  510. <el-tooltip
  511. v-if="scope.row.progress !== 100"
  512. content="上传完成后可编辑"
  513. placement="top"
  514. >
  515. <i class="el-icon-question"></i>
  516. </el-tooltip>
  517. </el-button>
  518. <el-button
  519. size="mini"
  520. type="text"
  521. icon="el-icon-delete"
  522. @click="handleDeleteVideo(scope.row)"
  523. :style="scope.row.uploadStatus === 'queued' ? 'color: #E6A23C;' : ''"
  524. >
  525. {{ scope.row.uploadStatus === 'queued' ? '取消' : '删除' }}
  526. </el-button>
  527. <el-button
  528. v-if="scope.row.progress < 100 && scope.row.uploadStatus === 'failed'"
  529. size="mini"
  530. type="text"
  531. icon="el-icon-refresh"
  532. @click="retryBatchUpload(scope.row)"
  533. style="color: #E6A23C;"
  534. >
  535. 重试
  536. </el-button>
  537. </template>
  538. </el-table-column>
  539. </el-table>
  540. <div class="dialog-footer">
  541. <el-button @click="cancelBatch">取 消</el-button>
  542. <el-button type="primary" :loading="add" :disabled="add || isUploading" @click="submitBatchAdd">保 存</el-button>
  543. </div>
  544. <!-- 批量上传视频弹窗 -->
  545. <el-dialog
  546. title="批量上传视频"
  547. :visible.sync="showUpload"
  548. width="500px"
  549. append-to-body
  550. :close-on-click-modal="false"
  551. class="upload-dialog">
  552. <el-form :model="batchUploadForm" ref="batchUploadForm" label-width="80px">
  553. <el-form-item style="margin-top: 20px" label="分类" prop="typeId" :rules="[{ required: true, message: '请选择分类', trigger: 'blur' }]">
  554. <el-select
  555. v-model="batchUploadForm.typeId"
  556. placeholder="请选择分类"
  557. style="width: 100%"
  558. @change="val => changeCateType(val, 3)"
  559. filterable
  560. >
  561. <el-option
  562. v-for="item in rootTypeList"
  563. :key="item.dictValue"
  564. :label="item.dictLabel"
  565. :value="item.dictValue">
  566. </el-option>
  567. </el-select>
  568. </el-form-item>
  569. <el-form-item label="子分类" prop="typeSubId" :rules="[{ required: true, message: '请选择子分类', trigger: 'blur' }]">
  570. <el-select
  571. v-model="batchUploadForm.typeSubId"
  572. clearable
  573. placeholder="请选择子分类"
  574. style="width: 100%"
  575. @change="changeSubType"
  576. filterable
  577. >
  578. <el-option
  579. v-for="item in subTypeList"
  580. :key="item.dictValue"
  581. :label="item.dictLabel"
  582. :value="item.dictValue">
  583. </el-option>
  584. </el-select>
  585. </el-form-item>
  586. <el-form-item label="视频展示类型" prop="displayType">
  587. <el-radio-group v-model="batchUploadForm.displayType">
  588. <el-radio label="landscape">横屏</el-radio>
  589. <el-radio label="portrait">竖屏</el-radio>
  590. </el-radio-group>
  591. </el-form-item>
  592. <el-form-item label="关联题目" prop="projectIds" v-show="currentProject === 'myhk'">
  593. <el-select
  594. ref="customSelect"
  595. class="custom-select-class"
  596. v-model="batchUploadForm.projectIds"
  597. multiple
  598. placeholder="请选择关联题目"
  599. @click.native.stop="openProjectDialog(batchUploadForm.projectIds, 1)"
  600. style="width: 100%;">
  601. <el-option
  602. v-for="item in projectShowList"
  603. :key="item.id"
  604. :label="item.title"
  605. :value="item.id">
  606. </el-option>
  607. </el-select>
  608. </el-form-item>
  609. <el-form-item label="上传视频" prop="files">
  610. <el-upload
  611. ref="batchVideoUpload"
  612. action="#"
  613. :http-request="batchVideoUpload"
  614. :file-list="batchFileList"
  615. :on-change="handleBatchFileChange"
  616. multiple
  617. accept=".mp4">
  618. <el-button type="primary" :disabled="batchUploadForm.typeSubId === null">选择文件</el-button>
  619. <div slot="tip" class="el-upload__tip">选择分类后才可以上传视频</div>
  620. </el-upload>
  621. </el-form-item>
  622. </el-form>
  623. </el-dialog>
  624. <!-- 添加或修改视频素材库对话框 -->
  625. <el-dialog :title="batchEditDialog.title" :visible.sync="batchEditDialog.open" width="600px" append-to-body :before-close="batchEditCancel">
  626. <el-form ref="batchEditDialogForm" :model="batchEditDialog.form" :rules="batchEditDialog.rules" label-width="80px">
  627. <el-form-item label="素材名称" prop="resourceName" style="margin-top: 20px">
  628. <el-input v-model="batchEditDialog.form.resourceName" placeholder="请输入" />
  629. </el-form-item>
  630. <el-form-item label="视频展示类型" prop="displayType">
  631. <el-radio-group v-model="batchEditDialog.form.displayType">
  632. <el-radio label="landscape">横屏</el-radio>
  633. <el-radio label="portrait">竖屏</el-radio>
  634. </el-radio-group>
  635. </el-form-item>
  636. <el-form-item label="文件名称" prop="fileName" style="margin-top: 20px;display: none">
  637. <el-input v-model="batchEditDialog.form.fileName" placeholder="请输入" />
  638. </el-form-item>
  639. <el-form-item label="关联题目" prop="projectIds">
  640. <el-select
  641. ref="customSelect"
  642. class="custom-select-class"
  643. v-model="batchEditDialog.form.projectIds"
  644. multiple
  645. placeholder="请选择关联题目"
  646. @click.native.stop="openProjectDialog(batchEditDialog.form.projectIds, 2)"
  647. style="width: 100%;">
  648. <el-option
  649. v-for="item in projectShowList"
  650. :key="item.id"
  651. :label="item.title"
  652. :value="item.id">
  653. </el-option>
  654. </el-select>
  655. </el-form-item>
  656. </el-form>
  657. <div slot="footer" class="dialog-footer">
  658. <el-button @click="batchEditCancel">取消</el-button>
  659. <el-button type="primary" @click="batchEditSubmitForm">保存</el-button>
  660. </div>
  661. </el-dialog>
  662. </minimizable-dialog>
  663. <!-- 项目选择弹窗 -->
  664. <el-dialog
  665. title="选择题目"
  666. :visible.sync="projectDialogVisible"
  667. width="1000px"
  668. append-to-body
  669. @close="cancelSelectProject"
  670. :close-on-click-modal="false">
  671. <div class="project-container">
  672. <!-- 左侧分类树 -->
  673. <div class="category-tree">
  674. <div class="tree-fixed-header">
  675. <el-input
  676. placeholder="请输入分类名称"
  677. v-model="categoryFilterText"
  678. size="small"
  679. clearable
  680. prefix-icon="el-icon-search">
  681. </el-input>
  682. </div>
  683. <div class="tree-content">
  684. <el-tree
  685. ref="categoryTree"
  686. :data="categoryTreeData"
  687. node-key="cateId"
  688. highlight-current
  689. :filter-node-method="filterNode"
  690. :props="{ label: 'cateName', children: 'children' }"
  691. @node-click="handleCategoryClick"
  692. :expand-on-click-node="false"
  693. default-expand-all>
  694. <span class="custom-tree-node" slot-scope="{ node, data }">
  695. <span>{{ node.label }}</span>
  696. </span>
  697. </el-tree>
  698. </div>
  699. </div>
  700. <!-- 右侧题目列表 -->
  701. <div class="project-list">
  702. <div class="filter-container">
  703. <el-form :inline="true" :model="projectQueryParams" ref="projectForm">
  704. <el-form-item>
  705. <el-input prefix-icon="el-icon-search" @input="searchProjects" v-model="projectQueryParams.title" placeholder="请输入题目标题" clearable size="small" />
  706. </el-form-item>
  707. </el-form>
  708. </div>
  709. <el-table
  710. ref="projectTable"
  711. height="350"
  712. :data="projectList"
  713. row-key="id"
  714. v-loading="projectLoading"
  715. border
  716. @select="handleProjectSelect"
  717. @select-all="handleProjectSelect">
  718. <el-table-column type="selection" reserve-selection width="55" align="center" />
  719. <el-table-column label="序号" width="60" align="center">
  720. <template slot-scope="scope">
  721. {{ scope.row.sort }}
  722. </template>
  723. </el-table-column>
  724. <el-table-column label="题目标题" align="center" prop="title" min-width="200" show-overflow-tooltip />
  725. </el-table>
  726. <div class="table-footer">
  727. <el-pagination style="text-align: right" v-show="projectListTotal>0" :pager-count="5" background
  728. @size-change="handleProjectPageSizeChange" @current-change="handleProjectPageChange" :current-page="projectQueryParams.pageNum"
  729. :page-sizes="[10, 20, 30, 50]" :page-size="projectQueryParams.pageSize" layout="total, sizes, prev, pager, next, jumper"
  730. :total="projectListTotal">
  731. </el-pagination>
  732. </div>
  733. </div>
  734. </div>
  735. <div slot="footer" class="dialog-footer">
  736. <span style="float: left; color: #606266; font-size: 13px;">
  737. 共选择 <span style="color: #409EFF; font-weight: bold;">{{ selectedProjectIds.length }}</span> 个题目
  738. </span>
  739. <el-button @click="projectDialogVisible = false">取消</el-button>
  740. <el-button type="primary" @click="confirmSelectProject">确定</el-button>
  741. </div>
  742. </el-dialog>
  743. <!-- 项目列表弹窗 -->
  744. <el-dialog
  745. title="题目列表"
  746. :visible.sync="projectListDialogVisible"
  747. width="600px"
  748. append-to-body
  749. :close-on-click-modal="false">
  750. <div class="project-list-container" style="max-height: 500px; overflow-y: auto; padding: 10px;">
  751. <!-- 题目列表 -->
  752. <div v-for="(item, index) in projectShowList" :key="index" class="question-card">
  753. <!-- 题目标题 -->
  754. <div class="question-header">
  755. <span class="question-index">{{ index + 1 }}</span>
  756. <span class="question-title">{{ item.title }}</span>
  757. </div>
  758. <!-- 题目类型 -->
  759. <div class="question-type">
  760. <el-tag size="small" type="primary">{{ item.type === 1 ? '单选' : '多选' }}</el-tag>
  761. </div>
  762. <!-- 题目内容 -->
  763. <div class="question-content" v-if="item.question && item.question.length > 0">
  764. <div class="content-title">题目内容:</div>
  765. <div v-for="(q, qIndex) in JSON.parse(item.question)" :key="qIndex" class="question-item"
  766. :style=" q.isAnswer === 1 ? 'background-color: rgb(234 245 251)' : ''">
  767. <div class="question-item-header">
  768. <span class="item-index">{{ convertToLetter(qIndex) }}</span>
  769. <span class="item-name">{{ q.name }}</span>
  770. </div>
  771. </div>
  772. </div>
  773. <!-- 答案 -->
  774. <div class="question-answer" v-if="item.answer">
  775. <span class="answer-label">答案:</span>
  776. <span class="answer-content">{{ item.answer }}</span>
  777. </div>
  778. </div>
  779. </div>
  780. </el-dialog>
  781. </div>
  782. </template>
  783. <script>
  784. import {
  785. addVideoResource,
  786. deleteVideoResource,
  787. getVideoResource,
  788. listVideoResource,
  789. updateVideoResource,
  790. batchAddVideoResource,
  791. batchUpdateVideoResource
  792. } from '@/api/course/videoResource'
  793. import {listUserCourseCategory,getCatePidList,getCateListByPid} from '@/api/course/userCourseCategory'
  794. import {getByIds, listCourseQuestionBank} from '@/api/course/courseQuestionBank'
  795. import {getThumbnail} from "@/api/course/userVideo";
  796. import {uploadObject} from "@/utils/cos.js";
  797. import {uploadToOBS} from "@/utils/obs.js";
  798. import {uploadToHSY} from "@/utils/hsy.js";
  799. import MinimizableDialog from "@/components/MinimizableDialog"
  800. import log from "@/views/monitor/job/log.vue";
  801. export default {
  802. name: 'VideoResource',
  803. components: {
  804. MinimizableDialog
  805. },
  806. data() {
  807. return {
  808. /** 本页视频资源类型:0-视频资源,1-公域课视频资源(与后端 video_type 一致) */
  809. pageVideoType: 0,
  810. filteredRootTypeList: [], // 过滤后的分类列表
  811. originalRootTypeList: [], // 原始分类列表
  812. // 遮罩层
  813. loading: true,
  814. // 选中数组
  815. ids: [],
  816. // 非单个禁用
  817. single: true,
  818. // 非多个禁用
  819. multiple: true,
  820. // 显示搜索条件
  821. showSearch: true,
  822. // 总条数
  823. total: 0,
  824. // 视频素材库表格数据
  825. resourceList: [],
  826. // 弹出层标题
  827. title: "",
  828. // 是否显示弹出层
  829. open: false,
  830. // 查询参数
  831. queryParams: {
  832. pageNum: 1,
  833. pageSize: 10,
  834. resourceName: null,
  835. fileName: null,
  836. typeId: null,
  837. typeSubId: null,
  838. videoType: 0
  839. },
  840. // 表单参数
  841. form: {
  842. id: null,
  843. resourceName: null,
  844. fileName: null,
  845. thumbnail: null,
  846. line1: null,
  847. line2: null,
  848. line3: null,
  849. duration: null,
  850. fileSize: null,
  851. fileKey: null,
  852. videoUrl: null,
  853. typeId: null,
  854. typeSubId: null,
  855. projectIds: [],
  856. sort: null,
  857. displayType: 'landscape',
  858. videoType: 0,
  859. hsyVid:null,//火山云上传视频返回vid
  860. hsyVodUrl:null,//火山云url
  861. // 新增上传状态字段
  862. uploadStatus: 'pending', // pending, uploading, success, failed
  863. uploadProgress: {
  864. total: 0,
  865. line1: 0,
  866. line2: 0,
  867. line1Status: 'pending', // pending, uploading, success, failed
  868. line2Status: 'pending'
  869. }
  870. },
  871. // 表单校验
  872. rules: {
  873. resourceName: [
  874. { required: true, message: "素材名称不能为空", trigger: "blur" }
  875. ],
  876. fileName: [
  877. { required: true, message: "文件名称不能为空", trigger: "blur" }
  878. ],
  879. typeId: [
  880. { required: true, message: "请选择分类", trigger: "change" }
  881. ],
  882. typeSubId: [
  883. { required: true, message: "请选择子分类", trigger: "change" }
  884. ],
  885. sort: [
  886. { required: true, message: '排序不能为空', trigger: 'blur' }
  887. ],
  888. videoUrl: [
  889. { required: true, message: "请上传视频", trigger: "change" }
  890. ]
  891. },
  892. // 课程列表数据
  893. projectList: [],
  894. projectShowList: [],
  895. // 分类
  896. typeList: [],
  897. rootTypeList: [],
  898. subTypeList: [],
  899. // 视频上传
  900. videoDisabled: false,
  901. videoPreviewVisible: false,
  902. videoPreviewUrl: '',
  903. fileList: [],
  904. // 批量添加相关
  905. batchAddVisible: false,
  906. batchLoading: false,
  907. videoList: [],
  908. // 批量修改相关
  909. batchUpdateVisible: false,
  910. batchUpdateLoading: false,
  911. batchUpdateForm: {
  912. typeId: null,
  913. typeSubId: null,
  914. ids: [],
  915. },
  916. // 批量上传相关
  917. showUpload: false,
  918. batchUploadForm: {
  919. typeId: null,
  920. typeSubId: null,
  921. projectIds: [],
  922. files: [],
  923. displayType: 'landscape'
  924. },
  925. batchFileList: [],
  926. // 弹窗选择项目相关
  927. projectDialogVisible: false,
  928. projectQueryParams: {
  929. pageNum: 1,
  930. pageSize: 10,
  931. questionType: null,
  932. questionSubType: null,
  933. title: null
  934. },
  935. projectLoading: false,
  936. projectListTotal: 0,
  937. selectedProjectIds: [],
  938. selectedType: 0,
  939. currentRow: null,
  940. // 分类树相关数据
  941. categoryFilterText: '',
  942. categoryTreeData: [],
  943. add: false,
  944. // 题目列表
  945. projectListDialogVisible: false,
  946. // 修改视频记录
  947. batchEditDialog: {
  948. title: '修改视频',
  949. open: false,
  950. form: {},
  951. rules: {
  952. resourceName: [
  953. { required: true, message: "素材名称不能为空", trigger: "blur" }
  954. ],
  955. fileName: [
  956. { required: true, message: "文件名称不能为空", trigger: "blur" }
  957. ]
  958. },
  959. },
  960. // 是否存在最小化窗口
  961. hasMinimizableDialog: false,
  962. // 新增上传相关状态
  963. isUploading: false,
  964. currentUploadProgress: {
  965. total: 0,
  966. line1: 0,
  967. line2: 0,
  968. line1Status: 'pending',
  969. line2Status: 'pending'
  970. },
  971. // 上传任务队列
  972. uploadQueue: [], // 上传队列
  973. currentBatchSize: 2, // 每批上传数量
  974. isProcessingBatch: false, // 是否正在处理批次
  975. currentBatchIndex: 0, // 当前批次索引
  976. uploadCancellationTokens: new Map(), // Store cancellation functions by video ID
  977. currentProject: process.env.VUE_APP_PROJECT,
  978. // 叮当国医项目标识:该项目的视频不需要上传线路2
  979. isDdgy: process.env.VUE_APP_PROJECT_CODE === 'ddgy' || process.env.VUE_APP_PROJECT_CODE === "'ddgy'"
  980. }
  981. },
  982. watch: {
  983. categoryFilterText(val) {
  984. this.$refs.categoryTree.filter(val);
  985. }
  986. },
  987. created() {
  988. this.getTypeList();
  989. this.getRootTypeList()
  990. this.getList();
  991. },
  992. methods: {
  993. /** 将数字索引转换为字母序号 (0->A, 1->B, 等) */
  994. convertToLetter(index) {
  995. // 确保索引是数字
  996. let numIndex = parseInt(index, 10);
  997. // 如果无法转换成数字,返回原始值
  998. if (isNaN(numIndex)) {
  999. return index;
  1000. }
  1001. // 处理负数情况
  1002. if (numIndex < 0) {
  1003. return index;
  1004. }
  1005. // 直接使用索引计算ASCII码(0对应A,1对应B,以此类推)
  1006. return String.fromCharCode(65 + numIndex); // 65 是大写字母 A 的ASCII码
  1007. },
  1008. /** 查询视频素材库列表 */
  1009. getList() {
  1010. this.loading = true;
  1011. this.queryParams.videoType = this.pageVideoType;
  1012. listVideoResource(this.queryParams).then(response => {
  1013. this.resourceList = response.rows;
  1014. this.total = response.total;
  1015. this.loading = false;
  1016. });
  1017. },
  1018. // 取消按钮
  1019. cancel() {
  1020. this.open = false;
  1021. this.reset();
  1022. this.resetForm("form");
  1023. this.batchUpdateVisible = false;
  1024. this.changeCateType(this.queryParams.typeId)
  1025. this.$refs.videoUpload.clearFiles()
  1026. },
  1027. // 表单重置
  1028. reset() {
  1029. // 初始化表单对象
  1030. this.form = {
  1031. id: null,
  1032. resourceName: null,
  1033. fileName: null,
  1034. thumbnail: null,
  1035. line1: null,
  1036. line2: null,
  1037. line3: null,
  1038. duration: null,
  1039. fileSize: null,
  1040. fileKey: null,
  1041. videoUrl: null,
  1042. typeId: null,
  1043. typeSubId: null,
  1044. projectIds: [],
  1045. displayType: 'landscape',
  1046. videoType: this.pageVideoType
  1047. };
  1048. // 重置表单验证状态
  1049. this.resetForm("form");
  1050. this.add = false
  1051. },
  1052. /** 搜索按钮操作 */
  1053. handleQuery() {
  1054. this.queryParams.pageNum = 1;
  1055. this.getList();
  1056. },
  1057. /** 重置按钮操作 */
  1058. resetQuery() {
  1059. this.resetForm("queryForm");
  1060. this.queryParams.videoType = this.pageVideoType;
  1061. this.handleQuery();
  1062. },
  1063. // 多选框选中数据
  1064. handleSelectionChange(selection) {
  1065. this.ids = selection.map(item => item.id)
  1066. this.single = selection.length!==1
  1067. this.multiple = !selection.length
  1068. },
  1069. /** 新增按钮操作 */
  1070. handleAdd() {
  1071. // 先清空文件列表
  1072. this.fileList = [];
  1073. this.projectShowList = [];
  1074. // 先重置表单
  1075. this.reset();
  1076. this.subTypeList = []
  1077. // 重置上传组件
  1078. if (this.$refs.videoUpload) {
  1079. this.$refs.videoUpload.clearFiles();
  1080. }
  1081. // 所有重置完成后再打开弹窗
  1082. this.open = true;
  1083. this.title = "添加视频素材库";
  1084. },
  1085. /** 修改按钮操作 */
  1086. handleUpdate(row) {
  1087. // 先清空文件列表
  1088. this.fileList = [];
  1089. this.projectShowList = [];
  1090. // 先重置表单
  1091. this.reset();
  1092. this.subTypeList = []
  1093. const id = row.id
  1094. // 获取数据并设置表单
  1095. getVideoResource(id).then(async response => {
  1096. this.form = response.data;
  1097. // 视频展示类型:旧数据可能为空,默认横屏
  1098. if (!this.form.displayType) {
  1099. this.form.displayType = 'landscape';
  1100. }
  1101. if (this.form.videoType === null || this.form.videoType === undefined) {
  1102. this.form.videoType = this.pageVideoType;
  1103. }
  1104. await this.changeCateType(this.form.typeId)
  1105. // 处理projectIds,确保是数组格式
  1106. if (this.form.projectIds && typeof this.form.projectIds === 'string') {
  1107. this.form.projectIds = this.form.projectIds.split(',').map(id => parseInt(id));
  1108. } else if (!this.form.projectIds) {
  1109. this.form.projectIds = [];
  1110. }
  1111. // 如果存在关联项目,获取项目详情用于回显
  1112. if (this.form.projectIds && this.form.projectIds.length > 0) {
  1113. // 加载项目列表信息用于回显
  1114. await getByIds({ids: this.form.projectIds.join(',')}).then(reponse => {
  1115. this.projectShowList = reponse.data
  1116. });
  1117. }
  1118. // 如果存在视频URL,设置fileList
  1119. if (this.form.videoUrl) {
  1120. this.fileList = [{
  1121. name: this.form.fileName || '视频文件',
  1122. url: this.form.videoUrl,
  1123. thumbnail: this.form.thumbnail,
  1124. status: 'success' // 设置为成功状态
  1125. }];
  1126. }
  1127. // 所有设置完成后再打开弹窗
  1128. this.open = true;
  1129. this.title = "修改视频素材库";
  1130. });
  1131. },
  1132. /** 提交按钮 */
  1133. submitForm() {
  1134. this.$refs["form"].validate(valid => {
  1135. if (valid) {
  1136. if (this.add){
  1137. this.$message.warning("请勿重复提交")
  1138. return
  1139. }
  1140. this.add = true
  1141. const params = Object.assign({}, this.form);
  1142. params.videoType = this.pageVideoType;
  1143. params.projectIds = this.form.projectIds.join(',');
  1144. if (this.form.id != null) {
  1145. updateVideoResource(params).then(response => {
  1146. if (response.code === 200) {
  1147. this.msgSuccess("修改成功");
  1148. this.open = false;
  1149. this.getList();
  1150. }
  1151. })
  1152. } else {
  1153. addVideoResource(params).then(response => {
  1154. if (response.code === 200) {
  1155. this.msgSuccess("新增成功");
  1156. this.open = false;
  1157. this.getList();
  1158. }
  1159. })
  1160. }
  1161. }
  1162. });
  1163. },
  1164. /** 删除按钮操作 */
  1165. handleDelete(row) {
  1166. const ids = row.id || this.ids;
  1167. this.$confirm('是否确认删除视频素材库编号为"' + ids + '"的数据项?', "警告", {
  1168. confirmButtonText: "确定",
  1169. cancelButtonText: "取消",
  1170. type: "warning"
  1171. }).then(function() {
  1172. return deleteVideoResource(ids);
  1173. }).then(() => {
  1174. this.getList();
  1175. this.msgSuccess("删除成功");
  1176. }).catch(function() {});
  1177. },
  1178. /** 查询视频分类列表 */
  1179. getTypeList() {
  1180. listUserCourseCategory().then(response => {
  1181. this.typeList = response.data;
  1182. });
  1183. },
  1184. getRootTypeList() {
  1185. getCatePidList().then(response => {
  1186. this.rootTypeList = response.data;
  1187. this.originalRootTypeList = [...response.data]; // 保存原始数据
  1188. this.filteredRootTypeList = [...response.data]; // 初始化过滤列表
  1189. });
  1190. },
  1191. /** 过滤分类选项 */
  1192. filterTypeOptions(query) {
  1193. if (!query) {
  1194. this.filteredRootTypeList = [...this.originalRootTypeList];
  1195. return;
  1196. }
  1197. this.filteredRootTypeList = this.originalRootTypeList.filter(item => {
  1198. return item.dictLabel.toLowerCase().includes(query.toLowerCase()) ||
  1199. item.dictValue.toString().includes(query);
  1200. });
  1201. },
  1202. /** 选择后重置过滤 */
  1203. onTypeSelect(value) {
  1204. // 确保选中后恢复完整列表
  1205. this.filteredRootTypeList = [...this.originalRootTypeList];
  1206. // 触发 change 事件
  1207. this.changeCateType(value, 1);
  1208. },
  1209. /** 重置过滤 */
  1210. resetFilter() {
  1211. this.filteredRootTypeList = [...this.originalRootTypeList];
  1212. },
  1213. /** 清除过滤 */
  1214. clearFilter() {
  1215. this.$nextTick(() => {
  1216. if (!this.queryParams.typeId) {
  1217. this.filteredRootTypeList = [...this.originalRootTypeList];
  1218. }
  1219. });
  1220. },
  1221. /** 处理下拉框显示状态变化 */
  1222. handleSelectVisibleChange(visible) {
  1223. if (!visible) {
  1224. // 下拉框关闭时恢复完整列表
  1225. this.filteredRootTypeList = [...this.originalRootTypeList];
  1226. } else {
  1227. // 下拉框打开时也确保列表完整
  1228. this.filteredRootTypeList = [...this.originalRootTypeList];
  1229. }
  1230. },
  1231. async changeCateType(val, type) {
  1232. if (type === 1) {
  1233. this.queryParams.typeSubId = null
  1234. }
  1235. if (type === 2) {
  1236. this.form.typeSubId = null
  1237. }
  1238. if (type === 3) {
  1239. this.batchUploadForm.typeSubId = null
  1240. if (this.currentProject === 'myhk') {
  1241. this.batchUploadForm.projectIds = []
  1242. }
  1243. }
  1244. this.subTypeList = []
  1245. if (!val) {
  1246. return
  1247. }
  1248. await getCateListByPid(val).then(response => {
  1249. this.subTypeList = response.data
  1250. })
  1251. },
  1252. changeSubType(val) {
  1253. if (this.currentProject !== 'myhk') {
  1254. return
  1255. }
  1256. this.projectShowList = []
  1257. this.batchUploadForm.projectIds = []
  1258. listCourseQuestionBank({questionSubType: val}).then(async response => {
  1259. const projectIds = response.rows.map(item => item.id)
  1260. // 如果存在关联项目,获取项目详情用于回显
  1261. if (projectIds && projectIds.length > 0) {
  1262. // 加载项目列表信息用于回显
  1263. await getByIds({ids: projectIds.join(',')}).then(reponse => {
  1264. this.projectShowList = reponse.data
  1265. this.batchUploadForm.projectIds = projectIds
  1266. });
  1267. }
  1268. })
  1269. },
  1270. /** 预览视频 */
  1271. handleVideoPreview(url) {
  1272. this.videoPreviewVisible = true;
  1273. this.videoPreviewUrl = url || this.form.videoUrl;
  1274. },
  1275. /** 格式化视频时长 */
  1276. formatDuration(seconds) {
  1277. if (!seconds) return '00:00';
  1278. const minutes = Math.floor(seconds / 60);
  1279. const remainingSeconds = seconds % 60;
  1280. return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
  1281. },
  1282. /** 移除视频 */
  1283. handleRemove(file) {
  1284. this.fileList.splice(this.fileList.indexOf(file), 1);
  1285. this.form.videoUrl = '';
  1286. this.form.thumbnail = '';
  1287. this.form.duration = 0;
  1288. this.form.fileSize = 0;
  1289. this.form.fileName = '';
  1290. this.form.line1 = '';
  1291. this.form.line_2 = '';
  1292. this.form.line_3 = '';
  1293. this.uploadType = null
  1294. this.fileSize = null
  1295. this.fileKey = null
  1296. },
  1297. //获取第一帧封面
  1298. async getFirstThumbnail(file, form){
  1299. try {
  1300. //截取小文件
  1301. // 打印原始文件名和大小
  1302. // 截取小文件
  1303. const clippedBlob = await this.clipVideoFirstTwoSeconds(file);
  1304. const clippedFile = new File([clippedBlob], 'clipped_video.mp4', {
  1305. type: 'video/mp4',
  1306. lastModified: Date.now()
  1307. });
  1308. // 3. 调用接口获取封面
  1309. const response = await getThumbnail(clippedFile);
  1310. form.thumbnail = response.url;
  1311. } catch (error) {
  1312. console.error('获取封面失败:', error);
  1313. }
  1314. },
  1315. //截取大文件视频
  1316. async clipVideoFirstTwoSeconds(file) {
  1317. return new Promise((resolve, reject) => {
  1318. const video = document.createElement('video');
  1319. video.src = URL.createObjectURL(file);
  1320. video.muted = true;
  1321. video.playsInline = true;
  1322. video.onloadedmetadata = () => {
  1323. video.currentTime = 0; // 定位到第一帧
  1324. video.onseeked = () => {
  1325. const canvas = document.createElement('canvas');
  1326. canvas.width = video.videoWidth;
  1327. canvas.height = video.videoHeight;
  1328. const ctx = canvas.getContext('2d');
  1329. ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
  1330. canvas.toBlob(
  1331. (blob) => {
  1332. URL.revokeObjectURL(video.src);
  1333. resolve(blob); // 返回 JPEG Blob
  1334. },
  1335. 'image/jpeg',
  1336. 0.8 // 质量
  1337. );
  1338. };
  1339. };
  1340. video.onerror = () => {
  1341. URL.revokeObjectURL(video.src);
  1342. reject(new Error('视频加载失败'));
  1343. };
  1344. });
  1345. },
  1346. //上传腾讯云Pcdn
  1347. async uploadVideoToTxPcdn(file, form, onProgress) {
  1348. try {
  1349. // 更新线路1状态为上传中
  1350. this.updateUploadProgress('line1Status', 'uploading');
  1351. const data = await uploadObject(file, (progress) => {
  1352. const progressPercent = Math.floor(progress.percent * 100);
  1353. this.updateUploadProgress('line1', progressPercent);
  1354. const progressEvent = { percent: progressPercent, loaded: progress.loaded, total: progress.total, lengthComputable: true };
  1355. onProgress(progressEvent);
  1356. }, 1, (uploadInfo) => {
  1357. if (form.tempId) {
  1358. const tokens = this.uploadCancellationTokens.get(form.tempId) || {};
  1359. tokens.cos = uploadInfo.cancel;
  1360. this.uploadCancellationTokens.set(form.tempId, tokens);
  1361. }
  1362. });
  1363. let line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
  1364. form.fileKey = data.urlPath.substring(1);
  1365. form.videoUrl = line_1;
  1366. form.line1 = line_1;
  1367. // 更新线路1状态为成功
  1368. this.updateUploadProgress('line1Status', 'success');
  1369. this.updateUploadProgress('line1', 100);
  1370. this.$message.success("线路一上传成功");
  1371. return { success: true, url: line_1 };
  1372. } catch (error) {
  1373. // 更新线路1状态为失败
  1374. this.updateUploadProgress('line1Status', 'failed');
  1375. this.$message.error("线路一上传失败");
  1376. return { success: false, error: error.message };
  1377. }
  1378. },
  1379. //上传华为云Obs
  1380. // async uploadVideoToHwObs(file, form, onProgress) {
  1381. // try {
  1382. // // 更新线路2状态为上传中
  1383. // this.updateUploadProgress('line2Status', 'uploading');
  1384. //
  1385. // const data = await uploadToOBS(file, (progress) => {
  1386. // const progressPercent = Math.floor(progress);
  1387. // this.updateUploadProgress('line2', progressPercent);
  1388. // const progressEvent = { percent: progressPercent, loaded: progress, total: progress, lengthComputable: true };
  1389. // onProgress(progressEvent);
  1390. // }, 1, (uploadInfo) => {
  1391. // if (form.tempId) {
  1392. // const tokens = this.uploadCancellationTokens.get(form.tempId) || {};
  1393. // tokens.obs = uploadInfo.cancel;
  1394. // this.uploadCancellationTokens.set(form.tempId, tokens);
  1395. // }
  1396. // });
  1397. //
  1398. // form.line2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
  1399. //
  1400. // // 更新线路2状态为成功
  1401. // this.updateUploadProgress('line2Status', 'success');
  1402. // this.updateUploadProgress('line2', 100);
  1403. //
  1404. // this.$message.success("线路二上传成功");
  1405. // return { success: true, url: form.line2 };
  1406. // } catch (error) {
  1407. // // 更新线路2状态为失败
  1408. // this.updateUploadProgress('line2Status', 'failed');
  1409. // this.$message.error("线路二上传失败");
  1410. // return { success: false, error: error.message };
  1411. // }
  1412. // },
  1413. //上传火山云
  1414. async uploadVideoToHsy(file, form, onProgress) {
  1415. try {
  1416. this.updateUploadProgress('line2Status', 'uploading');
  1417. const data = await uploadToHSY(
  1418. file,
  1419. (progress) => {
  1420. // 火山云的进度是小数0-1
  1421. if (typeof progress.percent === 'number') {
  1422. const percent = Math.floor(progress.percent * 100);
  1423. // 更新线路2进度
  1424. this.updateUploadProgress('line2', percent);
  1425. // 对外统一 progress 事件(模拟 xhr)
  1426. onProgress?.({
  1427. percent,
  1428. loaded: percent,
  1429. total: 100,
  1430. lengthComputable: true
  1431. });
  1432. }
  1433. // 状态同步(成功 / 失败)
  1434. if (progress.status === 'success') {
  1435. this.updateUploadProgress('line2Status', 'success');
  1436. this.updateUploadProgress('line2', 100);
  1437. }
  1438. if (progress.status === 'failed') {
  1439. this.updateUploadProgress('line2Status', 'failed');
  1440. }
  1441. },
  1442. 1,
  1443. (uploadInfo) => {
  1444. if (form.tempId) {
  1445. const tokens = this.uploadCancellationTokens.get(form.tempId) || {};
  1446. tokens.hsy = uploadInfo.cancel;
  1447. this.uploadCancellationTokens.set(form.tempId, tokens);
  1448. }
  1449. }
  1450. );
  1451. form.line2 = `${process.env.VUE_APP_VIDEO_URL}/${data.SourceInfo.FileName}`;
  1452. this.form.hsyVid = data.Vid
  1453. this.form.hsyVodUrl = process.env.VUE_APP_VIDEO_URL+"/"+data.SourceInfo.FileName
  1454. this.$message.success('线路二上传成功');
  1455. return { success: true, url: form.line2 };
  1456. } catch (error) {
  1457. this.updateUploadProgress('line2Status', 'failed');
  1458. this.$message.error('线路二上传失败');
  1459. return { success: false, error: error?.message || 'upload failed' };
  1460. }
  1461. },
  1462. // 更新上传进度的辅助方法
  1463. updateUploadProgress(key, value) {
  1464. this.currentUploadProgress[key] = value;
  1465. // 叮当国医项目只上传线路1
  1466. if (this.isDdgy) {
  1467. this.currentUploadProgress.total = this.currentUploadProgress.line1Status === 'success'
  1468. ? 100
  1469. : Math.min(this.currentUploadProgress.line1, 99);
  1470. return;
  1471. }
  1472. // 计算总进度:只有两个线路都成功才算100%
  1473. if (this.currentUploadProgress.line1Status === 'success' && this.currentUploadProgress.line2Status === 'success') {
  1474. this.currentUploadProgress.total = 100;
  1475. } else if (this.currentUploadProgress.line1Status === 'failed' || this.currentUploadProgress.line2Status === 'failed') {
  1476. // 如果任一线路失败,总进度保持当前状态
  1477. this.currentUploadProgress.total = Math.min(
  1478. (this.currentUploadProgress.line1 + this.currentUploadProgress.line2) / 2,
  1479. 99 // 失败时最多99%
  1480. );
  1481. } else {
  1482. // 正常上传中,计算平均进度
  1483. this.currentUploadProgress.total = Math.min(
  1484. (this.currentUploadProgress.line1 + this.currentUploadProgress.line2) / 2,
  1485. 99 // 上传中最多99%,只有都成功才100%
  1486. );
  1487. }
  1488. },
  1489. // 上传视频
  1490. async videoUpload(options) {
  1491. this.isUploading = true;
  1492. this.form.uploadStatus = 'uploading';
  1493. this.form.tempId = Math.random().toString(36).substring(2, 15);
  1494. const file = options.file;
  1495. this.getMediaDuration(file);
  1496. this.currentUploadProgress = { total: 0, line1: 0, line2: 0, line1Status: 'pending', line2Status: 'pending' };
  1497. try {
  1498. await this.getFirstThumbnail(file, this.form);
  1499. let line1Success = false;
  1500. let line2Success = false;
  1501. if (this.isDdgy) {
  1502. // 叮当国医项目只上传线路1
  1503. const [line1Result] = await Promise.allSettled([
  1504. this.uploadVideoToTxPcdn(file, this.form, options.onProgress)
  1505. ]);
  1506. line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
  1507. } else {
  1508. const [line1Result, line2Result] = await Promise.allSettled([
  1509. this.uploadVideoToTxPcdn(file, this.form, options.onProgress),
  1510. //this.uploadVideoToHwObs(file, this.form, options.onProgress)
  1511. this.uploadVideoToHsy(file, this.form, options.onProgress)
  1512. ]);
  1513. line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
  1514. line2Success = line2Result.status === 'fulfilled' && line2Result.value.success;
  1515. }
  1516. if (line1Success && (this.isDdgy || line2Success)) {
  1517. this.form.uploadStatus = 'success';
  1518. this.form.uploadProgress = {
  1519. total: 100,
  1520. line1: 100,
  1521. line2: this.isDdgy ? 0 : 100,
  1522. line1Status: 'success',
  1523. line2Status: this.isDdgy ? 'pending' : 'success'
  1524. };
  1525. this.currentUploadProgress.total = 100;
  1526. this.$message.success(this.isDdgy ? "视频上传完成!" : "视频上传完成!两个线路都上传成功");
  1527. } else {
  1528. this.form.uploadStatus = 'failed';
  1529. this.form.uploadProgress = {
  1530. total: this.currentUploadProgress.total,
  1531. line1: this.currentUploadProgress.line1,
  1532. line2: this.currentUploadProgress.line2,
  1533. line1Status: this.currentUploadProgress.line1Status,
  1534. line2Status: this.currentUploadProgress.line2Status
  1535. };
  1536. const failedLines = [];
  1537. if (!line1Success) failedLines.push('线路1');
  1538. if (!this.isDdgy && !line2Success) failedLines.push('线路2');
  1539. this.$message.error(`视频上传失败!${failedLines.join('、')} 上传失败,请重试`);
  1540. }
  1541. this.form.fileName = file.name;
  1542. this.form.fileSize = file.size;
  1543. } catch (error) {
  1544. this.form.uploadStatus = 'failed';
  1545. this.$message.error("视频上传过程中发生错误,请重试");
  1546. } finally {
  1547. this.isUploading = false;
  1548. if (this.form.tempId) {
  1549. this.uploadCancellationTokens.delete(this.form.tempId);
  1550. }
  1551. }
  1552. },
  1553. // 获取媒体文件时长
  1554. getMediaDuration(file) {
  1555. // 处理视频
  1556. const video = document.createElement('video');
  1557. video.preload = 'metadata';
  1558. video.onloadedmetadata = () => {
  1559. this.form.duration = Math.round(video.duration);
  1560. };
  1561. video.src = URL.createObjectURL(file);
  1562. },
  1563. handleFileChange(file, files) {
  1564. // 保留最后一个文件
  1565. this.fileList = files.slice(-1);
  1566. },
  1567. /** 批量新增 */
  1568. handleBatchAdd() {
  1569. this.batchAddVisible = true;
  1570. this.add =false
  1571. this.videoList = []; // 清空之前的视频列表
  1572. },
  1573. /** 批量修改 */
  1574. handleBatchUpdate(){
  1575. if (this.ids.length === 0) {
  1576. this.$message.warning("请至少选择一条数据");
  1577. return;
  1578. }
  1579. this.resetForm("form");
  1580. this.batchUpdateForm.ids = this.ids; // 将选中的ID传递给批量修改表单
  1581. this.batchUpdateVisible = true;
  1582. },
  1583. cancelBeforeBatch(done, cancel) {
  1584. if (!this.videoList || this.videoList.length === 0) {
  1585. done()
  1586. return
  1587. }
  1588. this.$confirm('关闭窗口视频需要重新上传,确定关闭吗?', '提示', {
  1589. confirmButtonText: '确定',
  1590. cancelButtonText: '取消',
  1591. type: 'warning'
  1592. }).then(() => {
  1593. done()
  1594. }).catch(() => {
  1595. cancel()
  1596. });
  1597. },
  1598. /** 取消批量 */
  1599. cancelBatch() {
  1600. if (!this.videoList || this.videoList.length === 0) {
  1601. this.batchAddVisible = false
  1602. this.batchUpdateVisible = false
  1603. return
  1604. }
  1605. this.$confirm('关闭窗口视频需要重新上传,确定关闭吗?', '提示', {
  1606. confirmButtonText: '确定',
  1607. cancelButtonText: '取消',
  1608. type: 'warning'
  1609. }).then(() => {
  1610. this.batchAddVisible = false
  1611. this.batchUpdateVisible = false
  1612. this.changeCateType(this.queryParams.typeId)
  1613. }).catch(() => { });
  1614. },
  1615. /** 批量修改 */
  1616. submitBatchUpdate() {
  1617. this.$refs["form"].validate(valid => {
  1618. if (valid) {
  1619. if (this.batchUpdateForm.ids.length === 0) {
  1620. this.$message.warning("未选择任何数据");
  1621. return;
  1622. }
  1623. this.$confirm('是否确认修改视频素材库编号为"' + this.batchUpdateForm.ids.join(',') + '"的数据项?', "警告", {
  1624. confirmButtonText: "确定",
  1625. cancelButtonText: "取消",
  1626. type: "warning"
  1627. }).then(() => {
  1628. // 构造正确的参数格式
  1629. const params = new URLSearchParams();
  1630. params.append('typeId', this.batchUpdateForm.typeId || '');
  1631. params.append('typeSubId', this.batchUpdateForm.typeSubId || '');
  1632. params.append('ids', this.batchUpdateForm.ids.join(','));
  1633. params.append('videoType', String(this.pageVideoType));
  1634. return batchUpdateVideoResource(params);
  1635. }).then(() => {
  1636. this.getList();
  1637. this.batchUpdateVisible = false;
  1638. this.msgSuccess("修改成功");
  1639. }).catch(() => {});
  1640. }
  1641. });
  1642. },
  1643. /** 提交批量添加 */
  1644. submitBatchAdd() {
  1645. if (this.videoList.length === 0) {
  1646. this.$message.warning("请选择视频");
  1647. return;
  1648. }
  1649. // 检查是否所有选中的视频都已上传完成
  1650. const incompleteVideos = this.videoList.filter(item => (item.progress || 0) < 100);
  1651. if (incompleteVideos.length > 0) {
  1652. this.$message.warning('有未完成上传的视频,请先完成上传');
  1653. return;
  1654. }
  1655. if (this.add){
  1656. this.$message.warning("请勿重复提交")
  1657. return
  1658. }
  1659. this.add = true
  1660. // 调用批量添加API
  1661. const videoList = JSON.parse(JSON.stringify(this.videoList));
  1662. videoList.forEach(item => {
  1663. item.projectIds = item.projectIds.join(",");
  1664. item.videoType = this.pageVideoType;
  1665. });
  1666. batchAddVideoResource(videoList).then(response => {
  1667. if (response.code === 200) {
  1668. this.$message.success('批量添加成功');
  1669. this.batchAddVisible = false;
  1670. this.getList();
  1671. }
  1672. })
  1673. },
  1674. /** 获取分类名称 */
  1675. getTypeName(typeId) {
  1676. const type = this.typeList.find(item => item.cateId === typeId);
  1677. return type ? type.cateName : '';
  1678. },
  1679. /** 编辑视频信息 */
  1680. handleEditVideo(row) {
  1681. if (row.progress !== 100) {
  1682. this.$message.warning('请等待上传完成后再编辑');
  1683. return;
  1684. }
  1685. this.batchEditDialog.form = Object.assign({}, row)
  1686. this.changeCateType(row.typeId)
  1687. this.batchEditDialog.open = true
  1688. },
  1689. batchEditCancel() {
  1690. this.resetForm('batchEditDialogForm')
  1691. this.batchEditDialog.open = false
  1692. },
  1693. batchEditSubmitForm() {
  1694. let temp = this.videoList.find(item => item.tempId === this.batchEditDialog.form.tempId)
  1695. Object.assign(temp, this.batchEditDialog.form)
  1696. this.batchEditDialog.open = false
  1697. },
  1698. handleDeleteVideo(row) {
  1699. if (row.uploadStatus === 'uploading') {
  1700. this.$confirm('该视频正在上传中,确认要取消上传并删除吗?', '取消上传', {
  1701. confirmButtonText: '确定取消',
  1702. cancelButtonText: '继续上传',
  1703. type: 'warning'
  1704. }).then(() => {
  1705. // Cancel the upload and remove from list
  1706. this.cancelVideoUpload(row);
  1707. }).catch(() => {
  1708. // User chose to continue uploading
  1709. this.$message.info('继续上传该视频');
  1710. });
  1711. } else {
  1712. // Original confirmation for non-uploading videos
  1713. this.$confirm('确认要从列表中删除该视频吗?', '提示', {
  1714. confirmButtonText: '确定',
  1715. cancelButtonText: '取消',
  1716. type: 'warning'
  1717. }).then(() => {
  1718. this.removeVideoFromList(row);
  1719. }).catch(() => {
  1720. // 取消删除
  1721. });
  1722. }
  1723. },
  1724. cancelVideoUpload(row) {
  1725. const cancellationTokens = this.uploadCancellationTokens.get(row.tempId);
  1726. if (cancellationTokens) {
  1727. // Cancel COS upload if exists
  1728. if (cancellationTokens.cos) {
  1729. try {
  1730. cancellationTokens.cos();
  1731. } catch (error) {
  1732. console.error('Error cancelling COS upload:', error);
  1733. }
  1734. }
  1735. // Cancel OBS upload if exists
  1736. if (cancellationTokens.obs) {
  1737. try {
  1738. cancellationTokens.obs();
  1739. } catch (error) {
  1740. console.error('Error cancelling OBS upload:', error);
  1741. }
  1742. }
  1743. // Remove cancellation tokens
  1744. this.uploadCancellationTokens.delete(row.tempId);
  1745. }
  1746. const videoIndex = this.videoList.findIndex(item => item.tempId === row.tempId);
  1747. if (videoIndex !== -1) {
  1748. this.videoList[videoIndex].uploadStatus = 'cancelled';
  1749. this.videoList.splice(videoIndex, 1);
  1750. }
  1751. const queueIndex = this.uploadQueue.findIndex(item => item.tempId === row.tempId);
  1752. if (queueIndex !== -1) {
  1753. this.uploadQueue.splice(queueIndex, 1);
  1754. this.updateQueuePositions();
  1755. }
  1756. this.$message.success('已取消视频上传并从列表中移除');
  1757. },
  1758. removeVideoFromList(row) {
  1759. const videoIndex = this.videoList.findIndex(item => item.tempId === row.tempId);
  1760. if (videoIndex !== -1) {
  1761. this.videoList.splice(videoIndex, 1);
  1762. }
  1763. // Remove from upload queue if it's still queued
  1764. const queueIndex = this.uploadQueue.findIndex(item => item.tempId === row.tempId);
  1765. if (queueIndex !== -1) {
  1766. this.uploadQueue.splice(queueIndex, 1);
  1767. this.updateQueuePositions();
  1768. this.$message.success('已从上传队列中移除该视频');
  1769. } else {
  1770. this.$message.success('已从列表中移除该视频');
  1771. }
  1772. },
  1773. /** 删除视频 */
  1774. // handleDeleteVideo(row) {
  1775. // this.$confirm('确认要从列表中删除该视频吗?', '提示', {
  1776. // confirmButtonText: '确定',
  1777. // cancelButtonText: '取消',
  1778. // type: 'warning'
  1779. // }).then(() => {
  1780. // const videoIndex = this.videoList.findIndex(item => item.tempId === row.tempId);
  1781. // if (videoIndex !== -1) {
  1782. // this.videoList.splice(videoIndex, 1);
  1783. // }
  1784. // // Remove from upload queue if it's still queued
  1785. // const queueIndex = this.uploadQueue.findIndex(item => item.tempId === row.tempId);
  1786. // if (queueIndex !== -1) {
  1787. // this.uploadQueue.splice(queueIndex, 1);
  1788. // this.updateQueuePositions();
  1789. // this.$message.success('已从上传队列中移除该视频');
  1790. // } else {
  1791. // this.$message.success('已从列表中移除该视频');
  1792. // }
  1793. // }).catch(() => {
  1794. // // 取消删除
  1795. // });
  1796. // },
  1797. /** 显示上传面板 */
  1798. showUploadPanel() {
  1799. this.showUpload = true;
  1800. if (this.currentProject === 'myhk') {
  1801. this.batchUploadForm = {
  1802. ...this.batchUploadForm,
  1803. files: [],
  1804. videoType: this.pageVideoType
  1805. };
  1806. } else {
  1807. this.batchUploadForm = {
  1808. typeId: null,
  1809. typeSubId: null,
  1810. projectIds: [],
  1811. files: [],
  1812. displayType: 'landscape',
  1813. videoType: this.pageVideoType
  1814. };
  1815. this.subTypeList = []
  1816. }
  1817. this.batchFileList = [];
  1818. if (this.$refs.batchVideoUpload) {
  1819. this.$refs.batchVideoUpload.clearFiles();
  1820. }
  1821. },
  1822. /** 批量文件变更 */
  1823. handleBatchFileChange(file, fileList) {
  1824. this.batchFileList = fileList;
  1825. },
  1826. /** 批量上传视频 */
  1827. async batchVideoUpload(options) {
  1828. const file = options.file;
  1829. const tempVideo = {
  1830. tempId: Math.random().toString(36).substring(2, 15),
  1831. resourceName: file.name.substring(0, file.name.lastIndexOf('.')),
  1832. fileName: file.name,
  1833. thumbnail: null,
  1834. line1: null,
  1835. line2: null,
  1836. line3: null,
  1837. duration: 0,
  1838. fileSize: file.size,
  1839. fileKey: null,
  1840. videoUrl: null,
  1841. typeId: this.batchUploadForm.typeId,
  1842. typeSubId: this.batchUploadForm.typeSubId,
  1843. projectIds: this.batchUploadForm.projectIds,
  1844. displayType: this.batchUploadForm.displayType || 'landscape',
  1845. videoType: this.pageVideoType,
  1846. progress: 0,
  1847. uploadStatus: 'queued', // Set initial status to queued
  1848. uploadDetails: {
  1849. line1: 0,
  1850. line2: 0,
  1851. line1Status: 'pending',
  1852. line2Status: 'pending'
  1853. },
  1854. file: file,
  1855. queuePosition: this.uploadQueue.length + 1 // Track queue position
  1856. };
  1857. this.uploadQueue.push(tempVideo);
  1858. this.videoList.unshift(tempVideo);
  1859. // 获取视频时长
  1860. const video = document.createElement('video');
  1861. video.preload = 'metadata';
  1862. video.onloadedmetadata = () => {
  1863. const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
  1864. if (index !== -1) {
  1865. tempVideo.duration = Math.round(video.duration);
  1866. }
  1867. };
  1868. video.src = URL.createObjectURL(file);
  1869. // 关闭上传弹窗
  1870. this.showUpload = false;
  1871. if (!this.isProcessingBatch) {
  1872. this.processUploadQueue();
  1873. }
  1874. if (this.$refs.batchVideoUpload) {
  1875. this.$refs.batchVideoUpload.clearFiles();
  1876. }
  1877. },
  1878. async processUploadQueue() {
  1879. if (this.isProcessingBatch || this.uploadQueue.length === 0) {
  1880. return;
  1881. }
  1882. this.isUploading = true;
  1883. this.isProcessingBatch = true;
  1884. while (this.uploadQueue.length > 0) {
  1885. // Get next batch (up to 5 videos)
  1886. const currentBatch = this.uploadQueue.splice(0, this.currentBatchSize);
  1887. // Update status for current batch
  1888. currentBatch.forEach(video => {
  1889. const index = this.videoList.findIndex(item => item.tempId === video.tempId);
  1890. if (index !== -1) {
  1891. this.videoList[index].uploadStatus = 'uploading';
  1892. }
  1893. });
  1894. // Process current batch in parallel
  1895. const batchPromises = currentBatch.map(video => this.uploadSingleVideo(video));
  1896. try {
  1897. await Promise.allSettled(batchPromises);
  1898. this.$message.success(`批次上传完成,已处理 ${currentBatch.length} 个视频`);
  1899. } catch (error) {
  1900. this.$message.error(`批次上传过程中发生错误: ${error.message}`);
  1901. }
  1902. // Update queue positions for remaining videos
  1903. this.updateQueuePositions();
  1904. // Small delay between batches
  1905. if (this.uploadQueue.length > 0) {
  1906. await new Promise(resolve => setTimeout(resolve, 1000));
  1907. }
  1908. }
  1909. this.isProcessingBatch = false;
  1910. this.isUploading = false;
  1911. this.$message.success('所有视频上传队列处理完成!');
  1912. },
  1913. async uploadSingleVideo(tempVideo) {
  1914. try {
  1915. // 获取封面
  1916. await this.getFirstThumbnail(tempVideo.file, tempVideo);
  1917. let line1Success = false;
  1918. let line2Success = false;
  1919. if (this.isDdgy) {
  1920. // 叮当国医项目只上传线路1
  1921. const [line1Result] = await Promise.allSettled([
  1922. this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo)
  1923. ]);
  1924. line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
  1925. } else {
  1926. // 并行上传到两个服务器
  1927. const [line1Result, line2Result] = await Promise.allSettled([
  1928. this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo),
  1929. // this.uploadVideoToHwObsBatch(tempVideo.file, tempVideo)
  1930. this.uploadVideoToHSYBatch(tempVideo.file, tempVideo),
  1931. ]);
  1932. line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
  1933. line2Success = line2Result.status === 'fulfilled' && line2Result.value.success;
  1934. }
  1935. const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
  1936. if (index !== -1) {
  1937. if (line1Success && (this.isDdgy || line2Success)) {
  1938. this.videoList[index].progress = 100;
  1939. this.videoList[index].uploadStatus = 'success';
  1940. this.videoList[index].uploadDetails.line1Status = 'success';
  1941. this.videoList[index].uploadDetails.line2Status = this.isDdgy ? 'pending' : 'success';
  1942. this.videoList[index].uploadDetails.line1 = 100;
  1943. this.videoList[index].uploadDetails.line2 = this.isDdgy ? 0 : 100;
  1944. } else {
  1945. this.videoList[index].uploadStatus = 'failed';
  1946. this.videoList[index].uploadDetails.line1Status = line1Success ? 'success' : 'failed';
  1947. this.videoList[index].uploadDetails.line2Status = this.isDdgy ? 'pending' : (line2Success ? 'success' : 'failed');
  1948. this.updateBatchProgress(index);
  1949. }
  1950. }
  1951. return { success: line1Success && (this.isDdgy || line2Success), tempVideo };
  1952. } catch (error) {
  1953. const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
  1954. if (index !== -1) {
  1955. this.videoList[index].uploadStatus = 'failed';
  1956. }
  1957. throw error;
  1958. }
  1959. },
  1960. /** 复制视频链接到剪贴板 */
  1961. copy(url) {
  1962. // 创建一个临时的input元素
  1963. const input = document.createElement('input');
  1964. // 设置input的值为要复制的视频链接
  1965. input.value = url;
  1966. // 将input添加到DOM中
  1967. document.body.appendChild(input);
  1968. // 选中input的值
  1969. input.select();
  1970. // 执行复制命令
  1971. document.execCommand('copy');
  1972. // 从DOM中移除input元素
  1973. document.body.removeChild(input);
  1974. // 提示用户复制成功
  1975. this.$message({
  1976. message: '已复制到剪贴板',
  1977. type: 'success',
  1978. duration: 1500
  1979. });
  1980. },
  1981. getProjectList() {
  1982. this.projectLoading = true
  1983. listCourseQuestionBank(this.projectQueryParams).then(response => {
  1984. this.projectList = response.rows;
  1985. this.projectListTotal = response.total;
  1986. // 如果存在已选择的项目,预选中表格中对应的行
  1987. this.$nextTick(() => {
  1988. // 获取表格组件实例
  1989. const projectTable = this.$refs.projectTable;
  1990. if (projectTable) {
  1991. if (this.selectedProjectIds.length > 0) {
  1992. // 遍历项目列表,找到匹配的ID并选中对应行
  1993. const selectedIds = this.selectedProjectIds;
  1994. this.projectList.forEach(row => {
  1995. if (selectedIds.includes(row.id)) {
  1996. projectTable.toggleRowSelection(row, true);
  1997. }
  1998. });
  1999. }
  2000. }
  2001. });
  2002. this.projectLoading = false
  2003. });
  2004. },
  2005. /** 打开项目选择弹窗 */
  2006. openProjectDialog(projectIds, type) {
  2007. this.$nextTick(() => {
  2008. if (this.$refs.customSelect) {
  2009. this.$refs.customSelect.blur();
  2010. }
  2011. });
  2012. // 重置查询参数
  2013. this.projectQueryParams = {
  2014. pageNum: 1,
  2015. pageSize: 10,
  2016. questionType: null,
  2017. title: null
  2018. };
  2019. this.selectedType = type
  2020. // 设置选中的项目IDs
  2021. if (projectIds) {
  2022. if (typeof projectIds === 'string') {
  2023. this.selectedProjectIds = projectIds.split(',').map(id => parseInt(id));
  2024. } else if (Array.isArray(projectIds)) {
  2025. this.selectedProjectIds = [...projectIds];
  2026. } else if (typeof projectIds === 'number') {
  2027. this.selectedProjectIds = [projectIds];
  2028. }
  2029. } else {
  2030. this.selectedProjectIds = [];
  2031. }
  2032. // 显示弹窗
  2033. this.projectDialogVisible = true;
  2034. // 加载分类树数据
  2035. this.initCategoryTree();
  2036. // 加载项目列表
  2037. this.getProjectList();
  2038. },
  2039. /** 确认选择项目 */
  2040. confirmSelectProject() {
  2041. // 更新表单中的项目ID
  2042. if (this.selectedType === 0) {
  2043. this.form.projectIds = this.selectedProjectIds;
  2044. }
  2045. else if (this.selectedType === 1) {
  2046. this.batchUploadForm.projectIds = this.selectedProjectIds;
  2047. }
  2048. else if (this.selectedType === 2) {
  2049. this.batchEditDialog.form.projectIds = this.selectedProjectIds;
  2050. }
  2051. else if (this.selectedType === 3) {
  2052. const params = {
  2053. id: this.currentRow.id,
  2054. projectIds: this.selectedProjectIds.join(","),
  2055. videoType: this.pageVideoType
  2056. }
  2057. updateVideoResource(params).then(response => {
  2058. if (response.code === 200) {
  2059. this.msgSuccess("修改成功");
  2060. this.open = false;
  2061. this.getList();
  2062. }
  2063. });
  2064. }
  2065. else if (this.selectedType === 4) {
  2066. this.currentRow.projectIds = this.selectedProjectIds
  2067. }
  2068. this.projectDialogVisible = false;
  2069. },
  2070. /** 取消选择项目 */
  2071. cancelSelectProject() {
  2072. const projectTable = this.$refs.projectTable;
  2073. if (projectTable) {
  2074. // 清空表格数据
  2075. projectTable.clearSelection();
  2076. }
  2077. this.projectDialogVisible = false;
  2078. },
  2079. handleProjectSelect(selection) {
  2080. this.selectedProjectIds = selection.map(item => item.id);
  2081. selection.forEach(item => {
  2082. // 检查是否已存在该项目,不存在则添加
  2083. if (!this.projectShowList.some(p => p.id === item.id)) {
  2084. this.projectShowList.push(item);
  2085. }
  2086. });
  2087. },
  2088. /** 项目列表页码变更 */
  2089. handleProjectPageChange(page) {
  2090. this.projectQueryParams.pageNum = page;
  2091. this.getProjectList();
  2092. },
  2093. /** 项目列表每页条数变更 */
  2094. handleProjectPageSizeChange(size) {
  2095. this.projectQueryParams.pageNum = 1;
  2096. this.projectQueryParams.pageSize = size;
  2097. this.getProjectList();
  2098. },
  2099. /** 处理查看项目 */
  2100. handleViewProject(row, type) {
  2101. // 保存当前选择的行,以便后续操作
  2102. this.currentRow = row;
  2103. // 设置form对象的projectIds为当前行的项目IDs
  2104. this.projectShowList = [];
  2105. if (!row.projectIds || row.projectIds.length === 0) {
  2106. this.openProjectDialog(null, type)
  2107. return;
  2108. }
  2109. let projectIds = row.projectIds
  2110. if (Array.isArray(row.projectIds)) {
  2111. projectIds = projectIds.join(',');
  2112. }
  2113. getByIds({ids: projectIds}).then(response => {
  2114. this.projectShowList = response.data;
  2115. })
  2116. // 打开弹窗展示列表
  2117. this.projectListDialogVisible = true;
  2118. },
  2119. /** 初始化分类树 */
  2120. initCategoryTree() {
  2121. // 获取分类列表
  2122. listUserCourseCategory().then(response => {
  2123. const treeDate = this.handleTree(response.data, "cateId", "pid");
  2124. this.categoryTreeData = [{
  2125. cateId: 0,
  2126. cateName: '全部',
  2127. children: treeDate
  2128. }];
  2129. });
  2130. },
  2131. filterNode(value, data) {
  2132. if (!value) return true;
  2133. return data.cateName.indexOf(value) !== -1;
  2134. },
  2135. /** 处理分类点击 */
  2136. handleCategoryClick(data, node) {
  2137. // 更新查询参数
  2138. this.projectQueryParams.pageNum = 1;
  2139. // 如果是全部分类,则清空分类过滤
  2140. if (node.level === 1) {
  2141. this.projectQueryParams.questionType = null;
  2142. this.projectQueryParams.questionSubType = null;
  2143. }
  2144. else if (node.level === 2) {
  2145. this.projectQueryParams.questionType = data.cateId;
  2146. this.projectQueryParams.questionSubType = null;
  2147. }
  2148. else if (node.level === 3) {
  2149. this.projectQueryParams.questionType = null;
  2150. this.projectQueryParams.questionSubType = data.cateId;
  2151. }
  2152. // 重新加载项目列表
  2153. this.getProjectList();
  2154. },
  2155. /** 搜索项目 */
  2156. searchProjects() {
  2157. this.projectQueryParams.pageNum = 1;
  2158. this.getProjectList();
  2159. },
  2160. /** 视频预览弹窗关闭前的处理函数 */
  2161. handleCloseVideoPreview(done) {
  2162. // 停止视频播放
  2163. const video = document.getElementById('video');
  2164. if (video) {
  2165. video.pause();
  2166. video.currentTime = 0;
  2167. }
  2168. // 关闭弹窗
  2169. this.videoPreviewVisible = false;
  2170. done();
  2171. },
  2172. updateQueuePositions() {
  2173. this.uploadQueue.forEach((video, index) => {
  2174. video.queuePosition = index + 1;
  2175. const videoIndex = this.videoList.findIndex(item => item.tempId === video.tempId);
  2176. if (videoIndex !== -1) {
  2177. this.videoList[videoIndex].queuePosition = index + 1;
  2178. }
  2179. });
  2180. },
  2181. getQueueStatusColor(status) {
  2182. switch (status) {
  2183. case 'success':
  2184. return '#67C23A';
  2185. case 'failed':
  2186. return '#F56C6C';
  2187. case 'uploading':
  2188. return '#409EFF';
  2189. case 'queued':
  2190. return '#E6A23C';
  2191. default:
  2192. return '#909399';
  2193. }
  2194. },
  2195. // 批量上传 - 腾讯云
  2196. async uploadVideoToTxPcdnBatch(file, tempVideo) {
  2197. try {
  2198. const data = await uploadObject(file, (progress) => {
  2199. const progressPercent = Math.floor(progress.percent * 100);
  2200. const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
  2201. if (index !== -1) {
  2202. this.videoList[index].uploadDetails.line1 = progressPercent;
  2203. this.videoList[index].uploadDetails.line1Status = 'uploading';
  2204. this.updateBatchProgress(index);
  2205. }
  2206. }, 1, (uploadInfo) => {
  2207. const tokens = this.uploadCancellationTokens.get(tempVideo.tempId) || {};
  2208. tokens.cos = uploadInfo.cancel;
  2209. this.uploadCancellationTokens.set(tempVideo.tempId, tokens);
  2210. });
  2211. let line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
  2212. tempVideo.fileKey = data.urlPath.substring(1);
  2213. tempVideo.videoUrl = line_1;
  2214. tempVideo.line1 = line_1;
  2215. return { success: true, url: line_1 };
  2216. } catch (error) {
  2217. return { success: false, error: error.message };
  2218. }
  2219. },
  2220. // 批量上传 - 华为云
  2221. // async uploadVideoToHwObsBatch(file, tempVideo) {
  2222. // try {
  2223. // const data = await uploadToOBS(file, (progress) => {
  2224. // const progressPercent = Math.floor(progress);
  2225. // const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
  2226. // if (index !== -1) {
  2227. // this.videoList[index].uploadDetails.line2 = progressPercent;
  2228. // this.videoList[index].uploadDetails.line2Status = 'uploading';
  2229. // this.updateBatchProgress(index);
  2230. // }
  2231. // }, 1, (uploadInfo) => {
  2232. // const tokens = this.uploadCancellationTokens.get(tempVideo.tempId) || {};
  2233. // tokens.obs = uploadInfo.cancel;
  2234. // this.uploadCancellationTokens.set(tempVideo.tempId, tokens);
  2235. // });
  2236. //
  2237. // tempVideo.line2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
  2238. // return { success: true, url: tempVideo.line2 };
  2239. // } catch (error) {
  2240. // return { success: false, error: error.message };
  2241. // }
  2242. // },
  2243. async uploadVideoToHSYBatch(file, tempVideo) {
  2244. try {
  2245. const data = await uploadToHSY(file, (progress) => {
  2246. const progressPercent = Math.floor(progress);
  2247. const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
  2248. if (index !== -1) {
  2249. this.videoList[index].uploadDetails.line2 = progressPercent;
  2250. this.videoList[index].uploadDetails.line2Status = 'uploading';
  2251. this.updateBatchProgress(index);
  2252. }
  2253. }, 1, (uploadInfo) => {
  2254. const tokens = this.uploadCancellationTokens.get(tempVideo.tempId) || {};
  2255. tokens.obs = uploadInfo.cancel;
  2256. this.uploadCancellationTokens.set(tempVideo.tempId, tokens);
  2257. });
  2258. tempVideo.line2 = `${process.env.VUE_APP_VIDEO_URL}/${data.SourceInfo.FileName}`;
  2259. tempVideo.hsyVid = data.Vid;
  2260. return { success: true, url: tempVideo.line2};
  2261. } catch (error) {
  2262. return { success: false, error: error.message };
  2263. }
  2264. },
  2265. // 更新批量上传的总进度
  2266. updateBatchProgress(index) {
  2267. if (index >= 0 && index < this.videoList.length) {
  2268. const item = this.videoList[index];
  2269. const line1Progress = item.uploadDetails.line1 || 0;
  2270. const line2Progress = item.uploadDetails.line2 || 0;
  2271. // 叮当国医项目只上传线路1
  2272. if (this.isDdgy) {
  2273. item.progress = item.uploadDetails.line1Status === 'success'
  2274. ? 100
  2275. : Math.min(line1Progress, 99);
  2276. return;
  2277. }
  2278. // 只有两个线路都成功才算100%
  2279. if (item.uploadDetails.line1Status === 'success' && item.uploadDetails.line2Status === 'success') {
  2280. item.progress = 100;
  2281. } else if (item.uploadDetails.line1Status === 'failed' || item.uploadDetails.line2Status === 'failed') {
  2282. // 如果任一线路失败,总进度保持当前状态,不超过99%
  2283. item.progress = Math.min((line1Progress + line2Progress) / 2, 99);
  2284. } else {
  2285. // 正常上传中,计算平均进度,不超过99%
  2286. item.progress = Math.min((line1Progress + line2Progress) / 2, 99);
  2287. }
  2288. }
  2289. },
  2290. // 重试批量上传
  2291. async retryBatchUpload(row) {
  2292. // const index = this.videoList.findIndex(item => item.tempId === row.tempId);
  2293. // if (index === -1) return;
  2294. // const {line1, line2,line1Status,line2Status} = this.videoList[index].uploadDetails
  2295. // // 重置状态
  2296. // this.videoList[index].uploadStatus = 'uploading';
  2297. // // this.videoList[index].progress = 0;
  2298. // this.videoList[index].uploadDetails = {
  2299. // line1: line1 == 100?line1:0,
  2300. // line2: line2 == 100?line2:0,
  2301. // line1Status: line1Status =='success'?line1Status:'pending',
  2302. // line2Status: line2Status =='success'?line2Status:'pending'
  2303. // };
  2304. // const tempVideo = this.videoList[index];
  2305. // try {
  2306. // // 重新上传
  2307. // // const [line1Result, line2Result] = await Promise.allSettled([
  2308. // // this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo),
  2309. // // // this.uploadVideoToHwObsBatch(tempVideo.file, tempVideo)
  2310. // // ]);
  2311. // if (line1 !== 100) {
  2312. // const line1Result = await this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo)
  2313. // }
  2314. // if (line2 !== 100) {
  2315. // const line2Result = await this.uploadVideoToHwObsBatch(tempVideo.file, tempVideo)
  2316. // }
  2317. // const line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
  2318. // const line2Success = line2Result.status === 'fulfilled' && line2Result.value.success;
  2319. // if ( line1 == 100 || line1Success) {
  2320. // this.videoList[index].uploadDetails.line1Status = 'success';
  2321. // this.videoList[index].uploadDetails.line1 = 100;
  2322. // this.$message.success(`文件 ${tempVideo.fileName} 重试上传成功`);
  2323. // } else {
  2324. // this.videoList[index].uploadDetails.line1Status = line1Success ? 'success' : 'failed';
  2325. // this.$message.error(`文件 ${tempVideo.fileName} 重试上传失败`);
  2326. // }
  2327. // if (line2 == 100 || line2Success) {
  2328. // this.videoList[index].uploadDetails.line2Status = 'success';
  2329. // this.videoList[index].uploadDetails.line2 = 100;
  2330. // this.$message.success(`文件 ${tempVideo.fileName} 重试上传成功`);
  2331. // } else {
  2332. // this.videoList[index].uploadDetails.line2Status = line2Success ? 'success' : 'failed';
  2333. // this.$message.error(`文件 ${tempVideo.fileName} 重试上传失败`);
  2334. // }
  2335. // // if (line1Success && line2Success) {
  2336. // // this.videoList[index].progress = 100;
  2337. // // this.videoList[index].uploadStatus = 'success';
  2338. // // this.videoList[index].uploadDetails.line1Status = 'success';
  2339. // // this.videoList[index].uploadDetails.line2Status = 'success';
  2340. // // this.videoList[index].uploadDetails.line1 = 100;
  2341. // // this.videoList[index].uploadDetails.line2 = 100;
  2342. // // this.$message.success(`文件 ${tempVideo.fileName} 重试上传成功`);
  2343. // // } else {
  2344. // // this.videoList[index].uploadStatus = 'failed';
  2345. // // this.videoList[index].uploadDetails.line1Status = line1Success ? 'success' : 'failed';
  2346. // // this.videoList[index].uploadDetails.line2Status = line2Success ? 'success' : 'failed';
  2347. // // this.$message.error(`文件 ${tempVideo.fileName} 重试上传失败`);
  2348. // // }
  2349. // } catch (error) {
  2350. // this.videoList[index].uploadStatus = 'failed';
  2351. // this.$message.error(`文件 ${tempVideo.fileName} 重试上传失败`);
  2352. // }
  2353. const index = this.videoList.findIndex(item => item.tempId === row.tempId);
  2354. if (index === -1) return;
  2355. const tempVideo = this.videoList[index];
  2356. const uploadDetails = tempVideo.uploadDetails || {};
  2357. // 检查哪些线路需要重试
  2358. const needRetryLine1 = uploadDetails.line1Status === 'failed' || uploadDetails.line1Status === 'pending';
  2359. const needRetryLine2 = this.isDdgy ? false : (uploadDetails.line2Status === 'failed' || uploadDetails.line2Status === 'pending');
  2360. if (!needRetryLine1 && !needRetryLine2) {
  2361. this.$message.info('所有线路都已上传成功,无需重试');
  2362. return;
  2363. }
  2364. // 更新整体状态为上传中
  2365. this.videoList[index].uploadStatus = 'uploading';
  2366. // 只重置需要重试的线路状态
  2367. if (needRetryLine1) {
  2368. this.videoList[index].uploadDetails.line1 = 0;
  2369. this.videoList[index].uploadDetails.line1Status = 'pending';
  2370. }
  2371. if (needRetryLine2) {
  2372. this.videoList[index].uploadDetails.line2 = 0;
  2373. this.videoList[index].uploadDetails.line2Status = 'pending';
  2374. }
  2375. try {
  2376. const uploadPromises = [];
  2377. // 根据需要重试的线路创建上传任务
  2378. if (needRetryLine1) {
  2379. uploadPromises.push(
  2380. this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo)
  2381. .then(result => ({ line: 'line1', result }))
  2382. .catch(error => ({ line: 'line1', result: { success: false, error: error.message } }))
  2383. );
  2384. } else {
  2385. // 如果线路1不需要重试,创建一个已成功的Promise
  2386. uploadPromises.push(Promise.resolve({ line: 'line1', result: { success: true } }));
  2387. }
  2388. if (needRetryLine2) {
  2389. uploadPromises.push(
  2390. this.uploadVideoToHwObsBatch(tempVideo.file, tempVideo)
  2391. .then(result => ({ line: 'line2', result }))
  2392. .catch(error => ({ line: 'line2', result: { success: false, error: error.message } }))
  2393. );
  2394. } else {
  2395. // 如果线路2不需要重试,创建一个已成功的Promise
  2396. uploadPromises.push(Promise.resolve({ line: 'line2', result: { success: true } }));
  2397. }
  2398. // 等待所有上传任务完成
  2399. const results = await Promise.all(uploadPromises);
  2400. // 处理结果
  2401. let line1Success = true;
  2402. let line2Success = true;
  2403. let retryMessages = [];
  2404. results.forEach(({ line, result }) => {
  2405. if (line === 'line1') {
  2406. line1Success = result.success;
  2407. if (needRetryLine1) {
  2408. if (result.success) {
  2409. this.videoList[index].uploadDetails.line1Status = 'success';
  2410. this.videoList[index].uploadDetails.line1 = 100;
  2411. retryMessages.push('线路1重试成功');
  2412. } else {
  2413. this.videoList[index].uploadDetails.line1Status = 'failed';
  2414. retryMessages.push('线路1重试失败');
  2415. }
  2416. }
  2417. } else if (line === 'line2') {
  2418. line2Success = result.success;
  2419. if (needRetryLine2) {
  2420. if (result.success) {
  2421. this.videoList[index].uploadDetails.line2Status = 'success';
  2422. this.videoList[index].uploadDetails.line2 = 100;
  2423. retryMessages.push('线路2重试成功');
  2424. } else {
  2425. this.videoList[index].uploadDetails.line2Status = 'failed';
  2426. retryMessages.push('线路2重试失败');
  2427. }
  2428. }
  2429. }
  2430. });
  2431. // 更新总体状态和进度
  2432. if (line1Success && line2Success) {
  2433. this.videoList[index].progress = 100;
  2434. this.videoList[index].uploadStatus = 'success';
  2435. this.$message.success(`文件 ${tempVideo.fileName} 重试完成:${retryMessages.join(',')}`);
  2436. } else {
  2437. this.videoList[index].uploadStatus = 'failed';
  2438. // 重新计算进度
  2439. this.updateBatchProgress(index);
  2440. this.$message.error(`文件 ${tempVideo.fileName} 重试完成:${retryMessages.join(',')}`);
  2441. }
  2442. } catch (error) {
  2443. this.videoList[index].uploadStatus = 'failed';
  2444. this.$message.error(`文件 ${tempVideo.fileName} 重试过程中发生错误:${error.message || '未知错误'}`);
  2445. }
  2446. },
  2447. // 重试单个上传
  2448. async retryUpload(row) {
  2449. this.$confirm('确认要重新上传该视频吗?', '提示', {
  2450. confirmButtonText: '确定',
  2451. cancelButtonText: '取消',
  2452. type: 'warning'
  2453. }).then(async () => {
  2454. // 这里需要重新触发上传,但由于原始文件可能已经不存在
  2455. // 建议用户重新选择文件上传
  2456. this.$message.info('请重新选择文件进行上传');
  2457. this.handleUpdate(row);
  2458. }).catch(() => {});
  2459. },
  2460. // 获取上传状态图标
  2461. getUploadStatusIcon(status) {
  2462. switch (status) {
  2463. case 'success': return 'el-icon-success';
  2464. case 'failed': return 'el-icon-error';
  2465. case 'uploading': return 'el-icon-loading';
  2466. default: return 'el-icon-time';
  2467. }
  2468. },
  2469. // 获取上传状态颜色
  2470. getUploadStatusColor(status) {
  2471. switch (status) {
  2472. case 'success': return '#67C23A';
  2473. case 'failed': return '#F56C6C';
  2474. case 'uploading': return '#409EFF';
  2475. default: return '#909399';
  2476. }
  2477. },
  2478. // 获取上传状态文本
  2479. getUploadStatusText(status, queuePosition) {
  2480. switch (status) {
  2481. case 'success':
  2482. return '上传成功';
  2483. case 'failed':
  2484. return '上传失败';
  2485. case 'uploading':
  2486. return '上传中';
  2487. case 'queued':
  2488. return `队列中 (第${queuePosition}位)`;
  2489. default:
  2490. return '待上传';
  2491. }
  2492. },
  2493. // 获取线路状态图标
  2494. getLineStatusIcon(status) {
  2495. switch (status) {
  2496. case 'success': return 'el-icon-check';
  2497. case 'failed': return 'el-icon-close';
  2498. case 'uploading': return 'el-icon-loading';
  2499. default: return 'el-icon-minus';
  2500. }
  2501. },
  2502. // 获取线路状态颜色
  2503. getLineStatusColor(status) {
  2504. switch (status) {
  2505. case 'success': return '#67C23A';
  2506. case 'failed': return '#F56C6C';
  2507. case 'uploading': return '#409EFF';
  2508. default: return '#C0C4CC';
  2509. }
  2510. },
  2511. // 获取进度条状态
  2512. getProgressStatus(row) {
  2513. if (row.progress === 100 && row.uploadStatus === 'success') {
  2514. return 'success';
  2515. } else if (row.uploadStatus === 'failed') {
  2516. return 'exception';
  2517. }
  2518. return '';
  2519. },
  2520. }
  2521. }
  2522. </script>
  2523. <style scoped>
  2524. /* 自定义表格样式 */
  2525. .el-table .video-cell {
  2526. padding: 5px;
  2527. }
  2528. /* 设置删除和修改按钮的间距 */
  2529. .el-button + .el-button {
  2530. margin-left: 5px;
  2531. }
  2532. /* 上传状态样式 */
  2533. .upload-status-container {
  2534. display: flex;
  2535. flex-direction: column;
  2536. align-items: center;
  2537. gap: 4px;
  2538. }
  2539. .status-indicator {
  2540. display: flex;
  2541. align-items: center;
  2542. gap: 4px;
  2543. }
  2544. .status-text {
  2545. font-size: 12px;
  2546. }
  2547. .upload-details {
  2548. display: flex;
  2549. flex-direction: column;
  2550. gap: 2px;
  2551. font-size: 11px;
  2552. }
  2553. .line-status {
  2554. display: flex;
  2555. align-items: center;
  2556. gap: 4px;
  2557. }
  2558. .line-label {
  2559. min-width: 35px;
  2560. color: #606266;
  2561. }
  2562. .line-progress {
  2563. color: #909399;
  2564. }
  2565. /* 双线上传进度样式 */
  2566. .dual-upload-progress {
  2567. display: flex;
  2568. flex-direction: column;
  2569. align-items: center;
  2570. gap: 4px;
  2571. }
  2572. .total-progress {
  2573. margin-bottom: 4px;
  2574. }
  2575. .line-progress-container {
  2576. display: flex;
  2577. flex-direction: column;
  2578. gap: 2px;
  2579. width: 100%;
  2580. }
  2581. .line-progress-item {
  2582. display: flex;
  2583. align-items: center;
  2584. gap: 4px;
  2585. font-size: 10px;
  2586. }
  2587. .line-label {
  2588. min-width: 30px;
  2589. color: #606266;
  2590. }
  2591. .line-status-text {
  2592. min-width: 25px;
  2593. color: #909399;
  2594. font-size: 10px;
  2595. }
  2596. /* 批量上传进度样式 */
  2597. .batch-upload-progress {
  2598. display: flex;
  2599. flex-direction: column;
  2600. gap: 4px;
  2601. }
  2602. .total-progress-row {
  2603. display: flex;
  2604. align-items: center;
  2605. gap: 8px;
  2606. white-space: nowrap;
  2607. /* 防止换行 */
  2608. min-width: 0;
  2609. /* 允许flex项目收缩 */
  2610. }
  2611. .progress-label {
  2612. font-size: 12px;
  2613. color: #606266;
  2614. min-width: 40px;
  2615. }
  2616. .line-progress-rows {
  2617. display: flex;
  2618. flex-direction: column;
  2619. gap: 2px;
  2620. }
  2621. .line-progress-row {
  2622. display: flex;
  2623. align-items: center;
  2624. gap: 4px;
  2625. font-size: 11px;
  2626. }
  2627. .line-percentage {
  2628. min-width: 30px;
  2629. color: #909399;
  2630. font-size: 11px;
  2631. }
  2632. ::v-deep .upload-icon {
  2633. font-size: 28px;
  2634. color: #8c939d;
  2635. }
  2636. ::v-deep .upload-text {
  2637. font-size: 12px;
  2638. color: #606266;
  2639. margin-top: 10px;
  2640. }
  2641. /* 表单样式 */
  2642. ::v-deep .el-form-item {
  2643. margin-bottom: 22px;
  2644. }
  2645. /* 批量选择弹窗样式 */
  2646. ::v-deep .batch-dialog .el-dialog__body {
  2647. padding: 0 20px 20px;
  2648. max-height: 70vh;
  2649. overflow-y: auto;
  2650. }
  2651. ::v-deep .el-dialog .el-dialog__body {
  2652. padding: 0 20px 20px;
  2653. max-height: 70vh;
  2654. overflow-y: auto;
  2655. }
  2656. .filter-container {
  2657. padding: 15px 0;
  2658. background-color: #fff;
  2659. border-bottom: 1px solid #ebeef5;
  2660. position: relative;
  2661. text-align: right;
  2662. }
  2663. .dialog-footer {
  2664. text-align: right;
  2665. margin-top: 20px;
  2666. padding-right: 20px;
  2667. }
  2668. ::v-deep .batch-dialog .el-table {
  2669. margin-top: 10px;
  2670. }
  2671. ::v-deep .el-table__header-wrapper th {
  2672. background-color: #f5f7fa;
  2673. color: #606266;
  2674. font-weight: 500;
  2675. padding: 8px 0;
  2676. }
  2677. ::v-deep .el-table__header-wrapper th {
  2678. background-color: #f5f7fa;
  2679. color: #606266;
  2680. font-weight: 500;
  2681. padding: 8px 0;
  2682. }
  2683. /* 确保弹窗中表格内容垂直居中 */
  2684. ::v-deep .batch-dialog .el-table .cell {
  2685. line-height: 23px;
  2686. }
  2687. ::v-deep .el-table .cell {
  2688. line-height: 23px;
  2689. }
  2690. /* 自定义滚动条样式 */
  2691. ::v-deep .batch-dialog .el-dialog__body::-webkit-scrollbar {
  2692. width: 6px;
  2693. height: 6px;
  2694. }
  2695. ::v-deep .el-dialog .el-dialog__body::-webkit-scrollbar {
  2696. width: 6px;
  2697. height: 6px;
  2698. }
  2699. ::v-deep .batch-dialog .el-dialog__body::-webkit-scrollbar-thumb {
  2700. background: #c0c4cc;
  2701. border-radius: 3px;
  2702. }
  2703. ::v-deep .el-dialog .el-dialog__body::-webkit-scrollbar-thumb {
  2704. background: #c0c4cc;
  2705. border-radius: 3px;
  2706. }
  2707. ::v-deep .batch-dialog .el-dialog__body::-webkit-scrollbar-track {
  2708. background: #f5f7fa;
  2709. }
  2710. ::v-deep .el-dialog .el-dialog__body::-webkit-scrollbar-track {
  2711. background: #f5f7fa;
  2712. }
  2713. /* 批量上传视频弹窗样式 */
  2714. .upload-dialog .el-dialog__body {
  2715. padding: 20px;
  2716. }
  2717. ::v-deep .upload-dialog .el-dialog__header {
  2718. padding: 15px 20px;
  2719. background-color: #f9f9f9;
  2720. border-bottom: 1px solid #ebeef5;
  2721. }
  2722. ::v-deep .upload-dialog .el-dialog__title {
  2723. font-size: 16px;
  2724. font-weight: 500;
  2725. color: #303133;
  2726. }
  2727. /* 项目选择弹窗样式 */
  2728. ::v-deep .el-dialog__wrapper {
  2729. z-index: 2001 !important;
  2730. }
  2731. ::v-deep .el-dialog__header {
  2732. padding: 15px 20px;
  2733. background-color: #f9f9f9;
  2734. border-bottom: 1px solid #ebeef5;
  2735. }
  2736. ::v-deep .el-dialog__title {
  2737. font-size: 16px;
  2738. font-weight: 500;
  2739. color: #303133;
  2740. }
  2741. ::v-deep .el-pagination {
  2742. text-align: center;
  2743. margin-top: 10px;
  2744. }
  2745. /* 项目选择弹窗的样式 */
  2746. .project-container {
  2747. display: flex;
  2748. height: 500px;
  2749. }
  2750. .category-tree {
  2751. width: 250px;
  2752. height: 100%;
  2753. border-right: 1px solid #ebeef5;
  2754. padding: 0;
  2755. display: flex;
  2756. flex-direction: column;
  2757. overflow: hidden;
  2758. flex-shrink: 0;
  2759. }
  2760. .tree-fixed-header {
  2761. padding: 10px;
  2762. background-color: #fff;
  2763. border-bottom: 1px solid #ebeef5;
  2764. z-index: 10;
  2765. box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  2766. }
  2767. .tree-content {
  2768. flex: 1;
  2769. overflow-y: auto;
  2770. padding: 10px 10px 10px 10px;
  2771. }
  2772. .project-list {
  2773. flex: 1;
  2774. padding: 10px;
  2775. height: 100%;
  2776. display: flex;
  2777. flex-direction: column;
  2778. width: calc(100% - 250px);
  2779. /* 固定宽度为剩余空间 */
  2780. }
  2781. .project-list .filter-container {
  2782. padding: 0 0 15px 0;
  2783. text-align: left;
  2784. }
  2785. .project-list .table-footer {
  2786. margin-top: 15px;
  2787. }
  2788. ::v-deep .el-tree-node__content {
  2789. height: 36px;
  2790. border-radius: 4px;
  2791. margin-bottom: 2px;
  2792. }
  2793. ::v-deep .el-tree-node:focus > .el-tree-node__content {
  2794. background-color: #e6f7ff;
  2795. }
  2796. ::v-deep .el-tree-node__content:hover {
  2797. background-color: #f0f7ff;
  2798. }
  2799. ::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
  2800. background-color: #e6f7ff;
  2801. color: #1890ff;
  2802. }
  2803. ::v-deep .custom-tree-node {
  2804. flex: 1;
  2805. display: flex;
  2806. align-items: center;
  2807. justify-content: space-between;
  2808. font-size: 14px;
  2809. padding: 0 8px;
  2810. }
  2811. /* 视频预览弹窗样式 */
  2812. ::v-deep .video-preview-dialog {
  2813. z-index: 3000 !important;
  2814. }
  2815. ::v-deep .video-preview-dialog .el-dialog {
  2816. margin-top: 10vh !important;
  2817. }
  2818. ::v-deep .video-preview-dialog .el-dialog__header {
  2819. padding: 15px 20px;
  2820. background-color: #f9f9f9;
  2821. border-bottom: 1px solid #ebeef5;
  2822. }
  2823. ::v-deep .video-preview-dialog .el-dialog__body {
  2824. padding: 15px;
  2825. background-color: #000;
  2826. display: flex;
  2827. justify-content: center;
  2828. align-items: center;
  2829. }
  2830. ::v-deep .video-preview-dialog video {
  2831. max-width: 100%;
  2832. max-height: 70vh;
  2833. }
  2834. /* 题目列表样式 */
  2835. .project-list-container {
  2836. background-color: #f5f7fa;
  2837. border-radius: 4px;
  2838. }
  2839. .question-card {
  2840. background-color: #ffffff;
  2841. border-radius: 4px;
  2842. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
  2843. padding: 15px;
  2844. margin-bottom: 15px;
  2845. position: relative;
  2846. }
  2847. .question-header {
  2848. display: flex;
  2849. align-items: flex-start;
  2850. margin-bottom: 10px;
  2851. border-bottom: 1px solid #ebeef5;
  2852. padding-bottom: 10px;
  2853. }
  2854. .question-index {
  2855. display: flex;
  2856. justify-content: center;
  2857. align-items: center;
  2858. width: 24px;
  2859. height: 24px;
  2860. background-color: #409EFF;
  2861. color: white;
  2862. border-radius: 50%;
  2863. font-size: 14px;
  2864. margin-right: 10px;
  2865. flex-shrink: 0;
  2866. }
  2867. .question-title {
  2868. font-size: 16px;
  2869. font-weight: 500;
  2870. color: #303133;
  2871. line-height: 1.5;
  2872. word-break: break-all;
  2873. }
  2874. .question-type {
  2875. margin-bottom: 15px;
  2876. }
  2877. .content-title {
  2878. font-weight: 500;
  2879. color: #606266;
  2880. margin-bottom: 10px;
  2881. }
  2882. .question-content {
  2883. margin-bottom: 15px;
  2884. }
  2885. .question-item {
  2886. background-color: #f8f8f8;
  2887. border-left: 3px solid #409EFF;
  2888. padding: 10px;
  2889. margin-bottom: 10px;
  2890. border-radius: 0 4px 4px 0;
  2891. }
  2892. .question-item-header {
  2893. display: flex;
  2894. align-items: center;
  2895. margin-bottom: 5px;
  2896. }
  2897. .item-index {
  2898. display: inline-block;
  2899. margin-right: 10px;
  2900. font-weight: 500;
  2901. color: #409EFF;
  2902. }
  2903. .item-name {
  2904. color: #303133;
  2905. }
  2906. .question-answer {
  2907. background-color: #f0f9eb;
  2908. padding: 10px;
  2909. border-radius: 4px;
  2910. border-left: 3px solid #67c23a;
  2911. }
  2912. .answer-label {
  2913. font-weight: 500;
  2914. color: #67c23a;
  2915. margin-right: 10px;
  2916. }
  2917. .answer-content {
  2918. color: #606266;
  2919. }
  2920. ::v-deep .custom-select-class .el-select__tags {
  2921. display: flex;
  2922. flex-direction: column;
  2923. align-items: flex-start;
  2924. flex-wrap: nowrap;
  2925. max-height: 200px;
  2926. overflow-y: auto;
  2927. }
  2928. ::v-deep .custom-select-class .el-tag {
  2929. margin-bottom: 4px;
  2930. margin-right: 0;
  2931. }
  2932. /* Added queue status styles */
  2933. .queue-status {
  2934. display: flex;
  2935. justify-content: center;
  2936. align-items: center;
  2937. padding: 8px;
  2938. }
  2939. .queue-status .el-tag {
  2940. font-size: 12px;
  2941. padding: 4px 8px;
  2942. }
  2943. </style>