From 54ba342153c40f601ea78ae4ee9445f12a58535b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Thu, 6 Nov 2025 15:11:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20web=20=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E4=B8=AD=E4=BB=BB=E5=8A=A1=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VideoAnalysis/Properties/launchSettings.json | 2 +- VideoAnalysis/WebUI/.env.production | 5 +- VideoAnalysis/WebUI/src/api/videoTask.ts | 9 + .../WebUI/src/components/hTable/hTable.ts | 8 +- .../WebUI/src/components/hTable/index.vue | 15 +- .../WebUI/src/views/welcome/index.vue | 53 ++-- .../WebUI/src/views/welcome/runningTask.vue | 254 +++--------------- .../WebUI/src/views/welcome/showTask.vue | 30 ++- .../Controllers/VideoTaskController.cs | 32 ++- 9 files changed, 139 insertions(+), 269 deletions(-) diff --git a/VideoAnalysis/Properties/launchSettings.json b/VideoAnalysis/Properties/launchSettings.json index 78c793d..4b2a454 100644 --- a/VideoAnalysis/Properties/launchSettings.json +++ b/VideoAnalysis/Properties/launchSettings.json @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "launchUrl": "/swagger/index.html", + "launchUrl": "swagger/index.html", "applicationUrl": "http://*:5238", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/VideoAnalysis/WebUI/.env.production b/VideoAnalysis/WebUI/.env.production index 55ffd00..46e40f9 100644 --- a/VideoAnalysis/WebUI/.env.production +++ b/VideoAnalysis/WebUI/.env.production @@ -13,7 +13,4 @@ VITE_CDN = false VITE_COMPRESSION = "none" -# 接口地址 -VITE_API_BASEURL = "https://learn-archives-admin.23544.com/api" -#数据中心后台地址 -VITE_API_USERCENTER_URL = "https://dcb.23544.com/api" \ No newline at end of file +VITE_API_BASEURL = "https://videoanalysis.w.23544.com:8843/" \ No newline at end of file diff --git a/VideoAnalysis/WebUI/src/api/videoTask.ts b/VideoAnalysis/WebUI/src/api/videoTask.ts index ff6798d..1160f28 100644 --- a/VideoAnalysis/WebUI/src/api/videoTask.ts +++ b/VideoAnalysis/WebUI/src/api/videoTask.ts @@ -56,3 +56,12 @@ export const ShowTaskInfo = (id: any) => { params: { id } }); }; + + + +/** 展示数据 */ +export const RunningTaskList = (data: any) => { + return http.request("post", "/api/VideoTask/RunningTaskList", { + data + }); +}; diff --git a/VideoAnalysis/WebUI/src/components/hTable/hTable.ts b/VideoAnalysis/WebUI/src/components/hTable/hTable.ts index c351a15..5240ec6 100644 --- a/VideoAnalysis/WebUI/src/components/hTable/hTable.ts +++ b/VideoAnalysis/WebUI/src/components/hTable/hTable.ts @@ -1,3 +1,4 @@ +import { promises } from "node:dns"; import { Ref } from "vue"; import { array } from "vue-types"; @@ -326,8 +327,11 @@ export class SearchConditions { /** 表格配置 */ export interface TableConfig { - /** 搜索回调函数 */ - searchCallback?: (s: SearchConditions) => void; + /** 搜索回调函数 [返回值为true则不调用基础PageAPI]*/ + searchCallback?: ( + s: SearchConditions, + tv: TableConfig + ) => Promise | Promise | boolean | void; /** 新增/修改回调函数 */ editCallback?: (from: any) => void; /** 编辑表单初始化回调函数 */ diff --git a/VideoAnalysis/WebUI/src/components/hTable/index.vue b/VideoAnalysis/WebUI/src/components/hTable/index.vue index bbae499..65d75a0 100644 --- a/VideoAnalysis/WebUI/src/components/hTable/index.vue +++ b/VideoAnalysis/WebUI/src/components/hTable/index.vue @@ -103,10 +103,11 @@ const appB_S = ref(null); function appStyle() { if (tableHeight.value !== 0) return; tableHeight.value = - appB.value.parentElement.parentElement.offsetHeight - + appB.value.parentElement.parentElement.parentElement.offsetHeight - 145 - appB_S.value.offsetHeight + 0; + console.log("tableHeight.value", tableHeight.value); return tableHeight; } @@ -288,7 +289,7 @@ function searchReload() { } } // 查询 -function handleReloadPaged(reload = true) { +async function handleReloadPaged(reload = true) { if (defaultOrderBy == null) { defaultOrderBy = { OrderBy: table.value.search.OrderBy, @@ -332,12 +333,9 @@ function handleReloadPaged(reload = true) { if (!reload && table.value.search.Conditions.length > 0) { table.value.search.PageIndex = 0; } - if (table.value.searchCallback) { - table.value.searchCallback(table.value.search); - } //如果有展开行 则全部收回 if (table.value.expandColumn) expands.value = []; - fetchPagedData(); + return fetchPagedData(); } // 加载前置数据(如查询条件的下拉选择数据) async function fetchInitData() { @@ -360,7 +358,10 @@ function getByteLen(str) { return len; } // 加载分页数据 -function fetchPagedData() { +async function fetchPagedData() { + if (table.value.searchCallback) { + if (await table.value.searchCallback(table.value.search, table.value)) return; + } for (const iterator of table.value.search.defaultConditions) { if (!iterator) continue; if (!table.value.search.Conditions.find((s) => s == iterator)) { diff --git a/VideoAnalysis/WebUI/src/views/welcome/index.vue b/VideoAnalysis/WebUI/src/views/welcome/index.vue index ce54a5b..840e516 100644 --- a/VideoAnalysis/WebUI/src/views/welcome/index.vue +++ b/VideoAnalysis/WebUI/src/views/welcome/index.vue @@ -4,6 +4,7 @@ import { ComboModel, ConditionalType, intTableData, + SearchConditions, TableColumnSearch, TableConfig, } from "@/components/hTable/hTable"; @@ -17,6 +18,7 @@ import { ReStart, RowRload } from "@/api/videoTask"; import { Refresh } from "@element-plus/icons-vue"; import { message } from "@/utils/message"; import { json } from "stream/consumers"; +import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; import { useRouter } from "vue-router"; @@ -26,15 +28,20 @@ defineOptions({ name: ControllerName, }); +const props = defineProps<{ + searchCallback?: ( + s: SearchConditions, + tv: TableConfig + ) => boolean | Promise | void; +}>(); const route = useRouter(); -function searchCallback(data) {} const table = ref<{ initTable: (config: TableConfig) => void }>(); const tableData: TableConfig = intTableData({ apiUrl: ControllerName, expandColumn: true, selectColumn: false, // 列表选择 border: false, // 是否显示表格边框 - searchCallback: searchCallback, + searchCallback: props.searchCallback, expandChange: expandChange, search: { // 查询条件 @@ -122,6 +129,25 @@ async function submitRowRload() { async function expandChange(row: any, expandedRows: any[]) { if (expandedRows.find((s) => s == row)) RloadTaskInfo(row); } +function previewTask(row: any) { + let pageName = "showTask"; + let queryData = { id: row.id.toString() }; + useMultiTagsStoreHook().handleTags("push", { + path: `/welcome/showTask_` + row.id, + name: pageName, + query: queryData, + meta: { + title: `任务预览` + row.id.toString().slice(-4), + dynamicLevel: 3, + }, + }); + // 路由跳转 + route.push({ name: pageName, query: queryData }); +} +function firstLetterToLower(str) { + if (typeof str !== "string" || !str) return str; + return str[0].toLowerCase() + str.slice(1); +} async function RloadTaskInfo(row: any) { let res = await RowRload(row.id); row.TaskInfo = res; @@ -132,7 +158,7 @@ async function RloadTaskInfo(row: any) { if (row.TaskInfo.startTime != null) { for (const element of row.TaskInfo.stepData) { element.time = formatDateToChinese( - row.TaskInfo.startTime[element.title.toLowerCase()] + row.TaskInfo.startTime[firstLetterToLower(element.title)] ); let i = row.TaskInfo.stepData.indexOf(element); if (i < row.TaskInfo.active) { @@ -184,10 +210,12 @@ const stepData = ref([

