auditModal.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <a-modal v-model:visible="visibles" title="资源信息" @cancel="handleCancel" :footer="null" width="800px">
  3. <div class="audit-container">
  4. <!-- 左侧 - 文件展示区域 -->
  5. <div class="file-preview">
  6. <video-player v-if="recordData.suffix === 'mp4'" :options="playerOptions" @ready="playerReadied"></video-player>
  7. <div v-else-if="recordData.suffix === 'ppt'" class="preview-placeholder">
  8. <file-ppt-filled style="font-size: 48px; color: #d24638" />
  9. <p>PPT文件预览</p>
  10. </div>
  11. <div v-else-if="recordData.suffix === 'word'" class="preview-placeholder">
  12. <file-word-filled style="font-size: 48px; color: #2b579a" />
  13. <p>Word文件预览</p>
  14. </div>
  15. <div v-else-if="recordData.suffix === 'pdf'" class="preview-placeholder">
  16. <file-pdf-filled style="font-size: 48px; color: #f40f02" />
  17. <p>PDF文件预览</p>
  18. </div>
  19. <div v-else class="preview-placeholder">
  20. <file-unknown-filled style="font-size: 48px; color: #999" />
  21. <p>文件预览</p>
  22. </div>
  23. </div>
  24. <!-- 右侧 - 审核信息区域 -->
  25. <div class="audit-info">
  26. <div class="info-section">
  27. <p><strong>上传人:</strong>{{ detailData.resourceCreaterUserName || '--' }}</p>
  28. <p><strong>所属院系:</strong>{{ detailData?.collegeAllIdName || '--' }}</p>
  29. <p><strong>所属专业:</strong>{{ detailData?.majorIdName || '--' }}</p>
  30. <p><strong>资源类型:</strong>{{ detailData?.courseTypeName || '--' }}</p>
  31. <p><strong>资源格式:</strong>{{ detailData?.suffix || '--' }}</p>
  32. <p><strong>视频时长:</strong>{{ detailData?.duration || '--' }}</p>
  33. <p><strong>视频大小:</strong>{{ detailData?.FILESIZE || '--' }}<span v-if="detailData?.FILESIZE">b</span></p>
  34. <p><strong>发布时间:</strong>{{ detailData?.uploadTime || '--' }}</p>
  35. <p><strong>资源描述:</strong>{{ detailData?.resourceDesc || '--' }}</p>
  36. </div>
  37. </div>
  38. </div>
  39. <div style="display: flex; justify-content: flex-end; margin-top: 10px" v-if="isAudit">
  40. <a-button @click="handleAuditResult(3)" style="margin-right: 10px">不同意</a-button>
  41. <a-button type="primary" @click="handleAuditResult(2)">同意</a-button>
  42. </div>
  43. </a-modal>
  44. </template>
  45. <script setup>
  46. import { ref, defineProps, defineEmits, computed } from 'vue'
  47. import resourceAuditApi from '@/api/resourceAudit.js'
  48. // import videoPlayer from 'vue-video-player'
  49. const props = defineProps({
  50. recordData: {
  51. type: Object,
  52. required: true,
  53. default: null
  54. },
  55. //是否是审核
  56. isAudit: {
  57. type: Boolean,
  58. required: true,
  59. default: false
  60. }
  61. })
  62. const emit = defineEmits(['confirm', 'close'])
  63. const auditResult = ref(1) // 默认为通过
  64. const detailData = ref({})
  65. const visibles = ref(true)
  66. const playerOptions = computed(() => ({
  67. sources: [
  68. {
  69. type: 'video/mp4',
  70. src: props.recordData.filePath // 视频文件路径
  71. }
  72. ],
  73. poster: props.recordData.posterPath // 封面图片路径
  74. }))
  75. const handleCancel = () => {
  76. emit('close')
  77. }
  78. const handleAuditResult = (val) => {
  79. auditResult.value = val
  80. emit('confirm', { ...props.recordData, auditResult: auditResult.value })
  81. }
  82. const playerReadied = (player) => {
  83. // player ready
  84. }
  85. // 获取资源详情
  86. const getDetail = () => {
  87. resourceAuditApi.detail({ id: props.recordData.id }).then((res) => {
  88. console.log(res.data, '资源详情')
  89. detailData.value = res.data
  90. })
  91. }
  92. onMounted(() => {
  93. getDetail()
  94. })
  95. </script>
  96. <style scoped>
  97. .audit-container {
  98. display: flex;
  99. gap: 20px;
  100. height: 500px;
  101. border-bottom: 1px solid #ccc;
  102. padding-bottom: 10px;
  103. }
  104. .file-preview {
  105. flex: 1;
  106. display: flex;
  107. justify-content: center;
  108. align-items: center;
  109. background-color: #f5f5f5;
  110. border-radius: 4px;
  111. overflow: hidden;
  112. }
  113. .preview-placeholder {
  114. display: flex;
  115. flex-direction: column;
  116. align-items: center;
  117. gap: 10px;
  118. color: #666;
  119. }
  120. .audit-info {
  121. flex: 1;
  122. display: flex;
  123. flex-direction: column;
  124. gap: 20px;
  125. }
  126. .info-section {
  127. background: #fff;
  128. border-radius: 4px;
  129. }
  130. .info-section h4 {
  131. margin-bottom: 12px;
  132. font-size: 16px;
  133. color: #333;
  134. }
  135. .description-box {
  136. padding: 12px;
  137. border: 1px solid #d9d9d9;
  138. border-radius: 4px;
  139. max-height: 150px;
  140. overflow-y: auto;
  141. }
  142. .audit-action {
  143. margin-top: auto;
  144. padding-top: 20px;
  145. border-top: 1px dashed #d9d9d9;
  146. }
  147. /* 调整描述列表样式 */
  148. :deep(.ant-descriptions-item-label) {
  149. width: 100px;
  150. font-weight: normal;
  151. }
  152. .ant-modal-footer {
  153. display: none !important; /* 检查是否被覆盖 */
  154. }
  155. </style>