VideoAudit.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <el-container v-loading="loading" class="audit-container">
  3. <el-main class="audit-main">
  4. <div class="video-card">
  5. <div class="video-header">
  6. <el-tag size="small" type="info" effect="plain">ID: {{ currentVideo.videoId }}</el-tag>
  7. <h1 class="video-title">{{ currentVideo.title }}</h1>
  8. </div>
  9. <div class="player-wrapper">
  10. <video
  11. ref="videoPlayer"
  12. :src="currentVideo.videoUrl"
  13. controls
  14. autoplay
  15. class="main-player"
  16. @timeupdate="onTimeUpdate"
  17. />
  18. </div>
  19. <div class="timeline-fast-tracks">
  20. <span class="track-label"><i class="el-icon-timer" /> 进度抽审:</span>
  21. <el-button-group>
  22. <el-button size="mini" @click="jumpTo(0.1)">10%</el-button>
  23. <el-button size="mini" @click="jumpTo(0.3)">30%</el-button>
  24. <el-button size="mini" @click="jumpTo(0.5)">50%</el-button>
  25. <el-button size="mini" @click="jumpTo(0.8)">80%</el-button>
  26. </el-button-group>
  27. <span class="current-time-tips">当前: {{ formatTime(currentTime) }} / {{ formatTime(duration) }}</span>
  28. </div>
  29. </div>
  30. <div class="meta-card">
  31. <h3 class="section-title">视频简介描述</h3>
  32. <p class="description-text">{{ currentVideo.description || '该视频无文字简介' }}</p>
  33. <div class="meta-grid">
  34. <div class="meta-item">
  35. <span class="label">画幅方向:</span>
  36. <span class="value">{{ currentVideo.horizontal ? '横屏 (16:9)' : '竖屏 (9:16)' }}</span>
  37. </div>
  38. <div class="meta-item">
  39. <span class="label">发布时间:</span>
  40. <span class="value">{{ currentVideo.pubDate }}</span>
  41. </div>
  42. <div class="meta-item">
  43. <span class="label">可见范围:</span>
  44. <el-tag size="mini" type="info">{{ scopeMap[currentVideo.scope] }}</el-tag>
  45. </div>
  46. </div>
  47. </div>
  48. </el-main>
  49. <el-aside width="360px" class="audit-aside">
  50. <div class="aside-card author-card">
  51. <h3 class="section-title">创作者信息</h3>
  52. <div class="author-info">
  53. <el-avatar :size="46" :src="currentVideo.userCard.avatarUrl" icon="el-icon-user-solid" />
  54. <div class="author-detail">
  55. <div class="author-name">{{ currentVideo.userCard.screenName || '未知用户' }}</div>
  56. <div class="author-id">UID: {{ currentVideo.userCard.userIdStr }}</div>
  57. </div>
  58. </div>
  59. <div class="author-badge-group">
  60. <el-tag size="mini" type="success">历史通过率: 98%</el-tag>
  61. <el-tag size="mini" type="warning">违规记录: 0次</el-tag>
  62. </div>
  63. </div>
  64. <div class="aside-card action-card">
  65. <h3 class="section-title">审核决策面板</h3>
  66. <el-form ref="auditForm" :model="auditForm" label-position="top" size="small">
  67. <el-form-item label="违规标签(不通过时必选)" prop="reasonTags">
  68. <el-checkbox-group v-model="auditForm.reasonTags" :disabled="auditForm.decision === auditResult.REVIEW_REJECTED">
  69. <el-checkbox label="涉政违规" />
  70. <el-checkbox label="色情低俗" />
  71. <el-checkbox label="血腥暴力" />
  72. <el-checkbox label="侵权盗版" />
  73. <el-checkbox label="垃圾广告" />
  74. <el-checkbox label="画质低劣/封面党" />
  75. </el-checkbox-group>
  76. </el-form-item>
  77. <el-form-item label="审核批注与意见" prop="remark">
  78. <el-input
  79. v-model="auditForm.remark"
  80. type="textarea"
  81. :rows="4"
  82. placeholder="请输入具体的原因说明,将同步给创作者..."
  83. maxlength="200"
  84. show-word-limit
  85. />
  86. </el-form-item>
  87. <div class="submit-buttons">
  88. <el-button
  89. type="danger"
  90. icon="el-icon-close"
  91. class="btn-reject"
  92. :loading="submitting"
  93. @click="submitAudit(3)"
  94. >
  95. 拒绝 (驳回)
  96. </el-button>
  97. <el-button
  98. type="success"
  99. icon="el-icon-check"
  100. class="btn-approve"
  101. :loading="submitting"
  102. @click="submitAudit(2)"
  103. >
  104. 通过放行
  105. </el-button>
  106. </div>
  107. </el-form>
  108. </div>
  109. <div class="aside-card shortcut-card">
  110. <h4 class="shortcut-title"><i class="el-icon-info" /> 键盘盲审快捷键指南</h4>
  111. <div class="shortcut-grid">
  112. <div class="shortcut-item"><kbd>Space</kbd> <span>播放 / 暂停</span></div>
  113. <div class="shortcut-item"><kbd>→</kbd> <span>快进 5 秒</span></div>
  114. <div class="shortcut-item"><kbd>Shift + A</kbd> <span class="text-success">直接通过</span></div>
  115. <div class="shortcut-item"><kbd>Shift + R</kbd> <span class="text-danger">直接拒绝</span></div>
  116. </div>
  117. </div>
  118. </el-aside>
  119. </el-container>
  120. </template>
  121. <script>
  122. import { getAuditVideo, submitAuditVideo } from '@/api/vod'
  123. export default {
  124. name: 'VideoAudit',
  125. // 组件激活前:摘除全局 #app 的强制滚动行为
  126. beforeRouteEnter(to, from, next) {
  127. next(vm => {
  128. const appEl = document.getElementById('app')
  129. if (appEl) appEl.style.overflowY = 'hidden'
  130. })
  131. },
  132. // 组件离开前:还原还原全局 #app 的原貌,不破坏其他页面的行为
  133. beforeRouteLeave(to, from, next) {
  134. const appEl = document.getElementById('app')
  135. if (appEl) appEl.style.overflowY = 'scroll'
  136. next()
  137. },
  138. data() {
  139. return {
  140. loading: false,
  141. submitting: false,
  142. currentTime: 0,
  143. duration: 0,
  144. scopeMap: {
  145. 1: '本人可见',
  146. 2: '所有人可见',
  147. 3: 'VIP 可见'
  148. },
  149. auditResult: {
  150. PUBLISHED: 3,
  151. REVIEW_REJECTED: 4
  152. },
  153. // 当前待审核的视频数据模型
  154. currentVideo: {
  155. videoId: '',
  156. title: '',
  157. description: '',
  158. videoUrl: '',
  159. horizontal: null,
  160. pubDate: '',
  161. scope: 0,
  162. userCard: {
  163. userId: '',
  164. screenName: '',
  165. avatarUrl: ''
  166. }
  167. },
  168. // 审核提交表单
  169. auditForm: {
  170. videoId: null,
  171. decision: null,
  172. reasonTags: [],
  173. remark: ''
  174. }
  175. }
  176. },
  177. watch: {
  178. $route() {
  179. this.$router.go()
  180. }
  181. },
  182. created() {
  183. const videoId = this.$route.params.id
  184. this.fetchNextVideo(videoId)
  185. },
  186. mounted() {
  187. // 全局监听键盘事件,开启极限盲审模式
  188. window.addEventListener('keydown', this.handleKeyboardShortcuts)
  189. },
  190. beforeDestroy() {
  191. window.removeEventListener('keydown', this.handleKeyboardShortcuts)
  192. },
  193. methods: {
  194. // 获取下一条待审核视频
  195. fetchNextVideo(videoId) {
  196. this.loading = true
  197. // 重置表单状态
  198. this.auditForm = { decision: null, reasonTags: [], remark: '' }
  199. this.currentTime = 0
  200. this.duration = 0
  201. const queryParams = {}
  202. queryParams.videoId = videoId
  203. getAuditVideo(queryParams).then(resp => {
  204. if (resp.code === 0) {
  205. this.currentVideo = resp.data
  206. this.auditForm.videoId = this.currentVideo.videoId
  207. } else {
  208. this.$message.warning(resp.msg)
  209. }
  210. }).finally(() => {
  211. this.loading = false
  212. })
  213. },
  214. // 提交审核决策
  215. submitAudit(status) {
  216. this.auditForm.decision = status
  217. // 校验逻辑:如果不通过,必须选择至少一个违规标签或填写备注
  218. if (status === this.auditResult.REVIEW_REJECTED && this.auditForm.reasonTags.length === 0 && !this.auditForm.remark.trim()) {
  219. this.$message.error('请选择违规标签或填写不通过的具体审核意见!')
  220. return
  221. }
  222. this.submitting = true
  223. submitAuditVideo(this.auditForm).then(resp => {
  224. if (resp.code === 0) {
  225. var nextVideoId = resp.data
  226. this.submitting = false
  227. this.$notify({
  228. title: status === this.auditResult.PUBLISHED ? '审核通过' : '已驳回',
  229. message: `视频 [${this.currentVideo.videoId}] 处理完毕,已自动加载下一条。`,
  230. type: status === this.auditResult.PUBLISHED ? 'success' : 'warning',
  231. duration: 2500
  232. })
  233. this.$router.push('/vod_audit/' + nextVideoId)
  234. }
  235. })
  236. },
  237. // 播放器时间更新
  238. onTimeUpdate(e) {
  239. this.currentTime = e.target.currentTime
  240. this.duration = e.target.duration || 0
  241. },
  242. // 时间轴快捷百分比跳跃
  243. jumpTo(percentage) {
  244. const player = this.$refs.videoPlayer
  245. if (player && this.duration) {
  246. player.currentTime = this.duration * percentage
  247. }
  248. },
  249. // 工具函数:格式化时间 (00:00)
  250. formatTime(seconds) {
  251. if (isNaN(seconds)) return '00:00'
  252. const min = Math.floor(seconds / 60).toString().padStart(2, '0')
  253. const sec = Math.floor(seconds % 60).toString().padStart(2, '0')
  254. return `${min}:${sec}`
  255. },
  256. // 键盘快捷键矩阵处理器
  257. handleKeyboardShortcuts(e) {
  258. // 如果光标正停留在文本输入框内,不触发快捷键,防止冲突
  259. if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return
  260. const player = this.$refs.videoPlayer
  261. switch (e.key) {
  262. case ' ': // 空格键:暂停/播放
  263. e.preventDefault()
  264. if (player) {
  265. player.paused ? player.play() : player.pause()
  266. }
  267. break
  268. case 'ArrowRight': // 方向右键:快进5秒
  269. if (player) player.currentTime += 5
  270. break
  271. case 'ArrowLeft': // 方向左键:快退5秒
  272. if (player) player.currentTime -= 5
  273. break
  274. case 'A': // Shift + A: 快捷通过
  275. if (e.shiftKey) this.submitAudit(2)
  276. break
  277. case 'R': // Shift + R: 快捷拒绝
  278. if (e.shiftKey) this.submitAudit(3)
  279. break
  280. }
  281. }
  282. }
  283. }
  284. </script>
  285. <style scoped>
  286. /* 全局页面沙箱 - 修正为直接吃满 100vh 浏览器视口 */
  287. .audit-container {
  288. height: 100vh;
  289. width: 100vw;
  290. background-color: #f4f7f9;
  291. gap: 20px;
  292. padding: 20px; /* 给四周留出高级的视窗边距 */
  293. box-sizing: border-box; /* 锁定边距不撑开大盘 */
  294. overflow: hidden; /* 严禁外层容器出现滚动条 */
  295. }
  296. /* ==================== 🎬 左侧内容区 ==================== */
  297. .audit-main {
  298. padding: 0;
  299. display: flex;
  300. flex-direction: column;
  301. gap: 20px;
  302. height: 100%; /* 锁定跟随父级高度 */
  303. overflow-y: auto; /* 仅允许内容区独立轴向滚动 */
  304. }
  305. .video-card {
  306. background: #ffffff;
  307. border-radius: 8px;
  308. padding: 20px;
  309. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  310. }
  311. .video-header {
  312. display: flex;
  313. align-items: center;
  314. gap: 12px;
  315. margin-bottom: 16px;
  316. }
  317. .video-title {
  318. font-size: 18px;
  319. font-weight: 600;
  320. color: #1e293b;
  321. margin: 0;
  322. }
  323. /* 核心播放器容器 */
  324. .player-wrapper {
  325. background-color: #000000;
  326. border-radius: 6px;
  327. overflow: hidden;
  328. position: relative;
  329. width: 100%;
  330. aspect-ratio: 16 / 9; /* 保持16:9黄金比例,自适应各屏幕 */
  331. max-height: 500px;
  332. display: flex;
  333. justify-content: center;
  334. align-items: center;
  335. }
  336. .main-player {
  337. width: 100%;
  338. height: 100%;
  339. object-fit: contain; /* 防止视频拉伸变形 */
  340. }
  341. /* 抽审进度控制条 */
  342. .timeline-fast-tracks {
  343. margin-top: 14px;
  344. display: flex;
  345. align-items: center;
  346. gap: 12px;
  347. background: #f8fafc;
  348. padding: 8px 12px;
  349. border-radius: 6px;
  350. border: 1px dashed #e2e8f0;
  351. }
  352. .track-label {
  353. font-size: 13px;
  354. color: #64748b;
  355. font-weight: 500;
  356. }
  357. .current-time-tips {
  358. margin-left: auto;
  359. font-family: monospace;
  360. font-size: 13px;
  361. color: #334155;
  362. background: #cbd5e1;
  363. padding: 2px 8px;
  364. border-radius: 4px;
  365. }
  366. /* 视频元数据描述卡片 */
  367. .meta-card {
  368. background: #ffffff;
  369. border-radius: 8px;
  370. padding: 20px;
  371. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  372. }
  373. .section-title {
  374. font-size: 14px;
  375. font-weight: 600;
  376. color: #475569;
  377. margin-top: 0;
  378. margin-bottom: 12px;
  379. border-left: 3px solid #1890ff;
  380. padding-left: 8px;
  381. }
  382. .description-text {
  383. font-size: 14px;
  384. color: #334155;
  385. line-height: 1.6;
  386. background: #f8fafc;
  387. padding: 12px;
  388. border-radius: 6px;
  389. margin-bottom: 16px;
  390. }
  391. .meta-grid {
  392. display: grid;
  393. grid-template-columns: repeat(3, 1fr);
  394. gap: 16px;
  395. }
  396. .meta-item {
  397. font-size: 13px;
  398. }
  399. .meta-item .label { color: #64748b; }
  400. .meta-item .value { color: #1e293b; font-weight: 500; }
  401. /* ==================== 🛠️ 右侧风控工作台 ==================== */
  402. .audit-aside {
  403. display: flex;
  404. flex-direction: column;
  405. gap: 20px;
  406. height: 100%; /* 锁定跟随父级高度 */
  407. overflow-y: auto; /* 防止右侧内容过多时溢出屏幕 */
  408. }
  409. .aside-card {
  410. background: #ffffff;
  411. border-radius: 8px;
  412. padding: 20px;
  413. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  414. }
  415. /* 创作者信息 */
  416. .author-info {
  417. display: flex;
  418. align-items: center;
  419. gap: 12px;
  420. margin-bottom: 12px;
  421. }
  422. .author-name {
  423. font-size: 15px;
  424. font-weight: 600;
  425. color: #1e293b;
  426. }
  427. .author-id {
  428. font-size: 12px;
  429. color: #94a3b8;
  430. margin-top: 2px;
  431. }
  432. .author-badge-group {
  433. display: flex;
  434. gap: 6px;
  435. }
  436. /* 审核决策控制流 */
  437. ::v-deep .el-checkbox {
  438. margin-bottom: 8px;
  439. margin-right: 16px;
  440. width: 120px; /* 两列规整排列 */
  441. }
  442. .submit-buttons {
  443. display: flex;
  444. gap: 12px;
  445. margin-top: 20px;
  446. }
  447. .btn-reject, .btn-approve {
  448. flex: 1;
  449. height: 40px;
  450. font-weight: 600;
  451. border-radius: 6px;
  452. }
  453. /* 盲审快捷键指南卡片 */
  454. .shortcut-card {
  455. background: #0f172a; /* 深色极客风,与快捷键功能相呼应 */
  456. color: #94a3b8;
  457. }
  458. .shortcut-title {
  459. color: #f1f5f9;
  460. margin: 0 0 12px 0;
  461. font-size: 13px;
  462. font-weight: 500;
  463. }
  464. .shortcut-grid {
  465. display: grid;
  466. grid-template-columns: 1fr;
  467. gap: 8px;
  468. }
  469. .shortcut-item {
  470. display: flex;
  471. justify-content: space-between;
  472. align-items: center;
  473. font-size: 12px;
  474. }
  475. kbd {
  476. background-color: #334155;
  477. color: #ffffff;
  478. border-radius: 3px;
  479. border: 1px solid #475569;
  480. padding: 2px 6px;
  481. font-family: monospace;
  482. font-weight: bold;
  483. box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  484. }
  485. .text-success { color: #10b981; }
  486. .text-danger { color: #ef4444; }
  487. </style>