detail.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div>
  3. <header_local />
  4. <div class="main">
  5. <el-row class="head">
  6. <el-col :span="12">
  7. <el-icon size="18" @click="router.go(-1)" style="cursor: pointer">
  8. <ArrowLeft />
  9. </el-icon>
  10. 视频审核
  11. </el-col>
  12. </el-row>
  13. <br />
  14. <el-row class="body">
  15. <el-col
  16. ref="left"
  17. :span="16"
  18. style="border-right: 2px solid #e4e4e4; padding: 0 26px"
  19. >
  20. <div v-text="detail.title" style="margin-bottom: 1em"></div>
  21. <div class="video_content">
  22. <!-- -->
  23. <video
  24. autoplay
  25. controls
  26. ref="video"
  27. :style="{
  28. width: image_data.width + 'px',
  29. height: image_data.height + 'px',
  30. background: '#000'
  31. }"
  32. @canplay="canplay"
  33. @timeupdate="timeupdate"
  34. :src="detail.url"
  35. ></video>
  36. <!-- <div class="progress"></div> -->
  37. </div>
  38. <el-button
  39. :type="status[detail.reviewResult.label]"
  40. style="margin: 0 auto; display: block"
  41. v-text="detail.reviewResult.labelDesc"
  42. ></el-button>
  43. <div style="text-align: center; height: 3em; line-height: 3em">
  44. 该视频共有{{ detail_data.total }}处违规
  45. </div>
  46. </el-col>
  47. <el-col :span="8" style="padding: 0 17px">
  48. <div style="height: 3em; line-height: 3em">审核结果</div>
  49. <el-tabs
  50. v-if="
  51. detail &&
  52. detail.reviewResult &&
  53. detail.reviewResult.results &&
  54. detail.reviewResult.results.length
  55. "
  56. v-model="activeName"
  57. >
  58. <el-tab-pane
  59. :label="item.typeDesc"
  60. :name="item.type"
  61. v-for="item in detail.reviewResult.results"
  62. :key="item.type"
  63. >
  64. <div
  65. :class="{ err_item: true, err_act: select_item === index }"
  66. v-for="(p, index) in item.items"
  67. :key="index"
  68. @click="() => play(p, index)"
  69. >
  70. <div
  71. class="err_item_label"
  72. style="height: 2em; line-height: 2em"
  73. >
  74. <span>{{
  75. `${index + 1}、 ${changeTime(
  76. p.startTimeInSeconds
  77. )}-${changeTime(p.endTimeInSeconds)}`
  78. }}</span>
  79. <span style="color: #f56c6c">【{{ p.labelDesc }}】</span>
  80. <span>{{ `${p.subTypeDesc}` }}</span>
  81. </div>
  82. <img
  83. :src="p.evidence.thumbnail"
  84. style="
  85. width: 100%;
  86. max-width: 373px;
  87. border-radius: 5px;
  88. display: block;
  89. margin: 0 auto;
  90. "
  91. />
  92. </div>
  93. </el-tab-pane>
  94. </el-tabs>
  95. <el-empty description="暂无违规信息" v-else />
  96. </el-col>
  97. </el-row>
  98. </div>
  99. </div>
  100. </template>
  101. <script setup>
  102. import header_local from '../components/header.vue';
  103. // import { storeImg, historyImg } from '@/api/processing';
  104. import { ref } from 'vue';
  105. import { useRouter } from 'vue-router';
  106. const router = useRouter();
  107. // import config from '../../../config/index';
  108. const status = {
  109. REJECT: 'danger',
  110. REVIEW: 'warning',
  111. NORMAL: 'success'
  112. };
  113. const left = ref(null);
  114. const video = ref(null);
  115. const detail = JSON.parse(
  116. sessionStorage.getItem('Processing_detail') || '{reviewResult: {}}'
  117. );
  118. const activeName = ref(
  119. detail &&
  120. detail.reviewResult &&
  121. detail.reviewResult.results &&
  122. detail.reviewResult.results.length
  123. ? detail.reviewResult.results[0].type
  124. : ''
  125. );
  126. const select_item = ref(-1);
  127. const detail_data = ref({
  128. total: 0
  129. });
  130. detail?.reviewResult?.results?.map(v => {
  131. detail_data.value.total += v.items ? v.items.length : 0;
  132. });
  133. function timeupdate(p) {
  134. // console.log(p.target.duration);
  135. // console.log(p.target.currentTime);
  136. // console.log((p.target.currentTime / p.target.duration).toFixed(4) * 100);
  137. }
  138. function changeTime(T) {
  139. let H = (T - (T % 3600)) / 3600;
  140. let M = (T - (T % 60)) / 60;
  141. let S = T % 60;
  142. H < 10 ? (H = '0' + H) : H;
  143. M < 10 ? (M = '0' + M) : M;
  144. S < 10 ? (S = '0' + S) : S;
  145. return `${H}:${M}:${S}`;
  146. }
  147. function play(p, i) {
  148. select_item.value = i;
  149. video.value.currentTime = p.startTimeInSeconds;
  150. video.value.play();
  151. }
  152. const image_data = ref({
  153. height: 0,
  154. width: 0
  155. });
  156. function canplay() {
  157. let r_width = left.value.$el.offsetWidth - 52;
  158. let h = (video.value.videoWidth / video.value.videoHeight) * r_width;
  159. if (h > left.value.$el.offsetHeight) {
  160. h = left.value.$el.offsetHeight - 252;
  161. }
  162. image_data.value = {
  163. height: h,
  164. width: r_width
  165. };
  166. }
  167. // const Authorization = localStorage.getItem('token') || '';
  168. </script>
  169. <style scoped>
  170. .main {
  171. padding: 1em;
  172. font-size: 14px;
  173. font-family: PingFangSC, PingFang SC;
  174. height: calc(100% - 42px);
  175. }
  176. .main .head {
  177. background: #f9fafc;
  178. height: 42px;
  179. line-height: 42px;
  180. padding: 0 22px;
  181. }
  182. .main .body {
  183. height: calc(100% - 42px - 1em);
  184. }
  185. .err_item_label {
  186. overflow-wrap: break-word;
  187. }
  188. .err_item {
  189. padding: 5px;
  190. margin: 10px 0;
  191. }
  192. .err_item:hover,
  193. .err_act {
  194. background-color: #e8effc;
  195. }
  196. .progress {
  197. border-radius: 2em;
  198. background-color: #fff;
  199. position: absolute;
  200. bottom: 1.5em;
  201. width: 90%;
  202. left: 5%;
  203. height: 4px;
  204. }
  205. .video_content {
  206. position: relative;
  207. margin-bottom: 3em;
  208. }
  209. </style>