Sfoglia il codice sorgente

feat: 获取图片数量

WANGKANG 9 mesi fa
parent
commit
fe99bf24fb

+ 6 - 2
src/api/modules/demo/videoStable.ts

@@ -74,6 +74,10 @@ export const startVideoStableApi = (id: String | Number) => {
   return http.get('/demo/videoStable/start/' + id)
 }
 
-export const getCompareImageApi = (taskName: String, idx: String | Number) => {
-  return http.get('/demo/videoStable/compare/' + taskName + '/' + idx)
+export const getCompareImageApi = (taskId: String, idx: String | Number) => {
+  return http.get('/demo/videoStable/compare/' + taskId + '/' + idx)
+}
+
+export const getCompareImageCountApi = (taskId: String | Number) => {
+  return http.get('/demo/videoStable/compare/num/' + taskId)
 }

+ 19 - 2
src/views/demo/videoStable/index.vue

@@ -32,7 +32,11 @@
     </ProTable>
     <FormDialog ref="formDialogRef" />
     <ImportExcel ref="dialogRef" />
-    <el-dialog v-model="dialogVisible" :title="'图片对比: 第' + imageIdx + '张图片对比'" width="80%">
+    <el-dialog
+      v-model="dialogVisible"
+      :title="'图片对比: 第' + imageIdx + '张图片对比 共' + Math.min(inFileCount, outFileCount) + '张图片'"
+      width="80%"
+    >
       <div class="image-dialog">
         <el-image :src="'data:image/png;base64,' + imageBase64List.origin" style="width: 45%"></el-image>
         <el-image :src="'data:image/png;base64,' + imageBase64List.stable" style="width: 45%"></el-image>
@@ -64,7 +68,8 @@ import {
   exportVideoStableApi,
   getVideoStableApi,
   startVideoStableApi,
-  getCompareImageApi
+  getCompareImageApi,
+  getCompareImageCountApi
 } from '@/api/modules/demo/videoStable'
 
 const dialogVisible = ref(false)
@@ -74,6 +79,8 @@ const imageBase64List = ref({
   origin: '',
   stable: ''
 })
+const inFileCount = ref(0)
+const outFileCount = ref(0)
 
 const startVideoStable = async (params: any) => {
   const res = await startVideoStableApi(params.id)
@@ -93,6 +100,16 @@ const loadImageData = async (taskId: string, imageIdx: number) => {
 const compareVideoStable = async (params: any) => {
   taskId.value = params.id
   imageIdx.value = 1
+
+  const resCount: any = await getCompareImageCountApi(params.id)
+  if (resCount.code === 200) {
+    inFileCount.value = resCount.data.inFileCount
+    outFileCount.value = resCount.data.outFileCount
+  } else {
+    ElMessage.error('获取图片对比数量失败')
+    return
+  }
+
   await loadImageData(taskId.value, imageIdx.value)
 
   dialogVisible.value = true