任务详情

-
+
进度 -
{{ props.row.lastEnum }} {{ props.row.progress }}
+
+ {{ props.row.TaskInfo.lastEnum }} {{ props.row.TaskInfo.progress }} +
操作 @@ -198,19 +226,8 @@ const stepData = ref([ @click="RloadTaskInfo(props.row)" circle /> - 重试 - 预览 + 重试 + 预览
diff --git a/VideoAnalysis/WebUI/src/views/welcome/runningTask.vue b/VideoAnalysis/WebUI/src/views/welcome/runningTask.vue index 823851e..7052bad 100644 --- a/VideoAnalysis/WebUI/src/views/welcome/runningTask.vue +++ b/VideoAnalysis/WebUI/src/views/welcome/runningTask.vue @@ -1,233 +1,41 @@ - - + + diff --git a/VideoAnalysis/WebUI/src/views/welcome/showTask.vue b/VideoAnalysis/WebUI/src/views/welcome/showTask.vue index 7def628..e4d4848 100644 --- a/VideoAnalysis/WebUI/src/views/welcome/showTask.vue +++ b/VideoAnalysis/WebUI/src/views/welcome/showTask.vue @@ -2,11 +2,13 @@
-

- -

+
+

+ 视频分段 +

+
@@ -137,7 +139,13 @@ const setDB = ( videoKnows.value = vKnows; videoSrc.value = c; videoPlayerEL.value?.load(); - videoPlayerEL.value?.play(); + try { + nextTick(() => { + initKD(); + }); + } catch (error) { + console.error("视频自动播放失败:", error); + } }; function timeupdateVideo() { if (displayButton.value.length === 0) initKD(); @@ -254,7 +262,6 @@ video { height: 32px; /* border-radius: 16px; */ line-height: 27px; - text-align: center; } .subtitles { @@ -289,7 +296,7 @@ video { padding: 10px; align-content: flex-start; justify-content: flex-start; - align-items: center; + align-items: flex-start; } .kBtn { @@ -312,6 +319,7 @@ video { .kBtn:hover { background-color: rgb(248, 230, 191) !important; border: 1px solid rgb(206, 187, 81); + display: block; } .knowDiv { @@ -323,7 +331,9 @@ video { border-radius: 10px; background-color: #cddc393d; } - +.knowDiv:hover .kBtn { + display: none; +} .knowDiv:hover .knowTtile { width: 340px; display: block; @@ -332,7 +342,7 @@ video { } .knowTtile { - position: absolute; + /* position: absolute; */ text-align: left; display: none; } diff --git a/VideoAnalysisCore/Controllers/VideoTaskController.cs b/VideoAnalysisCore/Controllers/VideoTaskController.cs index 475f118..32ad05a 100644 --- a/VideoAnalysisCore/Controllers/VideoTaskController.cs +++ b/VideoAnalysisCore/Controllers/VideoTaskController.cs @@ -192,7 +192,7 @@ namespace VideoAnalysisCore.Controllers await baseService.UpdateAsync(task); } //todo重新开始执行GPT分析 - return BadRequest("任务为实现"); + return BadRequest("任务未实现"); return Ok(); } @@ -270,7 +270,7 @@ namespace VideoAnalysisCore.Controllers public async Task ReStart(long id, RedisChannelEnum selectEnum) { await redisManager.ClearTaskError(id); - await Task.Run(async () => + _ = Task.Run(async () => await redisManager.InsertChannel(selectEnum, id) ); } @@ -356,8 +356,32 @@ namespace VideoAnalysisCore.Controllers } + /// + /// 预览任务结果 + /// + /// 查询模型 + /// + [HttpPost] + public async Task RunningTaskList([FromBody] QueryRequestBase model) + { + var oldTaskArr = redisManager.Redis.LRange(RedisExpandKey.IDTask, 0, 999); + var sqlquery = base.BaseQuery(model) + .Where(s => oldTaskArr.Contains(s.Id)) + .Select(s => new VideoTask + { + Id = s.Id, + TagId = s.TagId, + VideoType = s.VideoType, + LastEnum = s.LastEnum, + Subject = s.Subject, + ComeFrom = s.ComeFrom, + MediaUrl = s.MediaUrl, + CreateTime = s.CreateTime, + }); + RefAsync total = 0; + var data = await sqlquery.ToPageListAsync(model.PageIndex + 1, model.PageSize, total); + return new PageResult() { Data = data, Total = total }; - - + } } }